Commit cd88afea005b6fcec3cde05f97d20798a95c840a
1 parent
7245f880
fix empty center position & fix entity id
Showing
2 changed files
with
12 additions
and
8 deletions
... | ... | @@ -198,9 +198,15 @@ export default abstract class LeafletMap { |
198 | 198 | |
199 | 199 | fitBounds(bounds: LatLngBounds, useDefaultZoom = false, padding?: LatLngTuple) { |
200 | 200 | if (bounds.isValid()) { |
201 | - if ((!this.options.fitMapBounds || this.options.useDefaultCenterPosition) && this.options.defaultZoomLevel) { | |
201 | + this.bounds = this.bounds.extend(bounds); | |
202 | + if (!this.options.fitMapBounds && this.options.defaultZoomLevel) { | |
202 | 203 | this.map.setZoom(this.options.defaultZoomLevel, { animate: false }); |
203 | - this.map.panTo(this.options.defaultCenterPosition, { animate: false }); | |
204 | + if (this.options.useDefaultCenterPosition) { | |
205 | + this.map.panTo(this.options.defaultCenterPosition, { animate: false }); | |
206 | + } | |
207 | + else { | |
208 | + this.map.panTo(this.bounds.getCenter()); | |
209 | + } | |
204 | 210 | } else { |
205 | 211 | this.map.once('zoomend', () => { |
206 | 212 | if (!this.options.defaultZoomLevel && this.map.getZoom() > this.options.minZoomLevel) { |
... | ... | @@ -212,7 +218,6 @@ export default abstract class LeafletMap { |
212 | 218 | } |
213 | 219 | this.map.fitBounds(bounds, { padding: padding || [50, 50], animate: false }); |
214 | 220 | } |
215 | - this.bounds = bounds; | |
216 | 221 | } |
217 | 222 | } |
218 | 223 | ... | ... |
... | ... | @@ -154,12 +154,11 @@ export class MapWidgetController implements MapWidgetInterface { |
154 | 154 | if ($event && $event.stopPropagation) { |
155 | 155 | $event?.stopPropagation(); |
156 | 156 | } |
157 | - const { id, entityName, entityLabel, entityType } = entityInfo; | |
158 | - const entityId: EntityId = { | |
157 | + const { entityId, entityName, entityLabel, entityType } = entityInfo; | |
158 | + this.ctx.actionsApi.handleWidgetAction($event, descriptor, { | |
159 | 159 | entityType, |
160 | - id | |
161 | - }; | |
162 | - this.ctx.actionsApi.handleWidgetAction($event, descriptor, entityId, entityName, null, entityLabel); | |
160 | + id: entityId | |
161 | + }, entityName, null, entityLabel); | |
163 | 162 | } |
164 | 163 | |
165 | 164 | setMarkerLocation = (e) => { | ... | ... |