Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add maximum auto zoom option #410

Closed
GoogleCodeExporter opened this issue Apr 4, 2015 · 4 comments
Closed

Add maximum auto zoom option #410

GoogleCodeExporter opened this issue Apr 4, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

I need to be able to specify a maximum zoom when "zoom=auto" is used.  This 
would limit only the initial load, not what the user can zoom manually.

My use for this is for context-sensitive maps.  Readers of my blog will want to 
know where in the world I am generically, not what street I am on.  If a 
particular page of posts includes only one street in one city, I still want a 
larger regional view showing the country/state/etc.

Below is the code I added to my own installation to achieve this in version 
1.3.8.  I just added the new tag, I did not modify the web interface to allow 
setting default values.

Usage for my implementation would be:
[geo_mashup_map map_content="context" zoom="auto" auto_zoom_max="5"]
<?php GeoMashup::map('map_content=contextual&&zoom=auto&auto_zoom_max=5'); ?>

geo-mashup.js-1014-                     if ( this.opts.zoom === 'auto' ) {
geo-mashup.js:1015:                             var 
map_zoom_level,map_max_zoom_level;
geo-mashup.js:1016:                             map_zoom_level     = 
this.map.getBoundsZoomLevel( this.location_bounds );
geo-mashup.js-1017-                             map_max_zoom_level = 
parseInt(this.opts.auto_zoom_max, 10);
geo-mashup.js:1018:                             if (map_zoom_level > 
map_max_zoom_level) {
geo-mashup.js:1019:                                     map_zoom_level = 
map_max_zoom_level;
geo-mashup.js-1020-                             }
geo-mashup.js-1021-                             this.setCenterUpToMaxZoom(
geo-mashup.js-1022-                                     
this.location_bounds.getCenter(),
geo-mashup.js:1023:                                     map_zoom_level,
geo-mashup.js-1024-                                     function() { 
GeoMashup.updateVisibleList(); }
geo-mashup.js-1025-                             );
geo-mashup.js-1026-                     }

Original issue reported on code.google.com by da...@othalan.net on 2 Dec 2010 at 4:06

@GoogleCodeExporter
Copy link
Author

That seems reasonable, thanks for the code. 

Just to make it clear, was using zoom="5" not a good option because the auto 
zoom will be less in some scenarios?

Original comment by dylankk...@gmail.com on 3 Dec 2010 at 2:25

  • Changed state: Accepted
  • Added labels: Type-Enhancement

@GoogleCodeExporter
Copy link
Author

You are correct.

Readers of my blog will be interested in "where in the world am I today" which 
will normally involve relatively short distances for each page of posts.  A 
static zoom level works great for this most of the time ... unless posts cover 
a very big distance (perhaps California,USA to Germany, for example).  When 
that does happen I want the zoom level to automatically show the wider region 
so reader get an overview of where I am talking about.

BTW, brilliant plugin!

Original comment by da...@othalan.net on 3 Dec 2010 at 2:38

@GoogleCodeExporter
Copy link
Author

This issue was updated by revision r817.

The parameter should continue to work in 1.4, although not with google v3. 
That API may require more work due to a delay in the availability of the 
calculated auto zoom level.

Original comment by dylankk...@gmail.com on 23 Dec 2010 at 7:30

  • Changed state: Implemented
  • Added labels: Milestone-1.4

@GoogleCodeExporter
Copy link
Author

Original comment by dylankk...@gmail.com on 12 Jul 2011 at 1:48

  • Changed state: Released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant