Skip to content

Commit 7f4dd82

Browse files
committed
feat: Added resize offset
1 parent 9d24320 commit 7f4dd82

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

src/GEOComp.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ var GEOComp = (function () {
186186
"splitscreen:vertical": false,
187187
debug: geoContext.previewMode,
188188
}),
189+
resizeOffset: withDefault(NumberControl, 4),
189190
external: jsonObjectExposingStateControl("external"),
190191
};
191192

@@ -214,8 +215,8 @@ var GEOComp = (function () {
214215
startDate: string;
215216
endDate: string;
216217
extent: any;
217-
external: any
218-
218+
resizeOffset: number;
219+
external: any;
219220
test: any
220221
}) => {
221222
//Default size of component
@@ -281,13 +282,14 @@ var GEOComp = (function () {
281282
const pads = props.styles.padding.split(' ');
282283
const marg = props.styles.margin.split(' ');
283284
const offset = (parseFloat(pads[pads.length == 4 ? 3 : 0].replace("px", "")) * 2) + (parseFloat(marg[marg.length == 4 ? 3 : 0].replace("px", "")) * 2)
284-
const parentOffset = 0
285285
//TODO: Take care of margin and padding, but also that of parents
286-
var newHeight = dimensions.height + (eventObj.windowSize.height - eventObj.bounds.bottom - (offset + parentOffset))
287-
eventObj.element.style.height = `${newHeight}px`
288-
setDimensions({ width: dimensions.width, height: newHeight })
289-
if (featureEnabled("debug"))
290-
console.debug("Resized done", newHeight)
286+
var newHeight = dimensions.height + (eventObj.windowSize.height - eventObj.bounds.bottom - (offset + (props.resizeOffset || 0)))
287+
if (newHeight != dimensions.height) {
288+
eventObj.element.style.height = `${newHeight}px`
289+
setDimensions({ width: dimensions.width, height: newHeight })
290+
if (featureEnabled("debug"))
291+
console.debug("Resized done", newHeight)
292+
}
291293
}
292294
break
293295
default:
@@ -369,6 +371,7 @@ var GEOComp = (function () {
369371
</Section>
370372
<Section name="Styles">
371373
{children.autoHeight.getPropertyView()}
374+
{children.resizeOffset.propertyView({ label: "Resize Offset" })}
372375
{children.styles.getPropertyView()}
373376
</Section>
374377
<Section name="Behavior" open="false">

src/LayersControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ var LayerObjectOption = new MultiCompBuilder(
129129
style: withDefault(ArrayOrJSONObjectControl),
130130
source: SourceControl(),
131131
visible: withDefault(BoolControl, true),
132+
loadSource: withDefault(BoolControl, false),
132133
selectable: withDefault(BoolControl, true),
133134
userVisible: withDefault(BoolControl, true),
134135
minZoom: withDefault(NumberControl, 0),

src/i18n/comps/locales/en.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ export const en = {
7575
"modify:snap": "Enable snapping to draw features",
7676
"splitscreen:horizontal": "Horizontal (Splitscreen)",
7777
"splitscreen:vertical": "Vertical (Splitscreen)",
78-
debug: "Log debug to console"
78+
debug: "Log debug to console",
79+
resizeOffset: "Resize Offset"
7980
},
8081
layer: {
8182
type: "Type",
@@ -85,6 +86,7 @@ export const en = {
8586
minZoom: "Min Zoom",
8687
maxZoom: "Max Zoom",
8788
visible: "Visible",
89+
loadSource: "Load Always",
8890
opacity: "Opacity",
8991
selectable: "Selectable",
9092
groups: "Group(s)",

src/vendors/Geo.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ Geo.propTypes = {
831831
maxZoom: PropTypes.number,
832832
rotation: PropTypes.number,
833833
onEvent: PropTypes.func,
834-
skipRemodify: PropTypes.func,
835834
menuTitle: PropTypes.string,
836835
menuContent: PropTypes.string,
837836
layers: PropTypes.array,

0 commit comments

Comments
 (0)