diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index 7b8beb2b27..4494bca99a 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -4,12 +4,10 @@ #### Changed behavior of the `Draw` interaction -For better drawing experience, especially on mobile devices, two changes were made to the behavior of the Draw interaction: +For better drawing experience, two changes were made to the behavior of the Draw interaction: - 1. On long press, the current vertex can be moved to its desired position. - 2. When moving the mouse or panning the map, no draw cursor is shown, and the geometry being drawn is not updated. But because of 1., the draw cursor will appear on long press. - -To get the old behavior, configure the `Drag` interaction with `dragVertexDelay: 0`. + 1. On long press, the current vertex can be dragged to its desired position. + 2. On touch move (e.g. when panning the map on a mobile device), no draw cursor is shown, and the geometry being drawn is not updated. But because of 1., the draw cursor will appear on long press. Mouse moves are not affected by this change. #### Changes in proj4 integration diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index bed2038584..47efd71ec5 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -19,6 +19,7 @@ import LineString from '../geom/LineString.js'; import MultiLineString from '../geom/MultiLineString.js'; import MultiPoint from '../geom/MultiPoint.js'; import MultiPolygon from '../geom/MultiPolygon.js'; +import MouseSource from '../pointer/MouseSource.js'; import Point from '../geom/Point.js'; import Polygon, {fromCircle, makeRegular} from '../geom/Polygon.js'; import DrawEventType from '../interaction/DrawEventType.js'; @@ -374,9 +375,10 @@ Draw.handleEvent = function(event) { pass = false; } else if (move) { pass = event.type === MapBrowserEventType.POINTERMOVE; - if (pass && this.freehand_ || this.dragVertexDelay_ === 0) { + if (pass && this.freehand_) { pass = this.handlePointerMove_(event); - } else if (event.type === MapBrowserEventType.POINTERDRAG && !this.downTimeout_) { + } else if (event.pointerEvent.pointerType == MouseSource.POINTER_TYPE || + (event.type === MapBrowserEventType.POINTERDRAG && !this.downTimeout_)) { this.handlePointerMove_(event); } } else if (event.type === MapBrowserEventType.DBLCLICK) {