Changeset 2630767
- Timestamp:
- 11/16/2021 02:47:10 PM (4 years ago)
- Location:
- novo-map
- Files:
-
- 10 edited
- 1 copied
-
tags/1.1.2 (copied) (copied from novo-map/trunk)
-
tags/1.1.2/README.txt (modified) (4 diffs)
-
tags/1.1.2/admin/class-novo-map-admin.php (modified) (2 diffs)
-
tags/1.1.2/includes/class-novo-map-gmap.php (modified) (1 diff)
-
tags/1.1.2/novo-map.php (modified) (2 diffs)
-
tags/1.1.2/public/assets/js/infobox.js (modified) (18 diffs)
-
trunk/README.txt (modified) (4 diffs)
-
trunk/admin/class-novo-map-admin.php (modified) (2 diffs)
-
trunk/includes/class-novo-map-gmap.php (modified) (1 diff)
-
trunk/novo-map.php (modified) (2 diffs)
-
trunk/public/assets/js/infobox.js (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
novo-map/tags/1.1.2/README.txt
r2476895 r2630767 4 4 Tags: google maps, maps, map, map markers, google map, google maps plugin, google map widget, google map shortcode, map with posts, post map, wp google maps, wp google map, map plugin, google map 5 5 Requires at least: 4.0 6 Tested up to: 5. 6.17 Stable tag: 1.1. 16 Tested up to: 5.8.2 7 Stable tag: 1.1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 60 60 61 61 = Generate a Google Map API Key = 62 63 62 Generate a google map API key can be frustrating but it is required by google and it is the same for every google map plugin. But don't worry it's really not that complicated. Just click on the 'Get API key' button on [This Page](https://developers.google.com/maps/documentation/javascript/get-api-key) and follows the few steps requiered (you will need to add your billing credentials but you will have [28'000 map downloads/months for free](https://cloud.google.com/maps-platform/pricing/sheet/)). It really takes 1 minute! Then save the generated key in the novo-map menu. 64 63 … … 92 91 The default is: array( 'post', 'page'); 93 92 93 = Map displaying in the admin and the preview but not in the frontend = 94 There is a good chance there is a conflict with an optimization plugin like Autoptimize. You might find some useful infos to solve this kind of problem on [this thread of the support forum](https://wordpress.org/support/topic/novo-map-not-showing/) 95 94 96 == Screenshots == 95 97 … … 102 104 103 105 == Changelog == 106 107 = 1.1.2 = 108 * upgrade to gmap api 3.47 109 * add latest version of infobox.js script 104 110 105 111 = 1.1.1 = -
novo-map/tags/1.1.2/admin/class-novo-map-admin.php
r2476886 r2630767 101 101 */ 102 102 public function enqueue_post_admin_script() { 103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 3&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.47&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 104 104 } 105 105 … … 108 108 */ 109 109 public function enqueue_main_admin_script() { 110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 3&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.47&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 111 111 wp_enqueue_script( $this->plugin_name.'-infobox', plugins_url( $this->plugin_name) .'/public/assets/js/infobox.js', array( $this->plugin_name.'-gmap-api' ) ); 112 112 wp_enqueue_script( $this->plugin_name.'-markerclusterer', plugins_url( $this->plugin_name) .'/public/assets/js/markerclusterer.js', array( $this->plugin_name.'-gmap-api' ) ); -
novo-map/tags/1.1.2/includes/class-novo-map-gmap.php
r2476886 r2630767 704 704 public function enqueue_map($plugin_name) { 705 705 // enqueue necessary stuff 706 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 3&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true );706 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.47&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true ); 707 707 wp_enqueue_script( $plugin_name.'-infobox', plugins_url( $plugin_name) .'/public/assets/js/infobox.js', array( $plugin_name.'-gmap-api' ) ); 708 708 if($this->pin_clustering()) { -
novo-map/tags/1.1.2/novo-map.php
r2476895 r2630767 17 17 * Plugin URI: https://wordpress.org/plugins/novo-map/ 18 18 * Description: Display all your posts and pages on custom google maps 19 * Version: 1.1. 119 * Version: 1.1.2 20 20 * Author: novo-media 21 * Author URI: https://novo-media.ch 21 * Author URI: https://novo-media.ch/ 22 22 * License: GPL-2.0+ 23 23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 31 31 } 32 32 33 define( 'NOVO_MAP_VERSION', '1.1. 1' );33 define( 'NOVO_MAP_VERSION', '1.1.2' ); 34 34 35 35 /** -
novo-map/tags/1.1.2/public/assets/js/infobox.js
r1773144 r2630767 1 1 /** 2 2 * @name InfoBox 3 * @version 1.1.1 3 [March 19, 2014]3 * @version 1.1.19 [April 6, 2018] 4 4 * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google) 5 5 * @copyright Copyright 2010 Gary Little [gary at luxcentral.com] … … 50 50 * @property {string} closeBoxMargin The CSS margin style value for the close box. 51 51 * The default is "2px" (a 2-pixel margin on all sides). 52 * @property {string} closeBoxTitle The tool tip for the close box. The default is " Close ". 52 53 * @property {string} closeBoxURL The URL of the image representing the close box. 53 54 * Note: The default is the URL for Google's standard close box. … … 95 96 this.boxStyle_ = opt_opts.boxStyle || {}; 96 97 this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px"; 97 this.closeBoxURL_ = opt_opts.closeBoxURL || " http://www.google.com/intl/en_us/mapfiles/close.gif";98 this.closeBoxURL_ = opt_opts.closeBoxURL || "//www.google.com/intl/en_us/mapfiles/close.gif"; 98 99 if (opt_opts.closeBoxURL === "") { 99 100 this.closeBoxURL_ = ""; 100 101 } 102 this.closeBoxTitle_ = opt_opts.closeBoxTitle || " Close "; 101 103 this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1); 102 104 … … 117 119 this.closeListener_ = null; 118 120 this.moveListener_ = null; 119 this.mapListener_ = null;120 121 this.contextListener_ = null; 121 122 this.eventListeners_ = null; … … 214 215 // Note: mousemove not included (to resolve Issue 152) 215 216 events = ["mousedown", "mouseover", "mouseout", "mouseup", 216 "click", "dblclick", "touchstart", "touchend", "touchmove"];217 "click", "dblclick", "touchstart", "touchend", "touchmove"]; 217 218 218 219 for (i = 0; i < events.length; i++) { … … 220 221 this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler)); 221 222 } 222 223 223 224 // Workaround for Google bug that causes the cursor to change to a pointer 224 225 // when the mouse moves over a marker underneath InfoBox. … … 252 253 img += " src='" + this.closeBoxURL_ + "'"; 253 254 img += " align=right"; // Do this because Opera chokes on style='float: right;' 255 img += " title='" + this.closeBoxTitle_ + "'"; 254 256 img += " style='"; 255 257 img += " position: relative;"; // Required by MSIE … … 327 329 328 330 if (!map.getBounds().contains(this.position_)) { 329 // Marker not in visible area of map, so set center330 // of map to the marker position first.331 // Marker not in visible area of map, so set center 332 // of map to the marker position first. 331 333 map.setCenter(this.position_); 332 334 } 333 335 334 bounds = map.getBounds();335 336 var mapDiv = map.getDiv();337 var mapWidth = mapDiv.offsetWidth;338 var mapHeight = mapDiv.offsetHeight;339 336 var iwOffsetX = this.pixelOffset_.width; 340 337 var iwOffsetY = this.pixelOffset_.height; … … 343 340 var padX = this.infoBoxClearance_.width; 344 341 var padY = this.infoBoxClearance_.height; 345 var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_); 346 347 if (pixPosition.x < (-iwOffsetX + padX)) { 348 xOffset = pixPosition.x + iwOffsetX - padX; 349 } else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) { 350 xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth; 351 } 352 if (this.alignBottom_) { 353 if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) { 354 yOffset = pixPosition.y + iwOffsetY - padY - iwHeight; 355 } else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) { 356 yOffset = pixPosition.y + iwOffsetY + padY - mapHeight; 342 343 if (map.panToBounds.length == 2) { 344 // Using projection.fromLatLngToContainerPixel to compute the infowindow position 345 // does not work correctly anymore for JS Maps API v3.32 and above if there is a 346 // previous synchronous call that causes the map to animate (e.g. setCenter when 347 // the position is not within bounds). Hence, we are using panToBounds with 348 // padding instead, which works synchronously. 349 var padding = {left: 0, right: 0, top: 0, bottom: 0}; 350 padding.left = -iwOffsetX + padX; 351 padding.right = iwOffsetX + iwWidth + padX; 352 if (this.alignBottom_) { 353 padding.top = -iwOffsetY + padY + iwHeight; 354 padding.bottom = iwOffsetY + padY; 355 } else { 356 padding.top = -iwOffsetY + padY; 357 padding.bottom = iwOffsetY + iwHeight + padY; 357 358 } 359 map.panToBounds(new google.maps.LatLngBounds(this.position_), padding); 358 360 } else { 359 if (pixPosition.y < (-iwOffsetY + padY)) { 360 yOffset = pixPosition.y + iwOffsetY - padY; 361 } else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) { 362 yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight; 361 var mapDiv = map.getDiv(); 362 var mapWidth = mapDiv.offsetWidth; 363 var mapHeight = mapDiv.offsetHeight; 364 var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_); 365 366 if (pixPosition.x < (-iwOffsetX + padX)) { 367 xOffset = pixPosition.x + iwOffsetX - padX; 368 } else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) { 369 xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth; 363 370 } 364 } 365 366 if (!(xOffset === 0 && yOffset === 0)) { 367 368 // Move the map to the shifted center. 369 // 370 var c = map.getCenter(); 371 map.panBy(xOffset, yOffset); 371 if (this.alignBottom_) { 372 if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) { 373 yOffset = pixPosition.y + iwOffsetY - padY - iwHeight; 374 } else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) { 375 yOffset = pixPosition.y + iwOffsetY + padY - mapHeight; 376 } 377 } else { 378 if (pixPosition.y < (-iwOffsetY + padY)) { 379 yOffset = pixPosition.y + iwOffsetY - padY; 380 } else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) { 381 yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight; 382 } 383 } 384 385 if (!(xOffset === 0 && yOffset === 0)) { 386 387 // Move the map to the shifted center. 388 // 389 var c = map.getCenter(); 390 map.panBy(xOffset, yOffset); 391 } 372 392 } 373 393 } … … 404 424 // Fix for iOS disappearing InfoBox problem. 405 425 // See http://stackoverflow.com/questions/9229535/google-maps-markers-disappear-at-certain-zoom-level-only-on-iphone-ipad 406 this.div_.style.WebkitTransform = "translateZ(0)"; 426 // Required: use "matrix" technique to specify transforms in order to avoid this bug. 427 if ((typeof this.div_.style.WebkitTransform === "undefined") || (this.div_.style.WebkitTransform.indexOf("translateZ") === -1 && this.div_.style.WebkitTransform.indexOf("matrix") === -1)) { 428 429 this.div_.style.WebkitTransform = "translateZ(0)"; 430 } 407 431 408 432 // Fix up opacity style for benefit of MSIE: … … 486 510 487 511 this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px"; 488 512 489 513 if (this.alignBottom_) { 490 514 this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px"; … … 505 529 /** 506 530 * Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>, 507 * <tt>closeBoxMargin</tt>, <tt>closeBox URL</tt>, and <tt>enableEventPropagation</tt>508 * properties have no affect until the current InfoBox is <tt>close</tt>d and a new one509 * is <tt>open</tt>ed.531 * <tt>closeBoxMargin</tt>, <tt>closeBoxTitle</tt>, <tt>closeBoxURL</tt>, and 532 * <tt>enableEventPropagation</tt> properties have no affect until the current 533 * InfoBox is <tt>close</tt>d and a new one is <tt>open</tt>ed. 510 534 * @param {InfoBoxOptions} opt_opts 511 535 */ … … 556 580 557 581 this.closeBoxURL_ = opt_opts.closeBoxURL; 582 } 583 if (typeof opt_opts.closeBoxTitle !== "undefined") { 584 585 this.closeBoxTitle_ = opt_opts.closeBoxTitle; 558 586 } 559 587 if (typeof opt_opts.infoBoxClearance !== "undefined") { … … 732 760 733 761 /** 762 * Returns the width of the InfoBox in pixels. 763 * @returns {number} 764 */ 765 InfoBox.prototype.getWidth = function () { 766 var width = null; 767 768 if (this.div_) { 769 width = this.div_.offsetWidth; 770 } 771 772 return width; 773 }; 774 775 /** 776 * Returns the height of the InfoBox in pixels. 777 * @returns {number} 778 */ 779 InfoBox.prototype.getHeight = function () { 780 var height = null; 781 782 if (this.div_) { 783 height = this.div_.offsetHeight; 784 } 785 786 return height; 787 }; 788 789 /** 734 790 * Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.] 735 791 */ … … 767 823 if (anchor) { 768 824 769 this. position_ = anchor.getPosition();825 this.setPosition(anchor.getPosition()); // BUG FIX 2/17/2018: needed for v3.32 770 826 this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () { 771 827 me.setPosition(this.getPosition()); 772 828 }); 773 774 this.mapListener_ = google.maps.event.addListener(anchor, "map_changed", function() {775 me.setMap(this.map);776 });777 829 } 778 830 … … 781 833 if (this.div_) { 782 834 783 this.panBox_( );835 this.panBox_(this.disableAutoPan_); // BUG FIX 2/17/2018: add missing parameter 784 836 } 785 837 }; … … 799 851 800 852 if (this.eventListeners_) { 801 853 802 854 for (i = 0; i < this.eventListeners_.length; i++) { 803 855 … … 813 865 } 814 866 815 if (this.mapListener_) {816 817 google.maps.event.removeListener(this.mapListener_);818 this.mapListener_ = null;819 }820 821 867 if (this.contextListener_) { 822 868 -
novo-map/trunk/README.txt
r2476895 r2630767 4 4 Tags: google maps, maps, map, map markers, google map, google maps plugin, google map widget, google map shortcode, map with posts, post map, wp google maps, wp google map, map plugin, google map 5 5 Requires at least: 4.0 6 Tested up to: 5. 6.17 Stable tag: 1.1. 16 Tested up to: 5.8.2 7 Stable tag: 1.1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 60 60 61 61 = Generate a Google Map API Key = 62 63 62 Generate a google map API key can be frustrating but it is required by google and it is the same for every google map plugin. But don't worry it's really not that complicated. Just click on the 'Get API key' button on [This Page](https://developers.google.com/maps/documentation/javascript/get-api-key) and follows the few steps requiered (you will need to add your billing credentials but you will have [28'000 map downloads/months for free](https://cloud.google.com/maps-platform/pricing/sheet/)). It really takes 1 minute! Then save the generated key in the novo-map menu. 64 63 … … 92 91 The default is: array( 'post', 'page'); 93 92 93 = Map displaying in the admin and the preview but not in the frontend = 94 There is a good chance there is a conflict with an optimization plugin like Autoptimize. You might find some useful infos to solve this kind of problem on [this thread of the support forum](https://wordpress.org/support/topic/novo-map-not-showing/) 95 94 96 == Screenshots == 95 97 … … 102 104 103 105 == Changelog == 106 107 = 1.1.2 = 108 * upgrade to gmap api 3.47 109 * add latest version of infobox.js script 104 110 105 111 = 1.1.1 = -
novo-map/trunk/admin/class-novo-map-admin.php
r2476886 r2630767 101 101 */ 102 102 public function enqueue_post_admin_script() { 103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 3&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.47&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 104 104 } 105 105 … … 108 108 */ 109 109 public function enqueue_main_admin_script() { 110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 3&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.47&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 111 111 wp_enqueue_script( $this->plugin_name.'-infobox', plugins_url( $this->plugin_name) .'/public/assets/js/infobox.js', array( $this->plugin_name.'-gmap-api' ) ); 112 112 wp_enqueue_script( $this->plugin_name.'-markerclusterer', plugins_url( $this->plugin_name) .'/public/assets/js/markerclusterer.js', array( $this->plugin_name.'-gmap-api' ) ); -
novo-map/trunk/includes/class-novo-map-gmap.php
r2476886 r2630767 704 704 public function enqueue_map($plugin_name) { 705 705 // enqueue necessary stuff 706 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 3&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true );706 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.47&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true ); 707 707 wp_enqueue_script( $plugin_name.'-infobox', plugins_url( $plugin_name) .'/public/assets/js/infobox.js', array( $plugin_name.'-gmap-api' ) ); 708 708 if($this->pin_clustering()) { -
novo-map/trunk/novo-map.php
r2476895 r2630767 17 17 * Plugin URI: https://wordpress.org/plugins/novo-map/ 18 18 * Description: Display all your posts and pages on custom google maps 19 * Version: 1.1. 119 * Version: 1.1.2 20 20 * Author: novo-media 21 * Author URI: https://novo-media.ch 21 * Author URI: https://novo-media.ch/ 22 22 * License: GPL-2.0+ 23 23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 31 31 } 32 32 33 define( 'NOVO_MAP_VERSION', '1.1. 1' );33 define( 'NOVO_MAP_VERSION', '1.1.2' ); 34 34 35 35 /** -
novo-map/trunk/public/assets/js/infobox.js
r1773144 r2630767 1 1 /** 2 2 * @name InfoBox 3 * @version 1.1.1 3 [March 19, 2014]3 * @version 1.1.19 [April 6, 2018] 4 4 * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google) 5 5 * @copyright Copyright 2010 Gary Little [gary at luxcentral.com] … … 50 50 * @property {string} closeBoxMargin The CSS margin style value for the close box. 51 51 * The default is "2px" (a 2-pixel margin on all sides). 52 * @property {string} closeBoxTitle The tool tip for the close box. The default is " Close ". 52 53 * @property {string} closeBoxURL The URL of the image representing the close box. 53 54 * Note: The default is the URL for Google's standard close box. … … 95 96 this.boxStyle_ = opt_opts.boxStyle || {}; 96 97 this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px"; 97 this.closeBoxURL_ = opt_opts.closeBoxURL || " http://www.google.com/intl/en_us/mapfiles/close.gif";98 this.closeBoxURL_ = opt_opts.closeBoxURL || "//www.google.com/intl/en_us/mapfiles/close.gif"; 98 99 if (opt_opts.closeBoxURL === "") { 99 100 this.closeBoxURL_ = ""; 100 101 } 102 this.closeBoxTitle_ = opt_opts.closeBoxTitle || " Close "; 101 103 this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1); 102 104 … … 117 119 this.closeListener_ = null; 118 120 this.moveListener_ = null; 119 this.mapListener_ = null;120 121 this.contextListener_ = null; 121 122 this.eventListeners_ = null; … … 214 215 // Note: mousemove not included (to resolve Issue 152) 215 216 events = ["mousedown", "mouseover", "mouseout", "mouseup", 216 "click", "dblclick", "touchstart", "touchend", "touchmove"];217 "click", "dblclick", "touchstart", "touchend", "touchmove"]; 217 218 218 219 for (i = 0; i < events.length; i++) { … … 220 221 this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler)); 221 222 } 222 223 223 224 // Workaround for Google bug that causes the cursor to change to a pointer 224 225 // when the mouse moves over a marker underneath InfoBox. … … 252 253 img += " src='" + this.closeBoxURL_ + "'"; 253 254 img += " align=right"; // Do this because Opera chokes on style='float: right;' 255 img += " title='" + this.closeBoxTitle_ + "'"; 254 256 img += " style='"; 255 257 img += " position: relative;"; // Required by MSIE … … 327 329 328 330 if (!map.getBounds().contains(this.position_)) { 329 // Marker not in visible area of map, so set center330 // of map to the marker position first.331 // Marker not in visible area of map, so set center 332 // of map to the marker position first. 331 333 map.setCenter(this.position_); 332 334 } 333 335 334 bounds = map.getBounds();335 336 var mapDiv = map.getDiv();337 var mapWidth = mapDiv.offsetWidth;338 var mapHeight = mapDiv.offsetHeight;339 336 var iwOffsetX = this.pixelOffset_.width; 340 337 var iwOffsetY = this.pixelOffset_.height; … … 343 340 var padX = this.infoBoxClearance_.width; 344 341 var padY = this.infoBoxClearance_.height; 345 var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_); 346 347 if (pixPosition.x < (-iwOffsetX + padX)) { 348 xOffset = pixPosition.x + iwOffsetX - padX; 349 } else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) { 350 xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth; 351 } 352 if (this.alignBottom_) { 353 if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) { 354 yOffset = pixPosition.y + iwOffsetY - padY - iwHeight; 355 } else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) { 356 yOffset = pixPosition.y + iwOffsetY + padY - mapHeight; 342 343 if (map.panToBounds.length == 2) { 344 // Using projection.fromLatLngToContainerPixel to compute the infowindow position 345 // does not work correctly anymore for JS Maps API v3.32 and above if there is a 346 // previous synchronous call that causes the map to animate (e.g. setCenter when 347 // the position is not within bounds). Hence, we are using panToBounds with 348 // padding instead, which works synchronously. 349 var padding = {left: 0, right: 0, top: 0, bottom: 0}; 350 padding.left = -iwOffsetX + padX; 351 padding.right = iwOffsetX + iwWidth + padX; 352 if (this.alignBottom_) { 353 padding.top = -iwOffsetY + padY + iwHeight; 354 padding.bottom = iwOffsetY + padY; 355 } else { 356 padding.top = -iwOffsetY + padY; 357 padding.bottom = iwOffsetY + iwHeight + padY; 357 358 } 359 map.panToBounds(new google.maps.LatLngBounds(this.position_), padding); 358 360 } else { 359 if (pixPosition.y < (-iwOffsetY + padY)) { 360 yOffset = pixPosition.y + iwOffsetY - padY; 361 } else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) { 362 yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight; 361 var mapDiv = map.getDiv(); 362 var mapWidth = mapDiv.offsetWidth; 363 var mapHeight = mapDiv.offsetHeight; 364 var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_); 365 366 if (pixPosition.x < (-iwOffsetX + padX)) { 367 xOffset = pixPosition.x + iwOffsetX - padX; 368 } else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) { 369 xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth; 363 370 } 364 } 365 366 if (!(xOffset === 0 && yOffset === 0)) { 367 368 // Move the map to the shifted center. 369 // 370 var c = map.getCenter(); 371 map.panBy(xOffset, yOffset); 371 if (this.alignBottom_) { 372 if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) { 373 yOffset = pixPosition.y + iwOffsetY - padY - iwHeight; 374 } else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) { 375 yOffset = pixPosition.y + iwOffsetY + padY - mapHeight; 376 } 377 } else { 378 if (pixPosition.y < (-iwOffsetY + padY)) { 379 yOffset = pixPosition.y + iwOffsetY - padY; 380 } else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) { 381 yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight; 382 } 383 } 384 385 if (!(xOffset === 0 && yOffset === 0)) { 386 387 // Move the map to the shifted center. 388 // 389 var c = map.getCenter(); 390 map.panBy(xOffset, yOffset); 391 } 372 392 } 373 393 } … … 404 424 // Fix for iOS disappearing InfoBox problem. 405 425 // See http://stackoverflow.com/questions/9229535/google-maps-markers-disappear-at-certain-zoom-level-only-on-iphone-ipad 406 this.div_.style.WebkitTransform = "translateZ(0)"; 426 // Required: use "matrix" technique to specify transforms in order to avoid this bug. 427 if ((typeof this.div_.style.WebkitTransform === "undefined") || (this.div_.style.WebkitTransform.indexOf("translateZ") === -1 && this.div_.style.WebkitTransform.indexOf("matrix") === -1)) { 428 429 this.div_.style.WebkitTransform = "translateZ(0)"; 430 } 407 431 408 432 // Fix up opacity style for benefit of MSIE: … … 486 510 487 511 this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px"; 488 512 489 513 if (this.alignBottom_) { 490 514 this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px"; … … 505 529 /** 506 530 * Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>, 507 * <tt>closeBoxMargin</tt>, <tt>closeBox URL</tt>, and <tt>enableEventPropagation</tt>508 * properties have no affect until the current InfoBox is <tt>close</tt>d and a new one509 * is <tt>open</tt>ed.531 * <tt>closeBoxMargin</tt>, <tt>closeBoxTitle</tt>, <tt>closeBoxURL</tt>, and 532 * <tt>enableEventPropagation</tt> properties have no affect until the current 533 * InfoBox is <tt>close</tt>d and a new one is <tt>open</tt>ed. 510 534 * @param {InfoBoxOptions} opt_opts 511 535 */ … … 556 580 557 581 this.closeBoxURL_ = opt_opts.closeBoxURL; 582 } 583 if (typeof opt_opts.closeBoxTitle !== "undefined") { 584 585 this.closeBoxTitle_ = opt_opts.closeBoxTitle; 558 586 } 559 587 if (typeof opt_opts.infoBoxClearance !== "undefined") { … … 732 760 733 761 /** 762 * Returns the width of the InfoBox in pixels. 763 * @returns {number} 764 */ 765 InfoBox.prototype.getWidth = function () { 766 var width = null; 767 768 if (this.div_) { 769 width = this.div_.offsetWidth; 770 } 771 772 return width; 773 }; 774 775 /** 776 * Returns the height of the InfoBox in pixels. 777 * @returns {number} 778 */ 779 InfoBox.prototype.getHeight = function () { 780 var height = null; 781 782 if (this.div_) { 783 height = this.div_.offsetHeight; 784 } 785 786 return height; 787 }; 788 789 /** 734 790 * Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.] 735 791 */ … … 767 823 if (anchor) { 768 824 769 this. position_ = anchor.getPosition();825 this.setPosition(anchor.getPosition()); // BUG FIX 2/17/2018: needed for v3.32 770 826 this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () { 771 827 me.setPosition(this.getPosition()); 772 828 }); 773 774 this.mapListener_ = google.maps.event.addListener(anchor, "map_changed", function() {775 me.setMap(this.map);776 });777 829 } 778 830 … … 781 833 if (this.div_) { 782 834 783 this.panBox_( );835 this.panBox_(this.disableAutoPan_); // BUG FIX 2/17/2018: add missing parameter 784 836 } 785 837 }; … … 799 851 800 852 if (this.eventListeners_) { 801 853 802 854 for (i = 0; i < this.eventListeners_.length; i++) { 803 855 … … 813 865 } 814 866 815 if (this.mapListener_) {816 817 google.maps.event.removeListener(this.mapListener_);818 this.mapListener_ = null;819 }820 821 867 if (this.contextListener_) { 822 868
Note: See TracChangeset
for help on using the changeset viewer.