fixed zoom issue by adding code that ensures zoom is not > 15
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 16 Mar 2016 16:01:56 +0000 (12:01 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 16 Mar 2016 16:01:56 +0000 (12:01 -0400)
footer.php
js/app.js
js/custom/google-map.js
scss/_main.scss

index 41359de..1aebd5a 100644 (file)
@@ -6,9 +6,9 @@
                             <div class="text-center small-12 medium-6 columns">
                                 <h2>Getting Here</h2>
 <!--                                <img src="<?php echo esc_url( get_template_directory_uri() ) ;?>/assets/map-fpo.jpg">-->
-                                <div class="small-12 large-8 text-center columns" id="google-map">
+                                <div class="small-12 large-8 columns" id="google-map">
                                     <?php if (function_exists('glm_google_map')) {
-                                        echo glm_google_map('150%', '274px');
+                                        echo glm_google_map('100%', '274px');
                                     }?>
                                 </div>
                             </div>
index 073515b..477487b 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -28,7 +28,7 @@ var g=a(f(this.selector(c),a("<div></div>").html(c.attr("title")).html())),h=thi
         Map._map = new google.maps.Map(canvas, myOptions);
         Map._latLngBounds = new google.maps.LatLngBounds();
         Map._infoWindow = new google.maps.InfoWindow;
-        Map._map.setZoom(14);
+      
         $.get(mydir + "map.xml", Map._loadData, 'xml');
     },
 
@@ -82,7 +82,11 @@ var g=a(f(this.selector(c),a("<div></div>").html(c.attr("title")).html())),h=thi
             Map._latLngBounds.getCenter()
         );
         Map._map.fitBounds(Map._latLngBounds);
-
+        google.maps.event.addListenerOnce(Map._map, 'bounds_changed', function(event) {
+            if (this.getZoom() > 15) {
+                this.setZoom(13);
+            }
+        });
         if (typeof glm_searchMapIconActive !== "undefined" && glm_searchMapIconActive) {
             $(".map-link").click(function (){
                 var linkId = $(this).attr("rel");
@@ -112,6 +116,7 @@ var g=a(f(this.selector(c),a("<div></div>").html(c.attr("title")).html())),h=thi
                 }
             });
         });
+        Map._map.setZoom(13);
     }
 };
 
index 468330e..1f70b77 100644 (file)
@@ -19,7 +19,7 @@ var Map = {
         Map._map = new google.maps.Map(canvas, myOptions);
         Map._latLngBounds = new google.maps.LatLngBounds();
         Map._infoWindow = new google.maps.InfoWindow;
-        Map._map.setZoom(14);
+      
         $.get(mydir + "map.xml", Map._loadData, 'xml');
     },
 
@@ -73,7 +73,11 @@ var Map = {
             Map._latLngBounds.getCenter()
         );
         Map._map.fitBounds(Map._latLngBounds);
-
+        google.maps.event.addListenerOnce(Map._map, 'bounds_changed', function(event) {
+            if (this.getZoom() > 15) {
+                this.setZoom(13);
+            }
+        });
         if (typeof glm_searchMapIconActive !== "undefined" && glm_searchMapIconActive) {
             $(".map-link").click(function (){
                 var linkId = $(this).attr("rel");
@@ -103,6 +107,7 @@ var Map = {
                 }
             });
         });
+        Map._map.setZoom(13);
     }
 };
 
index 84fb686..f094ed7 100644 (file)
@@ -53,3 +53,4 @@ main {
     display: none;
 }
 
+