UI: Fix image map resize. Improve image input widgets to show/hide control buttons.
This commit is contained in:
		
							parent
							
								
									e8eb7083b3
								
							
						
					
					
						commit
						70c152ad92
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user