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