| | 76 | * Method: activate |
|---|
| | 77 | * Activate the handler. |
|---|
| | 78 | * |
|---|
| | 79 | * Return: |
|---|
| | 80 | * {Boolean} The handler was successfully activated. |
|---|
| | 81 | */ |
|---|
| | 82 | activate: function() { |
|---|
| | 83 | var activated = false; |
|---|
| | 84 | if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) { |
|---|
| | 85 | this.dragging = false; |
|---|
| | 86 | activated = true; |
|---|
| | 87 | } |
|---|
| | 88 | return activated; |
|---|
| | 89 | }, |
|---|
| | 90 | |
|---|
| | 91 | /** |
|---|
| | 92 | * Method: deactivate |
|---|
| | 93 | * Deactivate the handler. |
|---|
| | 94 | * |
|---|
| | 95 | * Return: |
|---|
| | 96 | * {Boolean} The handler was successfully deactivated. |
|---|
| | 97 | */ |
|---|
| | 98 | deactivate: function() { |
|---|
| | 99 | var deactivated = false; |
|---|
| | 100 | if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) { |
|---|
| | 101 | this.dragging = false; |
|---|
| | 102 | deactivated = true; |
|---|
| | 103 | } |
|---|
| | 104 | return deactivated; |
|---|
| | 105 | }, |
|---|
| | 106 | |
|---|
| | 107 | /** |
|---|
| | 108 | * The four methods below (down, move, up, and out) are used by subclasses |
|---|
| | 109 | * to do their own processing related to these mouse events, or to |
|---|
| | 110 | * modify the handling of these events before the drag handler gets to |
|---|
| | 111 | * them. In subclasses, these methods should typically return true. |
|---|
| | 112 | */ |
|---|
| | 113 | |
|---|
| | 114 | /** |
|---|
| | 115 | * Method: down |
|---|
| | 116 | * This method is called prior to handling the mouse down event. Subclasses |
|---|
| | 117 | * can do their own processing here and return true to continue with the |
|---|
| | 118 | * normal drag handling, or they can return false to do their own |
|---|
| | 119 | * handling. Note that this method should only be used/overridden by |
|---|
| | 120 | * subclasses; controls that wrap handlers should deal with callbacks |
|---|
| | 121 | * instead. |
|---|
| | 122 | * |
|---|
| | 123 | * Parameters: |
|---|
| | 124 | * evt - {Event} The mouse down event |
|---|
| | 125 | * |
|---|
| | 126 | * Return: |
|---|
| | 127 | * {Boolean} Let the handler deal with the mouse down event. This should |
|---|
| | 128 | * typically return true unless a subclass wants to modify event |
|---|
| | 129 | * handling. |
|---|
| | 130 | */ |
|---|
| | 131 | down: function(evt) { |
|---|
| | 132 | return true; |
|---|
| | 133 | }, |
|---|
| | 134 | |
|---|
| | 135 | /** |
|---|
| | 136 | * Method: move |
|---|
| | 137 | * This method is called prior to handling the mouse move event. Subclasses |
|---|
| | 138 | * can do their own processing here and return true to continue with the |
|---|
| | 139 | * normal drag handling, or they can return false to do their own |
|---|
| | 140 | * handling. Note that this method should only be used/overridden by |
|---|
| | 141 | * subclasses; controls that wrap handlers should deal with callbacks |
|---|
| | 142 | * instead. |
|---|
| | 143 | * |
|---|
| | 144 | * Parameters: |
|---|
| | 145 | * evt - {Event} The mouse move event |
|---|
| | 146 | * |
|---|
| | 147 | * Return: |
|---|
| | 148 | * {Boolean} Let the handler deal with the mouse move event. This should |
|---|
| | 149 | * typically return true unless a subclass wants to modify event |
|---|
| | 150 | * handling. |
|---|
| | 151 | */ |
|---|
| | 152 | move: function(evt) { |
|---|
| | 153 | return true; |
|---|
| | 154 | }, |
|---|
| | 155 | |
|---|
| | 156 | /** |
|---|
| | 157 | * Method: up |
|---|
| | 158 | * This method is called prior to handling the mouse up event. Subclasses |
|---|
| | 159 | * can do their own processing here and return true to continue with the |
|---|
| | 160 | * normal drag handling, or they can return false to do their own |
|---|
| | 161 | * handling. Note that this method should only be used/overridden by |
|---|
| | 162 | * subclasses; controls that wrap handlers should deal with callbacks |
|---|
| | 163 | * instead. |
|---|
| | 164 | * |
|---|
| | 165 | * Parameters: |
|---|
| | 166 | * evt - {Event} The mouse up event |
|---|
| | 167 | * |
|---|
| | 168 | * Return: |
|---|
| | 169 | * {Boolean} Let the handler deal with the mouse up event. This should |
|---|
| | 170 | * typically return true unless a subclass wants to modify event |
|---|
| | 171 | * handling. |
|---|
| | 172 | */ |
|---|
| | 173 | up: function(evt) { |
|---|
| | 174 | return true; |
|---|
| | 175 | }, |
|---|
| | 176 | |
|---|
| | 177 | /** |
|---|
| | 178 | * Method: out |
|---|
| | 179 | * This method is called prior to handling the mouse out event. Subclasses |
|---|
| | 180 | * can do their own processing here and return true to continue with the |
|---|
| | 181 | * normal drag handling, or they can return false to do their own |
|---|
| | 182 | * handling. Note that this method should only be used/overridden by |
|---|
| | 183 | * subclasses; controls that wrap handlers should deal with callbacks |
|---|
| | 184 | * instead. |
|---|
| | 185 | * |
|---|
| | 186 | * Parameters: |
|---|
| | 187 | * evt - {Event} The mouse out event |
|---|
| | 188 | * |
|---|
| | 189 | * Return: |
|---|
| | 190 | * {Boolean} Let the handler deal with the mouse out event. This should |
|---|
| | 191 | * typically return true unless a subclass wants to modify event |
|---|
| | 192 | * handling. |
|---|
| | 193 | */ |
|---|
| | 194 | out: function(evt) { |
|---|
| | 195 | return true; |
|---|
| | 196 | }, |
|---|
| | 197 | |
|---|
| | 198 | /** |
|---|
| 93 | | this.started = true; |
|---|
| 94 | | this.dragging = false; |
|---|
| 95 | | this.start = evt.xy.clone(); |
|---|
| 96 | | // TBD replace with CSS classes |
|---|
| 97 | | this.map.div.style.cursor = "move"; |
|---|
| 98 | | this.callback("down", [evt.xy]); |
|---|
| 99 | | OpenLayers.Event.stop(evt); |
|---|
| 100 | | return false; |
|---|
| | 217 | if(this.down(evt)) { |
|---|
| | 218 | this.started = true; |
|---|
| | 219 | this.dragging = false; |
|---|
| | 220 | this.start = evt.xy.clone(); |
|---|
| | 221 | // TBD replace with CSS classes |
|---|
| | 222 | this.map.div.style.cursor = "move"; |
|---|
| | 223 | this.callback("down", [evt.xy]); |
|---|
| | 224 | OpenLayers.Event.stop(evt); |
|---|
| | 225 | propagate = false; |
|---|
| | 226 | } |
|---|
| 139 | | this.started = false; |
|---|
| 140 | | // TBD replace with CSS classes |
|---|
| 141 | | this.map.div.style.cursor = ""; |
|---|
| 142 | | this.callback("up", [evt.xy]); |
|---|
| 143 | | this.callback("done", [evt.xy]); |
|---|
| 144 | | document.onselectstart = this.oldOnselectstart; |
|---|
| | 267 | if(this.up(evt)) { |
|---|
| | 268 | this.started = false; |
|---|
| | 269 | // TBD replace with CSS classes |
|---|
| | 270 | this.map.div.style.cursor = ""; |
|---|
| | 271 | this.callback("up", [evt.xy]); |
|---|
| | 272 | this.callback("done", [evt.xy]); |
|---|
| | 273 | document.onselectstart = this.oldOnselectstart; |
|---|
| | 274 | } |
|---|
| 161 | | this.started = false; |
|---|
| 162 | | this.dragging = false; |
|---|
| 163 | | // TBD replace with CSS classes |
|---|
| 164 | | this.map.div.style.cursor = ""; |
|---|
| 165 | | this.callback("out", []); |
|---|
| 166 | | if(document.onselectstart) { |
|---|
| 167 | | document.onselectstart = this.oldOnselectstart; |
|---|
| | 291 | if(this.out(evt)) { |
|---|
| | 292 | this.started = false; |
|---|
| | 293 | this.dragging = false; |
|---|
| | 294 | // TBD replace with CSS classes |
|---|
| | 295 | this.map.div.style.cursor = ""; |
|---|
| | 296 | this.callback("out", []); |
|---|
| | 297 | if(document.onselectstart) { |
|---|
| | 298 | document.onselectstart = this.oldOnselectstart; |
|---|
| | 299 | } |
|---|
| | 300 | this.callback("done", [evt.xy]) |
|---|