File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
python/jupyter_leaflet/src Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 55import L from '../leaflet' ;
66import * as control from './Control' ;
77
8+ // Workaround for map panning bug
9+ // from https://github.com/ljagis/leaflet-measure/issues/171#issuecomment-1137483548
10+ L . Control . Measure . include ( {
11+ // set icon on the capture marker
12+ _setCaptureMarkerIcon : function ( ) {
13+ // disable autopan
14+ this . _captureMarker . options . autoPanOnFocus = false ;
15+
16+ // default function
17+ this . _captureMarker . setIcon (
18+ L . divIcon ( {
19+ iconSize : this . _map . getSize ( ) . multiplyBy ( 2 ) ,
20+ } )
21+ ) ;
22+ } ,
23+ } ) ;
824export class LeafletMeasureControlModel extends control . LeafletControlModel {
925 defaults ( ) {
1026 return {
@@ -37,7 +53,6 @@ export class LeafletMeasureControlView extends control.LeafletControlView {
3753 }
3854
3955 create_obj ( ) {
40- //@ts -ignore
4156 this . obj = L . control . measure ( this . get_options ( ) ) ;
4257 this . default_units = L . extend ( { } , this . obj . options . units ) ;
4358 }
Original file line number Diff line number Diff line change @@ -138,9 +138,17 @@ declare module 'leaflet' {
138138 constructor ( options ?: LegendOptions ) ;
139139 options : LegendOptions ;
140140 }
141+
142+ interface MeasureOptions extends ControlOptions { }
143+ class Measure extends Control {
144+ constructor ( options ?: MeasureOptions ) ;
145+ options : MeasureOptions ;
146+ _setCaptureMarkerIcon : ( ) => void ;
147+ }
141148 }
142149
143150 declare namespace control {
144151 function legend ( options ?: Control . LegendOptions ) : Control . Legend ;
152+ function measure ( options ?: Control . MeasureOptions ) : Control . Measure ;
145153 }
146154}
You can’t perform that action at this time.
0 commit comments