In the relevant template html there should be a function called
fusionInitialized which contains this line:
mapWidget.registerForEvent(Fusion.Event.MAP_LOADED, initPanelHandler);
This event handler will call initPanelHandler when the map is loaded.
So you have 2 options
1) include a call mapWidget.setExtents within initpanelHandler.
2) add your own event handler.
Option 2 is the way I generally do it, as it means you can quick update the
code when you update to the latest version, I also wait for the map layers and
groups to load. The event handler and zoom code is:
Event handler code, added to fusionInitialized:
mapWidget.registerForEvent(Fusion.Event.MAP_MAP_GROUP_LOADED, zoomToPoint);
code to zoom into a point with a 100 unit buffer:
var zoomToPoint = function(){
var cent_x = 123456789
var cent_y = 987654321
var offset = 100;
var x1 = cent_x -offset;
var x2 = cent_x +offset;
var y1 = cent_y -offset;
var y2 = cent_y + offset;
var mapWidget = Fusion.getWidgetById('Map');
var extent = new OpenLayers.Bounds(x1,y1,x2, y2);
mapWidget.setExtents(extent);
}
Where Cent_x and cent_y is the point you want to zoom into and need to be in
the co-ordinate system of your map. If you already have the co-ords of the area
you want to zoom into then you can just set the extents using them.
-----Original Message-----
From: mapguide-users [mailto:[email protected]] On Behalf
Of makoychan
Sent: Wednesday, 25 November 2020 7:43 AM
To: [email protected]
Subject: [mapguide-users] setExtents on mapload fusion
Is there a way on fusion mapwidget to set right away the map extents?
--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapguide-users