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 5
5
import L from '../leaflet' ;
6
6
import * as control from './Control' ;
7
7
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
+ } ) ;
8
24
export class LeafletMeasureControlModel extends control . LeafletControlModel {
9
25
defaults ( ) {
10
26
return {
@@ -37,7 +53,6 @@ export class LeafletMeasureControlView extends control.LeafletControlView {
37
53
}
38
54
39
55
create_obj ( ) {
40
- //@ts -ignore
41
56
this . obj = L . control . measure ( this . get_options ( ) ) ;
42
57
this . default_units = L . extend ( { } , this . obj . options . units ) ;
43
58
}
Original file line number Diff line number Diff line change @@ -138,9 +138,17 @@ declare module 'leaflet' {
138
138
constructor ( options ?: LegendOptions ) ;
139
139
options : LegendOptions ;
140
140
}
141
+
142
+ interface MeasureOptions extends ControlOptions { }
143
+ class Measure extends Control {
144
+ constructor ( options ?: MeasureOptions ) ;
145
+ options : MeasureOptions ;
146
+ _setCaptureMarkerIcon : ( ) => void ;
147
+ }
141
148
}
142
149
143
150
declare namespace control {
144
151
function legend ( options ?: Control . LegendOptions ) : Control . Legend ;
152
+ function measure ( options ?: Control . MeasureOptions ) : Control . Measure ;
145
153
}
146
154
}
You can’t perform that action at this time.
0 commit comments