Show last segment and vertex for mouse pointer move

This commit is contained in:
Andreas Hocevar
2018-01-17 01:35:17 +01:00
parent 276194d554
commit be57e40e91
2 changed files with 7 additions and 7 deletions

View File

@@ -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

View File

@@ -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) {