Plugin Directory

Changeset 2630767


Ignore:
Timestamp:
11/16/2021 02:47:10 PM (4 years ago)
Author:
bluisier
Message:

Novo-map V 1.1.2: update gmap js api and infobox script

Location:
novo-map
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • novo-map/tags/1.1.2/README.txt

    r2476895 r2630767  
    44Tags: 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
    55Requires at least: 4.0
    6 Tested up to: 5.6.1
    7 Stable tag: 1.1.1
     6Tested up to: 5.8.2
     7Stable tag: 1.1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6060
    6161= Generate a Google Map API Key =
    62 
    6362Generate 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.
    6463
     
    9291The default is: array( 'post', 'page');
    9392
     93= Map displaying in the admin and the preview but not in the frontend =
     94There 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
    9496== Screenshots ==
    9597
     
    102104
    103105== Changelog ==
     106
     107= 1.1.2 =
     108* upgrade to gmap api 3.47
     109* add latest version of infobox.js script
    104110
    105111= 1.1.1 =
  • novo-map/tags/1.1.2/admin/class-novo-map-admin.php

    r2476886 r2630767  
    101101     */
    102102    public function enqueue_post_admin_script() {
    103         wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&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 );
    104104    }
    105105
     
    108108     */
    109109    public function enqueue_main_admin_script() {
    110         wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&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 );
    111111        wp_enqueue_script( $this->plugin_name.'-infobox', plugins_url( $this->plugin_name) .'/public/assets/js/infobox.js', array( $this->plugin_name.'-gmap-api' ) );
    112112        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  
    704704    public function enqueue_map($plugin_name) {
    705705        // enqueue necessary stuff
    706         wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&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 );
    707707        wp_enqueue_script( $plugin_name.'-infobox', plugins_url( $plugin_name) .'/public/assets/js/infobox.js', array( $plugin_name.'-gmap-api' ) );
    708708        if($this->pin_clustering()) {
  • novo-map/tags/1.1.2/novo-map.php

    r2476895 r2630767  
    1717 * Plugin URI:        https://wordpress.org/plugins/novo-map/
    1818 * Description:       Display all your posts and pages on custom google maps
    19  * Version:           1.1.1
     19 * Version:           1.1.2
    2020 * Author:            novo-media
    21  * Author URI:        https://novo-media.ch
     21 * Author URI:        https://novo-media.ch/
    2222 * License:           GPL-2.0+
    2323 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     
    3131}
    3232
    33 define( 'NOVO_MAP_VERSION', '1.1.1' );
     33define( 'NOVO_MAP_VERSION', '1.1.2' );
    3434
    3535/**
  • novo-map/tags/1.1.2/public/assets/js/infobox.js

    r1773144 r2630767  
    11/**
    22 * @name InfoBox
    3  * @version 1.1.13 [March 19, 2014]
     3 * @version 1.1.19 [April 6, 2018]
    44 * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
    55 * @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
     
    5050 * @property {string} closeBoxMargin The CSS margin style value for the close box.
    5151 *  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 ".
    5253 * @property {string} closeBoxURL The URL of the image representing the close box.
    5354 *  Note: The default is the URL for Google's standard close box.
     
    9596  this.boxStyle_ = opt_opts.boxStyle || {};
    9697  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";
    9899  if (opt_opts.closeBoxURL === "") {
    99100    this.closeBoxURL_ = "";
    100101  }
     102  this.closeBoxTitle_ = opt_opts.closeBoxTitle || " Close ";
    101103  this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
    102104
     
    117119  this.closeListener_ = null;
    118120  this.moveListener_ = null;
    119   this.mapListener_ = null;
    120121  this.contextListener_ = null;
    121122  this.eventListeners_ = null;
     
    214215      // Note: mousemove not included (to resolve Issue 152)
    215216      events = ["mousedown", "mouseover", "mouseout", "mouseup",
    216       "click", "dblclick", "touchstart", "touchend", "touchmove"];
     217        "click", "dblclick", "touchstart", "touchend", "touchmove"];
    217218
    218219      for (i = 0; i < events.length; i++) {
     
    220221        this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
    221222      }
    222      
     223
    223224      // Workaround for Google bug that causes the cursor to change to a pointer
    224225      // when the mouse moves over a marker underneath InfoBox.
     
    252253    img += " src='" + this.closeBoxURL_ + "'";
    253254    img += " align=right"; // Do this because Opera chokes on style='float: right;'
     255    img += " title='" + this.closeBoxTitle_ + "'";
    254256    img += " style='";
    255257    img += " position: relative;"; // Required by MSIE
     
    327329
    328330      if (!map.getBounds().contains(this.position_)) {
    329       // Marker not in visible area of map, so set center
    330       // 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.
    331333        map.setCenter(this.position_);
    332334      }
    333335
    334       bounds = map.getBounds();
    335 
    336       var mapDiv = map.getDiv();
    337       var mapWidth = mapDiv.offsetWidth;
    338       var mapHeight = mapDiv.offsetHeight;
    339336      var iwOffsetX = this.pixelOffset_.width;
    340337      var iwOffsetY = this.pixelOffset_.height;
     
    343340      var padX = this.infoBoxClearance_.width;
    344341      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;
    357358        }
     359        map.panToBounds(new google.maps.LatLngBounds(this.position_), padding);
    358360      } 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;
    363370        }
    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        }
    372392      }
    373393    }
     
    404424    // Fix for iOS disappearing InfoBox problem.
    405425    // 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    }
    407431
    408432    // Fix up opacity style for benefit of MSIE:
     
    486510
    487511  this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
    488  
     512
    489513  if (this.alignBottom_) {
    490514    this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
     
    505529/**
    506530 * Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
    507  *  <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
    508  *  properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
    509  *  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.
    510534 * @param {InfoBoxOptions} opt_opts
    511535 */
     
    556580
    557581    this.closeBoxURL_ = opt_opts.closeBoxURL;
     582  }
     583  if (typeof opt_opts.closeBoxTitle !== "undefined") {
     584
     585    this.closeBoxTitle_ = opt_opts.closeBoxTitle;
    558586  }
    559587  if (typeof opt_opts.infoBoxClearance !== "undefined") {
     
    732760
    733761/**
     762 * Returns the width of the InfoBox in pixels.
     763 * @returns {number}
     764 */
     765InfoBox.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 */
     779InfoBox.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/**
    734790 * Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
    735791 */
     
    767823  if (anchor) {
    768824
    769     this.position_ = anchor.getPosition();
     825    this.setPosition(anchor.getPosition()); // BUG FIX 2/17/2018: needed for v3.32
    770826    this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
    771827      me.setPosition(this.getPosition());
    772828    });
    773 
    774     this.mapListener_ = google.maps.event.addListener(anchor, "map_changed", function() {
    775       me.setMap(this.map);
    776     });   
    777829  }
    778830
     
    781833  if (this.div_) {
    782834
    783     this.panBox_();
     835    this.panBox_(this.disableAutoPan_); // BUG FIX 2/17/2018: add missing parameter
    784836  }
    785837};
     
    799851
    800852  if (this.eventListeners_) {
    801    
     853
    802854    for (i = 0; i < this.eventListeners_.length; i++) {
    803855
     
    813865  }
    814866
    815   if (this.mapListener_) {
    816    
    817     google.maps.event.removeListener(this.mapListener_);
    818     this.mapListener_ = null;   
    819   }
    820  
    821867  if (this.contextListener_) {
    822868
  • novo-map/trunk/README.txt

    r2476895 r2630767  
    44Tags: 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
    55Requires at least: 4.0
    6 Tested up to: 5.6.1
    7 Stable tag: 1.1.1
     6Tested up to: 5.8.2
     7Stable tag: 1.1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6060
    6161= Generate a Google Map API Key =
    62 
    6362Generate 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.
    6463
     
    9291The default is: array( 'post', 'page');
    9392
     93= Map displaying in the admin and the preview but not in the frontend =
     94There 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
    9496== Screenshots ==
    9597
     
    102104
    103105== Changelog ==
     106
     107= 1.1.2 =
     108* upgrade to gmap api 3.47
     109* add latest version of infobox.js script
    104110
    105111= 1.1.1 =
  • novo-map/trunk/admin/class-novo-map-admin.php

    r2476886 r2630767  
    101101     */
    102102    public function enqueue_post_admin_script() {
    103         wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&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 );
    104104    }
    105105
     
    108108     */
    109109    public function enqueue_main_admin_script() {
    110         wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&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 );
    111111        wp_enqueue_script( $this->plugin_name.'-infobox', plugins_url( $this->plugin_name) .'/public/assets/js/infobox.js', array( $this->plugin_name.'-gmap-api' ) );
    112112        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  
    704704    public function enqueue_map($plugin_name) {
    705705        // enqueue necessary stuff
    706         wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&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 );
    707707        wp_enqueue_script( $plugin_name.'-infobox', plugins_url( $plugin_name) .'/public/assets/js/infobox.js', array( $plugin_name.'-gmap-api' ) );
    708708        if($this->pin_clustering()) {
  • novo-map/trunk/novo-map.php

    r2476895 r2630767  
    1717 * Plugin URI:        https://wordpress.org/plugins/novo-map/
    1818 * Description:       Display all your posts and pages on custom google maps
    19  * Version:           1.1.1
     19 * Version:           1.1.2
    2020 * Author:            novo-media
    21  * Author URI:        https://novo-media.ch
     21 * Author URI:        https://novo-media.ch/
    2222 * License:           GPL-2.0+
    2323 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     
    3131}
    3232
    33 define( 'NOVO_MAP_VERSION', '1.1.1' );
     33define( 'NOVO_MAP_VERSION', '1.1.2' );
    3434
    3535/**
  • novo-map/trunk/public/assets/js/infobox.js

    r1773144 r2630767  
    11/**
    22 * @name InfoBox
    3  * @version 1.1.13 [March 19, 2014]
     3 * @version 1.1.19 [April 6, 2018]
    44 * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
    55 * @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
     
    5050 * @property {string} closeBoxMargin The CSS margin style value for the close box.
    5151 *  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 ".
    5253 * @property {string} closeBoxURL The URL of the image representing the close box.
    5354 *  Note: The default is the URL for Google's standard close box.
     
    9596  this.boxStyle_ = opt_opts.boxStyle || {};
    9697  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";
    9899  if (opt_opts.closeBoxURL === "") {
    99100    this.closeBoxURL_ = "";
    100101  }
     102  this.closeBoxTitle_ = opt_opts.closeBoxTitle || " Close ";
    101103  this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
    102104
     
    117119  this.closeListener_ = null;
    118120  this.moveListener_ = null;
    119   this.mapListener_ = null;
    120121  this.contextListener_ = null;
    121122  this.eventListeners_ = null;
     
    214215      // Note: mousemove not included (to resolve Issue 152)
    215216      events = ["mousedown", "mouseover", "mouseout", "mouseup",
    216       "click", "dblclick", "touchstart", "touchend", "touchmove"];
     217        "click", "dblclick", "touchstart", "touchend", "touchmove"];
    217218
    218219      for (i = 0; i < events.length; i++) {
     
    220221        this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
    221222      }
    222      
     223
    223224      // Workaround for Google bug that causes the cursor to change to a pointer
    224225      // when the mouse moves over a marker underneath InfoBox.
     
    252253    img += " src='" + this.closeBoxURL_ + "'";
    253254    img += " align=right"; // Do this because Opera chokes on style='float: right;'
     255    img += " title='" + this.closeBoxTitle_ + "'";
    254256    img += " style='";
    255257    img += " position: relative;"; // Required by MSIE
     
    327329
    328330      if (!map.getBounds().contains(this.position_)) {
    329       // Marker not in visible area of map, so set center
    330       // 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.
    331333        map.setCenter(this.position_);
    332334      }
    333335
    334       bounds = map.getBounds();
    335 
    336       var mapDiv = map.getDiv();
    337       var mapWidth = mapDiv.offsetWidth;
    338       var mapHeight = mapDiv.offsetHeight;
    339336      var iwOffsetX = this.pixelOffset_.width;
    340337      var iwOffsetY = this.pixelOffset_.height;
     
    343340      var padX = this.infoBoxClearance_.width;
    344341      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;
    357358        }
     359        map.panToBounds(new google.maps.LatLngBounds(this.position_), padding);
    358360      } 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;
    363370        }
    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        }
    372392      }
    373393    }
     
    404424    // Fix for iOS disappearing InfoBox problem.
    405425    // 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    }
    407431
    408432    // Fix up opacity style for benefit of MSIE:
     
    486510
    487511  this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
    488  
     512
    489513  if (this.alignBottom_) {
    490514    this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
     
    505529/**
    506530 * Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
    507  *  <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
    508  *  properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
    509  *  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.
    510534 * @param {InfoBoxOptions} opt_opts
    511535 */
     
    556580
    557581    this.closeBoxURL_ = opt_opts.closeBoxURL;
     582  }
     583  if (typeof opt_opts.closeBoxTitle !== "undefined") {
     584
     585    this.closeBoxTitle_ = opt_opts.closeBoxTitle;
    558586  }
    559587  if (typeof opt_opts.infoBoxClearance !== "undefined") {
     
    732760
    733761/**
     762 * Returns the width of the InfoBox in pixels.
     763 * @returns {number}
     764 */
     765InfoBox.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 */
     779InfoBox.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/**
    734790 * Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
    735791 */
     
    767823  if (anchor) {
    768824
    769     this.position_ = anchor.getPosition();
     825    this.setPosition(anchor.getPosition()); // BUG FIX 2/17/2018: needed for v3.32
    770826    this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
    771827      me.setPosition(this.getPosition());
    772828    });
    773 
    774     this.mapListener_ = google.maps.event.addListener(anchor, "map_changed", function() {
    775       me.setMap(this.map);
    776     });   
    777829  }
    778830
     
    781833  if (this.div_) {
    782834
    783     this.panBox_();
     835    this.panBox_(this.disableAutoPan_); // BUG FIX 2/17/2018: add missing parameter
    784836  }
    785837};
     
    799851
    800852  if (this.eventListeners_) {
    801    
     853
    802854    for (i = 0; i < this.eventListeners_.length; i++) {
    803855
     
    813865  }
    814866
    815   if (this.mapListener_) {
    816    
    817     google.maps.event.removeListener(this.mapListener_);
    818     this.mapListener_ = null;   
    819   }
    820  
    821867  if (this.contextListener_) {
    822868
Note: See TracChangeset for help on using the changeset viewer.