Skip to content

Commit f73fd97

Browse files
committed
feat: added extent support on map
1 parent 101dbca commit f73fd97

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/GEOComp.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ var GEOComp = (function () {
148148
onEvent: eventHandlerControl(eventDefinitions),
149149
startDate: stringSimpleControl(), //TODO replace with date picker
150150
endDate: stringSimpleControl(),
151+
extent: ArrayControl,
151152
features:
152153
featureControl({
153154
menu: false,
@@ -205,6 +206,7 @@ var GEOComp = (function () {
205206
projection: string;
206207
startDate: string;
207208
endDate: string;
209+
extent: any;
208210

209211
test: any
210212
}) => {
@@ -329,6 +331,7 @@ var GEOComp = (function () {
329331
projection={props.projection}
330332
startDate={props.startDate}
331333
endDate={props.endDate}
334+
extent={props.extent}
332335
/>
333336
</div>
334337
</div>
@@ -345,6 +348,7 @@ var GEOComp = (function () {
345348
{children.maxZoom.propertyView({ label: "maxZoom" })}
346349
{children.rotation.propertyView({ label: "rotation" })}
347350
{children.projection.propertyView({ label: "projection" })}
351+
{children.extent.propertyView({ label: "extent" })}
348352
</Section>
349353
<Section name="Interaction">
350354
{children.onEvent.propertyView()}

src/vendors/Geo.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,10 @@ function Geo(props) {
202202
zoom: props.zoom,
203203
maxZoom: props.maxZoom,
204204
rotation: props.rotation,
205-
projection: props.projection
205+
projection: props.projection,
206+
extent: props.extent && props.extent.length == 4 ?
207+
transformExtent(props.extent, 'EPSG:4326', props.projection) :
208+
[-Infinity, -Infinity, Infinity, Infinity]
206209
}),
207210
target: 'GEO_' + geoId,
208211
layers: [],
@@ -707,7 +710,7 @@ function Geo(props) {
707710
//Add map init event
708711
fireEvent('map:init', map)
709712
}
710-
}, [props.features, props.projection, props.startDate, props.endDate, geoRef]);
713+
}, [props.features, props.extent, props.projection, props.startDate, props.endDate, geoRef]);
711714

712715

713716
useEffect(() => {
@@ -817,6 +820,7 @@ Geo.propTypes = {
817820
projection: PropTypes.string,
818821
startDate: PropTypes.string,
819822
endDate: PropTypes.string,
823+
extent: PropTypes.array,
820824
}
821825

822826
export default Geo;

0 commit comments

Comments
 (0)