Fixed onselect handling for the first down-move-up-out cycle. r=bartvde (closes #2735)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10637 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -200,8 +200,8 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
|
||||
|
||||
if(!this.oldOnselectstart) {
|
||||
this.oldOnselectstart = (document.onselectstart) ? document.onselectstart : OpenLayers.Function.True;
|
||||
document.onselectstart = OpenLayers.Function.False;
|
||||
}
|
||||
document.onselectstart = OpenLayers.Function.False;
|
||||
|
||||
propagate = !this.stopDown;
|
||||
} else {
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
}
|
||||
|
||||
function test_Handler_Drag_submethods(t) {
|
||||
t.plan(4);
|
||||
t.plan(8);
|
||||
|
||||
var map = new OpenLayers.Map('map', {controls: []});
|
||||
|
||||
@@ -300,6 +300,11 @@
|
||||
var handler = new OpenLayers.Handler.Drag(control, {});
|
||||
// set test events
|
||||
var events = ["down", "move", "up", "out"];
|
||||
var onselect = {
|
||||
"move": OpenLayers.Function.False,
|
||||
"up": OpenLayers.Function.False,
|
||||
"out": OpenLayers.Function.True
|
||||
}
|
||||
var testEvents = {};
|
||||
var type, px;
|
||||
for(var i=0; i<events.length; ++i) {
|
||||
@@ -313,10 +318,14 @@
|
||||
t.ok(evt.xy.x == testEvents[type].xy.x &&
|
||||
evt.xy.y == testEvents[type].xy.y,
|
||||
"handler." + type + " called with the right event");
|
||||
onselect[type] && t.ok(document.onselectstart === onselect[type], "document.onselectstart listener is correct after " + type);
|
||||
}
|
||||
}
|
||||
handler.activate();
|
||||
|
||||
// pretend that we have gone through a down-move-up-out cycle before
|
||||
handler.oldOnselectstart = OpenLayers.Function.True;
|
||||
|
||||
// test mousedown
|
||||
handler.checkModifiers = function(evt) {
|
||||
return true;
|
||||
@@ -343,6 +352,8 @@
|
||||
map.events.triggerEvent("mouseout", testEvents.out);
|
||||
OpenLayers.Util.mouseLeft = oldMouseLeft;
|
||||
|
||||
t.ok(document.onselectstart === OpenLayers.Function.True, "document.onselectstart listener correct after down-move-up-out cycle");
|
||||
|
||||
}
|
||||
|
||||
function test_Handler_Drag_deactivate(t) {
|
||||
|
||||
Reference in New Issue
Block a user