gwcCreateModalDialog에서 크기 조절 시 UI가 적절하게 배치되도록 하기 위한 코드를 정리해 봅니다.
먼저 만들고자 하는 UI는 다음 영상과 같습니다.
먼저 JS 코드는 다음과 같습니다.
class GeocodingTool {
constructor() {
const dlg = gwcCreateModalDialog("지오코딩");
dlg.content = `
<div class="geocoding-tool-dialog">
<div class="content vertical-linear-layout">
<div class="horizontal-linear-layout v-center">
<gwc-space size="3px"></gwc-space>
<gwc-toolbutton class="archive" icon="../images/load.svg" title="아카이브에서 데이터 불러오기"></gwc-toolbutton>
<gwc-space size="10px"></gwc-space>
<gwc-select class="address-column" label="주소 컬럼"></gwc-select>
<gwc-space size="5px"></gwc-space>
<gwc-checkbox title="정좌표" class="coord-correct" checked="true"></gwc-checkbox>
<gwc-checkbox title="인근좌표" class="coord-nearby" checked="true"></gwc-checkbox>
<gwc-checkbox title="대표좌표" class="coord-represent" checked="false"></gwc-checkbox>
<gwc-toolbutton class="run" icon="../images/done.svg" title="지오코딩 실행"></gwc-toolbutton>
<gwc-space size="3px"></gwc-space>
</div>
<gwc-grid></gwc-grid>
<div class="grid-navigator horizontal-linear-layout v-center h-center">
<gwc-toolbutton class="move-first" icon="../images/move_first.svg"></gwc-toolbutton>
<gwc-toolbutton class="move-prev" icon="../images/move_prev.svg"></gwc-toolbutton>
<gwc-label class="progress-label" content="65%"></gwc-label>
<gwc-toolbutton class="move-next" icon="../images/move_next.svg"></gwc-toolbutton>
<gwc-toolbutton class="move-last" icon="../images/move_last.svg"></gwc-toolbutton>
</div>
</div>
</div>
`;
dlg.width = "70em"; // 크기 조절 기능을 위해서는 반드시 크기를 지정해줘야 함
dlg.height = "50em"; // 크기 조절 기능을 위해서는 반드시 크기를 지정해줘야 함
dlg.resizablePanel.minWidth = 550;
dlg.resizablePanel.minHeight = 300;
dlg.resizablePanel.resizableRight = true;
dlg.resizablePanel.resizableBottom = true;
dlg.show();
GeoServiceWebComponentManager.instance.update();
}
}
class GeocodingTool {
constructor() {
const dlg = gwcCreateModalDialog("지오코딩");
dlg.content = `
<div class="geocoding-tool-dialog">
<div class="content vertical-linear-layout">
<div class="horizontal-linear-layout v-center">
<gwc-space size="3px"></gwc-space>
<gwc-toolbutton class="archive" icon="../images/load.svg" title="아카이브에서 데이터 불러오기"></gwc-toolbutton>
<gwc-space size="10px"></gwc-space>
<gwc-select class="address-column" label="주소 컬럼"></gwc-select>
<gwc-space size="5px"></gwc-space>
<gwc-checkbox title="정좌표" class="coord-correct" checked="true"></gwc-checkbox>
<gwc-checkbox title="인근좌표" class="coord-nearby" checked="true"></gwc-checkbox>
<gwc-checkbox title="대표좌표" class="coord-represent" checked="false"></gwc-checkbox>
<gwc-toolbutton class="run" icon="../images/done.svg" title="지오코딩 실행"></gwc-toolbutton>
<gwc-space size="3px"></gwc-space>
</div>
<gwc-grid></gwc-grid>
<div class="grid-navigator horizontal-linear-layout v-center h-center">
<gwc-toolbutton class="move-first" icon="../images/move_first.svg"></gwc-toolbutton>
<gwc-toolbutton class="move-prev" icon="../images/move_prev.svg"></gwc-toolbutton>
<gwc-label class="progress-label" content="65%"></gwc-label>
<gwc-toolbutton class="move-next" icon="../images/move_next.svg"></gwc-toolbutton>
<gwc-toolbutton class="move-last" icon="../images/move_last.svg"></gwc-toolbutton>
</div>
</div>
</div>
`;
dlg.width = "70em"; // 크기 조절 기능을 위해서는 반드시 크기를 지정해줘야 함
dlg.height = "50em"; // 크기 조절 기능을 위해서는 반드시 크기를 지정해줘야 함
dlg.resizablePanel.minWidth = 550;
dlg.resizablePanel.minHeight = 300;
dlg.resizablePanel.resizableRight = true;
dlg.resizablePanel.resizableBottom = true;
dlg.show();
GeoServiceWebComponentManager.instance.update();
}
}
class GeocodingTool { constructor() { const dlg = gwcCreateModalDialog("지오코딩"); dlg.content = ``; dlg.width = "70em"; // 크기 조절 기능을 위해서는 반드시 크기를 지정해줘야 함 dlg.height = "50em"; // 크기 조절 기능을 위해서는 반드시 크기를 지정해줘야 함 dlg.resizablePanel.minWidth = 550; dlg.resizablePanel.minHeight = 300; dlg.resizablePanel.resizableRight = true; dlg.resizablePanel.resizableBottom = true; dlg.show(); GeoServiceWebComponentManager.instance.update(); } }
CSS 코드는 다음과 같습니다.
.vertical-linear-layout {
display: flex;
flex-direction: column;
gap: 0.3em;
}
.horizontal-linear-layout {
display: flex;
gap: 0.3em;
flex-direction: row;
_padding: 0 1em;
}
.v-center {
align-items: center;
}
.h-center {
justify-content: center;
}
.geocoding-tool-dialog {
padding: 0.5em;
height: 100%;
}
.geocoding-tool-dialog .content {
height: 100%;
}
.geocoding-tool-dialog gwc-grid {
flex: 1;
}
.geocoding-tool-dialog .address-column {
width: 250px;
}
.geocoding-tool-dialog .run {
margin-left: auto;
}
.vertical-linear-layout {
display: flex;
flex-direction: column;
gap: 0.3em;
}
.horizontal-linear-layout {
display: flex;
gap: 0.3em;
flex-direction: row;
_padding: 0 1em;
}
.v-center {
align-items: center;
}
.h-center {
justify-content: center;
}
.geocoding-tool-dialog {
padding: 0.5em;
height: 100%;
}
.geocoding-tool-dialog .content {
height: 100%;
}
.geocoding-tool-dialog gwc-grid {
flex: 1;
}
.geocoding-tool-dialog .address-column {
width: 250px;
}
.geocoding-tool-dialog .run {
margin-left: auto;
}
.vertical-linear-layout { display: flex; flex-direction: column; gap: 0.3em; } .horizontal-linear-layout { display: flex; gap: 0.3em; flex-direction: row; _padding: 0 1em; } .v-center { align-items: center; } .h-center { justify-content: center; } .geocoding-tool-dialog { padding: 0.5em; height: 100%; } .geocoding-tool-dialog .content { height: 100%; } .geocoding-tool-dialog gwc-grid { flex: 1; } .geocoding-tool-dialog .address-column { width: 250px; } .geocoding-tool-dialog .run { margin-left: auto; }