Commit bf3525efd66afa1b6cd62dd975cf462bbc6db41a
1 parent
c437dc31
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
31 additions
and
27 deletions
Show diff stats
pacotes/google/keydragzoom.js.php
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | * @fileoverview This library adds a drag zoom capability to a Google map. | 6 | * @fileoverview This library adds a drag zoom capability to a Google map. |
7 | * When drag zoom is enabled, holding down a user-defined hot key <code>(shift | ctrl | alt)</code> | 7 | * When drag zoom is enabled, holding down a user-defined hot key <code>(shift | ctrl | alt)</code> |
8 | * while dragging a box around an area of interest will zoom the map | 8 | * while dragging a box around an area of interest will zoom the map |
9 | - * to that area when the hot key is released. | 9 | + * to that area when the hot key is released. |
10 | * Only one line of code is needed: <code>google.maps.Map.enableKeyDragZoom();</code> | 10 | * Only one line of code is needed: <code>google.maps.Map.enableKeyDragZoom();</code> |
11 | * <p> | 11 | * <p> |
12 | * Note that if the map's container has a border around it, the border widths must be specified | 12 | * Note that if the map's container has a border around it, the border widths must be specified |
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | * in an MSIE environment. Not called for other browsers | 35 | * in an MSIE environment. Not called for other browsers |
36 | * because getComputedStyle() returns pixel widths automatically. | 36 | * because getComputedStyle() returns pixel widths automatically. |
37 | * @param {String} widthValue | 37 | * @param {String} widthValue |
38 | - */ | 38 | + */ |
39 | var toPixels = function (widthValue) { | 39 | var toPixels = function (widthValue) { |
40 | var px; | 40 | var px; |
41 | switch (widthValue) { | 41 | switch (widthValue) { |
@@ -172,7 +172,7 @@ | @@ -172,7 +172,7 @@ | ||
172 | div.style.filter = "alpha(opacity=" + (div.style.opacity * 100) + ")"; | 172 | div.style.filter = "alpha(opacity=" + (div.style.opacity * 100) + ")"; |
173 | } | 173 | } |
174 | }; | 174 | }; |
175 | - | 175 | + |
176 | /** | 176 | /** |
177 | * @name KeyDragZoomOptions | 177 | * @name KeyDragZoomOptions |
178 | * @class This class represents the optional parameter passed into <code>google.maps.Map.enableDragBoxZoom</code>. | 178 | * @class This class represents the optional parameter passed into <code>google.maps.Map.enableDragBoxZoom</code>. |
@@ -206,7 +206,7 @@ | @@ -206,7 +206,7 @@ | ||
206 | this.prjov_ = ov; | 206 | this.prjov_ = ov; |
207 | } | 207 | } |
208 | /** | 208 | /** |
209 | - * Init the tool. | 209 | + * Init the tool. |
210 | * @param {google.maps.Map} map | 210 | * @param {google.maps.Map} map |
211 | * @param {KeyDragZoomOptions} opt_zoomOpts | 211 | * @param {KeyDragZoomOptions} opt_zoomOpts |
212 | */ | 212 | */ |
@@ -226,7 +226,7 @@ | @@ -226,7 +226,7 @@ | ||
226 | opacity: 0.0, | 226 | opacity: 0.0, |
227 | cursor: 'crosshair' | 227 | cursor: 'crosshair' |
228 | }); | 228 | }); |
229 | - // allow overwrite | 229 | + // allow overwrite |
230 | setVals(this.paneDiv_.style, opt_zoomOpts.paneStyle); | 230 | setVals(this.paneDiv_.style, opt_zoomOpts.paneStyle); |
231 | // stuff that cannot be overwritten | 231 | // stuff that cannot be overwritten |
232 | setVals(this.paneDiv_.style, { | 232 | setVals(this.paneDiv_.style, { |
@@ -263,7 +263,7 @@ | @@ -263,7 +263,7 @@ | ||
263 | }); | 263 | }); |
264 | this.keyUpListener_ = google.maps.event.addDomListener(document, 'keyup', function (e) { | 264 | this.keyUpListener_ = google.maps.event.addDomListener(document, 'keyup', function (e) { |
265 | me.onKeyUp_(e); | 265 | me.onKeyUp_(e); |
266 | - }); | 266 | + }); |
267 | this.mouseDownListener_ = google.maps.event.addDomListener(this.paneDiv_, 'mousedown', function (e) { | 267 | this.mouseDownListener_ = google.maps.event.addDomListener(this.paneDiv_, 'mousedown', function (e) { |
268 | me.onMouseDown_(e); | 268 | me.onMouseDown_(e); |
269 | }); | 269 | }); |
@@ -274,9 +274,9 @@ | @@ -274,9 +274,9 @@ | ||
274 | me.onMouseMove_(e); | 274 | me.onMouseMove_(e); |
275 | }); | 275 | }); |
276 | this.mouseUpListener_ = google.maps.event.addDomListener(document, 'mouseup', function (e) { | 276 | this.mouseUpListener_ = google.maps.event.addDomListener(document, 'mouseup', function (e) { |
277 | - me.onMouseUp_(e); | 277 | + me.onMouseUp_(e); |
278 | }); | 278 | }); |
279 | - | 279 | + |
280 | this.hotKeyDown_ = false; | 280 | this.hotKeyDown_ = false; |
281 | this.dragging_ = false; | 281 | this.dragging_ = false; |
282 | this.startPt_ = null; | 282 | this.startPt_ = null; |
@@ -287,7 +287,7 @@ | @@ -287,7 +287,7 @@ | ||
287 | this.mapPosn_ = getElementPosition(this.map_.getDiv()); | 287 | this.mapPosn_ = getElementPosition(this.map_.getDiv()); |
288 | this.mouseDown_ = false; | 288 | this.mouseDown_ = false; |
289 | }; | 289 | }; |
290 | - | 290 | + |
291 | /** | 291 | /** |
292 | * Returns true if the hot key is being pressed when an event occurs. | 292 | * Returns true if the hot key is being pressed when an event occurs. |
293 | * @param {Event} e | 293 | * @param {Event} e |
@@ -324,9 +324,9 @@ | @@ -324,9 +324,9 @@ | ||
324 | } | 324 | } |
325 | return isHot; | 325 | return isHot; |
326 | }; | 326 | }; |
327 | - | 327 | + |
328 | /** | 328 | /** |
329 | - * Checks if the mouse is on top of the map. The position is captured | 329 | + * Checks if the mouse is on top of the map. The position is captured |
330 | * in onMouseMove_. | 330 | * in onMouseMove_. |
331 | * @return true if mouse is on top of the map div. | 331 | * @return true if mouse is on top of the map div. |
332 | */ | 332 | */ |
@@ -342,7 +342,7 @@ | @@ -342,7 +342,7 @@ | ||
342 | return false; | 342 | return false; |
343 | } | 343 | } |
344 | }; | 344 | }; |
345 | - | 345 | + |
346 | /** | 346 | /** |
347 | * Show or hide the overlay pane, depending on whether the mouse is over the map. | 347 | * Show or hide the overlay pane, depending on whether the mouse is over the map. |
348 | */ | 348 | */ |
@@ -367,10 +367,12 @@ | @@ -367,10 +367,12 @@ | ||
367 | DragZoom.prototype.onKeyDown_ = function (e) { | 367 | DragZoom.prototype.onKeyDown_ = function (e) { |
368 | var me = this; | 368 | var me = this; |
369 | if (this.map_ && !this.hotKeyDown_ && this.isHotKeyDown_(e)) { | 369 | if (this.map_ && !this.hotKeyDown_ && this.isHotKeyDown_(e)) { |
370 | + //desativa o clique permanente | ||
371 | + i3GEO.eventos.cliquePerm.desativa(); | ||
370 | me.hotKeyDown_ = true; | 372 | me.hotKeyDown_ = true; |
371 | me.setPaneVisibility_(); | 373 | me.setPaneVisibility_(); |
372 | /** | 374 | /** |
373 | - * This event is fired when the hot key is pressed. | 375 | + * This event is fired when the hot key is pressed. |
374 | * @name DragZoom#activate | 376 | * @name DragZoom#activate |
375 | * @event | 377 | * @event |
376 | */ | 378 | */ |
@@ -406,7 +408,7 @@ | @@ -406,7 +408,7 @@ | ||
406 | var prj = this.prjov_.getProjection(); | 408 | var prj = this.prjov_.getProjection(); |
407 | var latlng = prj.fromDivPixelToLatLng(this.startPt_); | 409 | var latlng = prj.fromDivPixelToLatLng(this.startPt_); |
408 | /** | 410 | /** |
409 | - * This event is fired when the drag operation begins. | 411 | + * This event is fired when the drag operation begins. |
410 | * @name DragZoom#dragstart | 412 | * @name DragZoom#dragstart |
411 | * @param {GLatLng} startLatLng | 413 | * @param {GLatLng} startLatLng |
412 | * @event | 414 | * @event |
@@ -441,14 +443,14 @@ | @@ -441,14 +443,14 @@ | ||
441 | /** | 443 | /** |
442 | * This event is repeatedly fired while the user drags the box. The southwest and northeast | 444 | * This event is repeatedly fired while the user drags the box. The southwest and northeast |
443 | * point are passed as parameters of type <code>google.maps.Point</code> (for performance reasons), | 445 | * point are passed as parameters of type <code>google.maps.Point</code> (for performance reasons), |
444 | - * relative to the map container. Note: the event listener is responsible | 446 | + * relative to the map container. Note: the event listener is responsible |
445 | * for converting Pixel to LatLng, if necessary. | 447 | * for converting Pixel to LatLng, if necessary. |
446 | - * @name DragZoom#drag | 448 | + * @name DragZoom#drag |
447 | * @param {google.maps.Point} southwestPixel | 449 | * @param {google.maps.Point} southwestPixel |
448 | * @param {google.maps.Point} northeastPixel | 450 | * @param {google.maps.Point} northeastPixel |
449 | * @event | 451 | * @event |
450 | */ | 452 | */ |
451 | - google.maps.event.trigger(this, 'drag', new google.maps.Point(left, top + height), new google.maps.Point(left + width, top)); | 453 | + google.maps.event.trigger(this, 'drag', new google.maps.Point(left, top + height), new google.maps.Point(left + width, top)); |
452 | } else if (!this.mouseDown_) { | 454 | } else if (!this.mouseDown_) { |
453 | this.setPaneVisibility_(); | 455 | this.setPaneVisibility_(); |
454 | } | 456 | } |
@@ -459,13 +461,15 @@ | @@ -459,13 +461,15 @@ | ||
459 | */ | 461 | */ |
460 | DragZoom.prototype.onMouseUp_ = function (e) { | 462 | DragZoom.prototype.onMouseUp_ = function (e) { |
461 | this.mouseDown_ = false; | 463 | this.mouseDown_ = false; |
464 | + //desativa o clique permanente | ||
465 | + i3GEO.eventos.cliquePerm.ativa(); | ||
462 | if (this.dragging_) { | 466 | if (this.dragging_) { |
463 | var left = Math.min(this.startPt_.x, this.endPt_.x); | 467 | var left = Math.min(this.startPt_.x, this.endPt_.x); |
464 | var top = Math.min(this.startPt_.y, this.endPt_.y); | 468 | var top = Math.min(this.startPt_.y, this.endPt_.y); |
465 | var width = Math.abs(this.startPt_.x - this.endPt_.x); | 469 | var width = Math.abs(this.startPt_.x - this.endPt_.x); |
466 | var height = Math.abs(this.startPt_.y - this.endPt_.y); | 470 | var height = Math.abs(this.startPt_.y - this.endPt_.y); |
467 | var prj = this.prjov_.getProjection(); | 471 | var prj = this.prjov_.getProjection(); |
468 | - // 2009-05-29: since V3 does not have fromContainerPixel, | 472 | + // 2009-05-29: since V3 does not have fromContainerPixel, |
469 | //needs find offset here | 473 | //needs find offset here |
470 | var containerPos = getElementPosition(this.map_.getDiv()); | 474 | var containerPos = getElementPosition(this.map_.getDiv()); |
471 | var mapPanePos = getElementPosition(this.prjov_.getPanes().mapPane); | 475 | var mapPanePos = getElementPosition(this.prjov_.getPanes().mapPane); |
@@ -478,7 +482,7 @@ | @@ -478,7 +482,7 @@ | ||
478 | this.dragging_ = false; | 482 | this.dragging_ = false; |
479 | this.boxDiv_.style.display = 'none'; | 483 | this.boxDiv_.style.display = 'none'; |
480 | /** | 484 | /** |
481 | - * This event is fired when the drag operation ends. | 485 | + * This event is fired when the drag operation ends. |
482 | * Note that the event is not fired if the hot key is released before the drag operation ends. | 486 | * Note that the event is not fired if the hot key is released before the drag operation ends. |
483 | * @name DragZoom#dragend | 487 | * @name DragZoom#dragend |
484 | * @param {GLatLngBounds} newBounds | 488 | * @param {GLatLngBounds} newBounds |
@@ -487,7 +491,7 @@ | @@ -487,7 +491,7 @@ | ||
487 | google.maps.event.trigger(this, 'dragend', bnds); | 491 | google.maps.event.trigger(this, 'dragend', bnds); |
488 | } | 492 | } |
489 | }; | 493 | }; |
490 | - | 494 | + |
491 | /** | 495 | /** |
492 | * Handle key up. | 496 | * Handle key up. |
493 | * @param {Event} e | 497 | * @param {Event} e |
@@ -500,16 +504,16 @@ | @@ -500,16 +504,16 @@ | ||
500 | this.paneDiv_.style.display = "none"; | 504 | this.paneDiv_.style.display = "none"; |
501 | /** | 505 | /** |
502 | * This event is fired while the user release the key | 506 | * This event is fired while the user release the key |
503 | - * @name DragZoom#deactivate | 507 | + * @name DragZoom#deactivate |
504 | * @event | 508 | * @event |
505 | */ | 509 | */ |
506 | - google.maps.event.trigger(this, 'deactivate'); | 510 | + google.maps.event.trigger(this, 'deactivate'); |
507 | } | 511 | } |
508 | }; | 512 | }; |
509 | - | ||
510 | - | ||
511 | 513 | ||
512 | - | 514 | + |
515 | + | ||
516 | + | ||
513 | /** | 517 | /** |
514 | * @name google.maps.Map | 518 | * @name google.maps.Map |
515 | * @class These are new methods added to the Google Maps API's | 519 | * @class These are new methods added to the Google Maps API's |
@@ -518,10 +522,10 @@ | @@ -518,10 +522,10 @@ | ||
518 | */ | 522 | */ |
519 | /** | 523 | /** |
520 | * Enable drag zoom. The user can zoom to an area of interest by holding down the hot key | 524 | * Enable drag zoom. The user can zoom to an area of interest by holding down the hot key |
521 | - * <code>(shift | ctrl | alt )</code> while dragging a box around the area. | 525 | + * <code>(shift | ctrl | alt )</code> while dragging a box around the area. |
522 | * @param {KeyDragZoomOptions} opt_zoomOpts | 526 | * @param {KeyDragZoomOptions} opt_zoomOpts |
523 | */ | 527 | */ |
524 | - | 528 | + |
525 | google.maps.Map.prototype.enableKeyDragZoom = function (opt_zoomOpts) { | 529 | google.maps.Map.prototype.enableKeyDragZoom = function (opt_zoomOpts) { |
526 | this.dragZoom_ = new DragZoom(this, opt_zoomOpts); | 530 | this.dragZoom_ = new DragZoom(this, opt_zoomOpts); |
527 | }; | 531 | }; |