[fusion-users] Getting zoomscroll to work with baselayers in fusion 1.1 (MapGuide)

Måns Beckman mans.beckman at manandmachine.se
Tue Nov 4 03:17:23 EST 2008


Hi, 

 

Fusion 1.1 is great, but zooming with the scrollwheel doesn't work. http://trac.osgeo.org/fusion/ticket/59 (like in Zac's case my map is in a locale coordinate system)

I have been trying to figure out why, but I've had some trouble and some success. 

 

So I started with figuring out that we don't get the same reply from the server when we use ordinary maps as when we use baselayers maps. Something is happening inside OpenLayers. The same parameters are sent from wheelChange to setExtents, after setExtents something is happening that makes the map stay in the same scale.

 

But what could be seen was that zooming in using the zoom tool or the navigator worked, so my quick and dirty hack was to copy some code from the navigator widget into wheelChange.

 

(I know this code is ugly, but it kind of works.)

 

    wheelChange: function(evt, deltaZ) {

var deltaRes = deltaZ > 0 ? 0.5 : 2;

var activeWidget = null;

        if (this.oActiveWidget) {

          activeWidget = this.oActiveWidget;

          this.deactivateWidget(this.oActiveWidget);

        }

                                                          

        var center = this.getCurrentCenter();

        this.zoom(center.x, center.y, deltaRes);

//Event.stop(e);

        if (activeWidget) {

          this.activateWidget(activeWidget);

        }

},

 

This will work, but zooms into the center of the map instead of where the cursor is. I tried to send a different center to the zoom function, like the newCenter calculated in the original wheelChange function, but it still kept zooming into the center of the map, even if I send fixed coordinates like 0,0. This is just strange. 

 

So if anyone can make my code better or find another solution it would be great. 

 

Cheers

Måns

 

 

-----------------------------------------------------------

Måns Beckman

Man and Machine

Fabriksgatan 13

412 50 Göteborg

Phone: +46 31 - 762 8182

Mobile: +46 733 - 38 83 19

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fusion-users/attachments/20081104/2c18cc4c/attachment.html


More information about the fusion-users mailing list