Skip to content

Commit de30b5f

Browse files
committed
Make layout switch from horizontal layout to
vertical when the map is less than 50% of the mapmlify container width.
1 parent ac25192 commit de30b5f

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

src/script/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ loadBtn.addEventListener('click', async () => {
180180
const url = wmsUrlInput.value.trim();
181181

182182
if (!url) {
183-
alert('Please enter a WMS capabilities URL');
183+
alert('Please enter a capabilities URL');
184184
return;
185185
}
186186

src/style/main.css

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ button:active {
139139
display: flex;
140140
gap: 1rem;
141141
align-items: flex-start;
142+
flex-wrap: wrap;
142143
}
143144

144145
.layer-controls {
@@ -149,8 +150,33 @@ button:active {
149150
}
150151

151152
.layer-viewer-container {
152-
flex: 1;
153+
flex: 1 1 300px;
153154
min-height: 300px;
155+
min-width: 300px;
156+
}
157+
158+
/*
159+
Responsive layout: switch to vertical when viewer would be < 50% width
160+
Breakpoint: 300px (controls) + 16px (gap) + 300px (min viewer) = 616px content
161+
Plus padding/margins: ~776px viewport width
162+
*/
163+
@media (max-width: 800px) {
164+
.layer-item {
165+
flex-direction: column;
166+
align-items: stretch;
167+
}
168+
169+
.layer-controls {
170+
flex: 1 1 auto;
171+
min-width: 100%;
172+
max-width: 100%;
173+
}
174+
175+
.layer-viewer-container {
176+
flex: 1 1 auto;
177+
width: 100%;
178+
min-width: 100%;
179+
}
154180
}
155181

156182
.layer-viewer-container mapml-viewer {

0 commit comments

Comments
 (0)