Merge pull request #927 from adv-isu/HandlerPathUndoTouchFix2

Improved touch support for Handler.Path.undo
This commit is contained in:
ahocevar
2013-04-20 02:32:31 -07:00
2 changed files with 28 additions and 1 deletions

View File

@@ -271,6 +271,16 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
var target = components[index];
var undone = geometry.removeComponent(target);
if (undone) {
// On touch devices, set the current ("mouse location") point to
// match the last digitized point.
if (this.touch && index > 0) {
components = geometry.components; // safety
var lastpt = components[index - 1];
var curptidx = this.getCurrentPointIndex();
var curpt = components[curptidx];
curpt.x = lastpt.x;
curpt.y = lastpt.y;
}
if (!this.redoStack) {
this.redoStack = [];
}