Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: .../OpenLayers/Handler/Drag.js
- ===================================================================
- --- .../OpenLayers/Handler/Drag.js (revision 600)
- +++ .../OpenLayers/Handler/Drag.js (working copy)
- @@ -189,6 +189,10 @@
- var propagate = true;
- this.dragging = false;
- if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) {
- + this.downEvt = OpenLayers.Util.extend({}, evt);
- + delete this.downEvt.preventDefault;
- + delete this.downEvt.stopPropagation;
- +
- this.started = true;
- this.start = evt.xy;
- this.last = evt.xy;
- @@ -269,6 +273,7 @@
- * {Boolean} Let the event propagate.
- */
- mouseup: function (evt) {
- + var propagate = true;
- if (this.started) {
- if(this.documentDrag === true && this.documentEvents) {
- this.adjustXY(evt);
- @@ -284,12 +289,29 @@
- this.callback("up", [evt.xy]);
- if(dragged) {
- this.callback("done", [evt.xy]);
- + } else {
- + this.replayClickSequence();
- + propagate = false;
- }
- document.onselectstart = this.oldOnselectstart;
- }
- - return true;
- + return propagate;
- },
- + replayClickSequence: function() {
- + this.map.events.injectEventLower(this.downEvt.type, this.downEvt, this);
- +
- + var upEvt = OpenLayers.Util.extend({}, this.downEvt);
- + upEvt.type = 'mouseup';
- + this.map.events.injectEventLower(upEvt.type, upEvt, this);
- +
- + var clickEvt = OpenLayers.Util.extend({}, this.downEvt);
- + clickEvt.type = 'click';
- + this.map.events.injectEventLower(clickEvt.type, clickEvt, this);
- +
- + this.downEvt = null;
- + },
- +
- /**
- * Method: mouseout
- * Handle mouseout events
- @@ -301,6 +323,7 @@
- * {Boolean} Let the event propagate.
- */
- mouseout: function (evt) {
- + var propagate = true;
- if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.div)) {
- if(this.documentDrag === true) {
- this.documentEvents = new OpenLayers.Events(this, document,
- @@ -323,13 +346,16 @@
- this.callback("out", []);
- if(dragged) {
- this.callback("done", [evt.xy]);
- + } else {
- + this.replayClickSequence();
- + propagate = false;
- }
- if(document.onselectstart) {
- document.onselectstart = this.oldOnselectstart;
- }
- }
- }
- - return true;
- + return propagate;
- },
- /**
- Index: .../OpenLayers/Events.js
- ===================================================================
- --- .../OpenLayers/Events.js (revision 600)
- +++ .../OpenLayers/Events.js (working copy)
- @@ -737,7 +737,8 @@
- * {Boolean} The last listener return. If a listener returns false, the
- * chain of listeners will stop getting called.
- */
- - triggerEvent: function (type, evt) {
- + triggerEvent: function (type, evt, fromHandler) {
- + fromHandler = fromHandler || null;
- var listeners = this.listeners[type];
- // fast path
- @@ -754,13 +755,20 @@
- if(!evt.type) {
- evt.type = type;
- }
- -
- +
- + var shouldFire = null == fromHandler;
- // execute all callbacks registered for specified type
- // get a clone of the listeners array to
- // allow for splicing during callbacks
- var listeners = listeners.slice(), continueChain;
- for (var i=0, len=listeners.length; i<len; i++) {
- var callback = listeners[i];
- + if (!shouldFire || (null != fromHandler && fromHandler == callback.obj)) {
- + if (fromHandler == callback.obj)
- + shouldFire = true;
- + continue;
- + }
- +
- // bind the context to callback.obj
- continueChain = callback.func.apply(callback.obj, [evt]);
- @@ -776,6 +784,11 @@
- return continueChain;
- },
- + injectEventLower:function(type, evt, fromHandler) {
- + console.log("Events.injectEventLower(" + type + "," + evt + ", " + fromHandler + ")");
- + return this.triggerEvent(type, evt, fromHandler);
- + },
- +
- /**
- * Method: handleBrowserEvent
- * Basically just a wrapper to the triggerEvent() function, but takes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement