Browse Source

UI: Fix image map resize. Improve image input widgets to show/hide control buttons.

pull/6180/head
Igor Kulikov 5 years ago
parent
commit
70c152ad92
  1. 18
      application/src/main/data/json/system/widget_bundles/input_widgets.json
  2. 8
      ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts

18
application/src/main/data/json/system/widget_bundles/input_widgets.json

File diff suppressed because one or more lines are too long

8
ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts

@ -164,6 +164,7 @@ export class ImageMap extends LeafletMap {
const southWest = this.pointToLatLng(-padding, h + padding);
const northEast = this.pointToLatLng(w + padding, -padding);
const maxBounds = new L.LatLngBounds(southWest, northEast);
(this.map as any)._enforcingBounds = true;
this.map.setMaxBounds(maxBounds);
if (lastCenterPos) {
lastCenterPos.x *= w;
@ -171,6 +172,7 @@ export class ImageMap extends LeafletMap {
const center = this.pointToLatLng(lastCenterPos.x, lastCenterPos.y);
this.map.panTo(center, { animate: false });
}
(this.map as any)._enforcingBounds = false;
}
onResize(updateImage?: boolean) {
@ -195,7 +197,9 @@ export class ImageMap extends LeafletMap {
lastCenterPos.x /= prevWidth;
lastCenterPos.y /= prevHeight;
this.updateBounds(updateImage, lastCenterPos);
this.map.invalidateSize(true);
(this.map as any)._enforcingBounds = true;
this.map.invalidateSize(false);
(this.map as any)._enforcingBounds = false;
this.updateMarkers(this.markersData);
if (this.options.draggableMarker && this.addMarkers.length) {
this.addMarkers.forEach((marker) => {
@ -266,7 +270,7 @@ export class ImageMap extends LeafletMap {
return L.CRS.Simple.pointToLatLng({ x, y } as L.PointExpression, maxZoom - 1);
}
latLngToPoint(latLng: LatLngLiteral) {
latLngToPoint(latLng: LatLngLiteral): L.Point {
return L.CRS.Simple.latLngToPoint(latLng, maxZoom - 1);
}

Loading…
Cancel
Save