Hello, I''m wondering whether it''s possible to use the scrollwheel to zoom the map in mapstraction, and if so, what code do I need to add to my install? Thanks, Matt
Hi Matt, I have extended mapstraction to do this, google maps implementation only, I''m afraid: // --------------------------------- // Mapstraction Extensions - Zooming // --------------------------------- // Enable continuous zoom (required for scroll wheel zooming) Mapstraction.prototype.enableContinuousZoom = function() { if(this.loaded[this.api] == false) { myself = this; this.onload[this.api].push(function() { myself.enableContinuousZoom(); }); return; } var map = this.maps[this.api]; switch (this.api) { case ''google'': map.enableContinuousZoom(); break; case ''yahoo'': case ''openlayers'': case ''openstreetmap'': case ''multimap'': case ''mapquest'': alert(this.api + '' not supported by Mapstraction.enableContinuousZoom''); break; } } // Enable scroll wheel zooming Mapstraction.prototype.enableScrollWheelZoom = function() { if(this.loaded[this.api] == false) { myself = this; this.onload[this.api].push(function() { myself.enableScrollWheelZoom(); }); return; } var map = this.maps[this.api]; switch (this.api) { case ''google'': map.enableScrollWheelZoom(); break; case ''yahoo'': case ''openlayers'': case ''openstreetmap'': case ''multimap'': case ''mapquest'': alert(this.api + '' not supported by Mapstraction.enableScrollWheelZoom''); break; } } Rob Moran Technical Development Manager Opportunity Links, Trust Court, The Vision Park, Histon, Cambridge, CB24 9PW T 01223 566 522 F 01223 500 281 www.opp-links.org.uk Opportunity Links LTD registered in England no: 3565647. Registered Office: Trust Court, The Vision Park, Histon, Cambs. CB24 9PW This email message is private and for use by the addressee only. It may contain information, which is privileged and confidential. If you receive this in error please return to sender by reply and delete the message from your computer. You are not authorised to and must not disclose, copy, distribute or retain the message or any part of it. -----Original Message----- From: mapstraction-bounces at lists.mapstraction.com [mailto:mapstraction-bounces at lists.mapstraction.com] On Behalf Of Matt Fletcher Sent: 22 September 2008 09:32 To: mapstraction at lists.mapstraction.com Subject: [Mapstraction] Zoom with Scrollwheel Hello, I''m wondering whether it''s possible to use the scrollwheel to zoom the map in mapstraction, and if so, what code do I need to add to my install? Thanks, Matt _______________________________________________ Mapstraction mailing list Mapstraction at lists.mapstraction.com http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
Thanks Rob - added & commited. On Tue, Sep 23, 2008 at 2:25 PM, Rob Moran <Rob.Moran at opp-links.org.uk>wrote:> Hi Matt, > > I have extended mapstraction to do this, google maps implementation > only, I''m afraid: > > // --------------------------------- > // Mapstraction Extensions - Zooming > // --------------------------------- > > // Enable continuous zoom (required for scroll wheel zooming) > Mapstraction.prototype.enableContinuousZoom = function() > { > if(this.loaded[this.api] == false) > { > myself = this; > this.onload[this.api].push(function() > { > myself.enableContinuousZoom(); > }); > return; > } > > var map = this.maps[this.api]; > > switch (this.api) > { > case ''google'': > map.enableContinuousZoom(); > break; > case ''yahoo'': > case ''openlayers'': > case ''openstreetmap'': > case ''multimap'': > case ''mapquest'': > alert(this.api + '' not supported by > Mapstraction.enableContinuousZoom''); > break; > } > } > > // Enable scroll wheel zooming > Mapstraction.prototype.enableScrollWheelZoom = function() > { > if(this.loaded[this.api] == false) > { > myself = this; > this.onload[this.api].push(function() > { > myself.enableScrollWheelZoom(); > }); > return; > } > > var map = this.maps[this.api]; > > switch (this.api) > { > case ''google'': > map.enableScrollWheelZoom(); > break; > case ''yahoo'': > case ''openlayers'': > case ''openstreetmap'': > case ''multimap'': > case ''mapquest'': > alert(this.api + '' not supported by > Mapstraction.enableScrollWheelZoom''); > break; > } > } > > Rob Moran > Technical Development Manager > Opportunity Links, Trust Court, The Vision Park, Histon, Cambridge, CB24 > 9PW > T 01223 566 522 F 01223 500 281 www.opp-links.org.uk > Opportunity Links LTD registered in England no: 3565647. Registered > Office: Trust Court, The Vision Park, Histon, Cambs. CB24 9PW > > This email message is private and for use by the addressee only. It may > contain information, which is privileged and confidential. If you > receive this in error please return to sender by reply and delete the > message from your computer. You are not authorised to and must not > disclose, copy, distribute or retain the message or any part of it. > > -----Original Message----- > From: mapstraction-bounces at lists.mapstraction.com > [mailto:mapstraction-bounces at lists.mapstraction.com] On Behalf Of Matt > Fletcher > Sent: 22 September 2008 09:32 > To: mapstraction at lists.mapstraction.com > Subject: [Mapstraction] Zoom with Scrollwheel > > Hello, > I''m wondering whether it''s possible to use the scrollwheel to zoom the > map in mapstraction, and if so, what code do I need to add to my > install? > > Thanks, Matt > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >-- Andrew Turner mobile: 248.982.3609 andrew at mapufacture.com http://highearthorbit.com http://mapufacture.com Helping build the Geospatial Web Introduction to Neogeography - http://oreilly.com/catalog/neogeography -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20080923/a2828c61/attachment.htm>
Right now OpenStreetMap is served using Google''s API. So you could just add a case "openstreetmap": before the case "google": in that handler and it will work. In general, it does rely on each API, but that is different from each "tile provider". :) Andrew On Tue, Sep 23, 2008 at 6:13 PM, Matt Fletcher <morecambe at gmail.com> wrote:> That''s great, but I''m after a solution for OpenStreetMap. Is this > likely to become available, or does it rely on each underlying API > supporting it? > > Matt >-- Andrew Turner mobile: 248.982.3609 andrew at mapufacture.com http://highearthorbit.com http://mapufacture.com Helping build the Geospatial Web Introduction to Neogeography - http://oreilly.com/catalog/neogeography -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20080924/a2aea746/attachment.htm>