#905 - give the drag handler back its start property - controls use but do not modify these handler properties
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3906 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -40,10 +40,16 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
|
||||
|
||||
/**
|
||||
* Property: last
|
||||
* {<OpenLayers.Pixel>}
|
||||
* {<OpenLayers.Pixel>} The last pixel location of the drag.
|
||||
*/
|
||||
last: null,
|
||||
|
||||
/**
|
||||
* Property: start
|
||||
* {<OpenLayers.Pixel>} The first pixel location of the drag.
|
||||
*/
|
||||
start: null,
|
||||
|
||||
/**
|
||||
* Property: oldOnselectstart
|
||||
* {Function}
|
||||
@@ -90,6 +96,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
|
||||
if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) {
|
||||
this.started = true;
|
||||
this.dragging = false;
|
||||
this.start = evt.xy;
|
||||
this.last = evt.xy;
|
||||
// TBD replace with CSS classes
|
||||
this.map.div.style.cursor = "move";
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
}
|
||||
|
||||
function test_Handler_Drag_callbacks(t) {
|
||||
t.plan(28);
|
||||
t.plan(30);
|
||||
|
||||
var map = new OpenLayers.Map('map', {controls: []});
|
||||
|
||||
@@ -141,6 +141,9 @@
|
||||
map.events.triggerEvent("mousedown", testEvents.down);
|
||||
t.ok(handler.started, "mousedown sets the started flag to true");
|
||||
t.ok(!handler.dragging, "mouse down sets the dragging flag to false");
|
||||
t.ok(handler.start.x == testEvents.down.xy.x &&
|
||||
handler.start.y == testEvents.down.xy.y,
|
||||
"mouse down sets handler.start correctly");
|
||||
t.ok(handler.last.x == testEvents.down.xy.x &&
|
||||
handler.last.y == testEvents.down.xy.y,
|
||||
"mouse down sets handler.last correctly");
|
||||
@@ -159,6 +162,9 @@
|
||||
handler.started = true;
|
||||
map.events.triggerEvent("mousemove", testEvents.move);
|
||||
t.ok(handler.dragging, "mousemove sets the dragging flag to true");
|
||||
t.ok(handler.start.x == testEvents.down.xy.x &&
|
||||
handler.start.y == testEvents.down.xy.y,
|
||||
"mouse move leaves handler.start alone");
|
||||
t.ok(handler.last.x == testEvents.move.xy.x &&
|
||||
handler.last.y == testEvents.move.xy.y,
|
||||
"mouse move sets handler.last correctly");
|
||||
|
||||
Reference in New Issue
Block a user