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