@@ -512,7 +512,7 @@ class MinimapElement {
512512 this . getFrontCanvas ( ) ,
513513 {
514514 mousedown : ( e ) => { this . canvasPressed ( extractMouseEventData ( e ) ) } ,
515- touchstart : ( e ) => { this . canvasPressed ( this . extractTouchEventData ( e ) ) }
515+ touchstart : ( e ) => { this . canvasPressed ( extractTouchEventData ( e ) ) }
516516 } ,
517517 { passive : true }
518518 )
@@ -533,7 +533,7 @@ class MinimapElement {
533533 this . appendChild ( this . visibleArea )
534534 this . visibleAreaSubscription = this . subscribeTo ( this . visibleArea , {
535535 mousedown : ( e ) => { this . startDrag ( extractMouseEventData ( e ) ) } ,
536- touchstart : ( e ) => { this . startDrag ( this . extractTouchEventData ( e ) ) }
536+ touchstart : ( e ) => { this . startDrag ( extractTouchEventData ( e ) ) }
537537 } , { passive : true } )
538538
539539 this . subscriptions . add ( this . visibleAreaSubscription )
@@ -1139,29 +1139,6 @@ class MinimapElement {
11391139 this . minimap . setTextEditorScrollTop ( ratio * this . minimap . getTextEditorMaxScrollTop ( ) )
11401140 }
11411141
1142- /**
1143- * A method that extracts data from a `TouchEvent` which can then be used to
1144- * process clicks and drags of the minimap.
1145- *
1146- * Used together with `extractMouseEventData` to provide a unified interface
1147- * for `MouseEvent`s and `TouchEvent`s.
1148- *
1149- * @param {TouchEvent } touchEvent the touch event object
1150- * @access private
1151- */
1152- extractTouchEventData ( touchEvent ) {
1153- // Use the first touch on the target area. Other touches will be ignored in
1154- // case of multi-touch.
1155- const touch = touchEvent . changedTouches [ 0 ]
1156-
1157- return {
1158- x : touch . pageX ,
1159- y : touch . pageY ,
1160- isLeftMouse : true , // Touch is treated like a left mouse button click
1161- isMiddleMouse : false
1162- }
1163- }
1164-
11651142 /**
11661143 * Subscribes to a media query for device pixel ratio changes and forces
11671144 * a repaint when it occurs.
@@ -1211,7 +1188,7 @@ class MinimapElement {
12111188 const mousemoveHandler = ( e ) => this . drag ( extractMouseEventData ( e ) , initial )
12121189 const mouseupHandler = ( e ) => this . endDrag ( )
12131190
1214- const touchmoveHandler = ( e ) => this . drag ( this . extractTouchEventData ( e ) , initial )
1191+ const touchmoveHandler = ( e ) => this . drag ( extractTouchEventData ( e ) , initial )
12151192 const touchendHandler = ( e ) => this . endDrag ( )
12161193
12171194 document . body . addEventListener ( 'mousemove' , mousemoveHandler , { passive : true } )
@@ -1296,6 +1273,29 @@ function extractMouseEventData (mouseEvent) {
12961273 }
12971274}
12981275
1276+ /**
1277+ * A method that extracts data from a `TouchEvent` which can then be used to
1278+ * process clicks and drags of the minimap.
1279+ *
1280+ * Used together with `extractMouseEventData` to provide a unified interface
1281+ * for `MouseEvent`s and `TouchEvent`s.
1282+ *
1283+ * @param {TouchEvent } touchEvent the touch event object
1284+ * @access private
1285+ */
1286+ function extractTouchEventData ( touchEvent ) {
1287+ // Use the first touch on the target area. Other touches will be ignored in
1288+ // case of multi-touch.
1289+ const touch = touchEvent . changedTouches [ 0 ]
1290+
1291+ return {
1292+ x : touch . pageX ,
1293+ y : touch . pageY ,
1294+ isLeftMouse : true , // Touch is treated like a left mouse button click
1295+ isMiddleMouse : false
1296+ }
1297+ }
1298+
12991299// ###### ###### ######
13001300// ## ## ## ## ## ##
13011301// ## ## ##
0 commit comments