Discussion:
[mapguide-users] Mapguide Fusion: Enable Maptip widget by default
Ethan Snyder
2018-07-16 14:27:14 UTC
Permalink
Hi,

Sorry if this is a repost, but I didn't see this in the OSGeo Nabble
archives, so I am re-sending this, as I didn't think that it went
through the first time.

I'm using Mapguide 3.1.1 with the fusion layout. I have some layers with
tooltips. I have the Maptip widget in the toolbar, but how do I have it
enabled by default. Currently, every time a user goes to the webpage,
the Maptip tool has to be enabled each time. I want it so the user
doesn't have to click it every time to see the tooltips on the map
features. I looked at the XML for the widget, but nothing stood out, and
I don't know what the markup is for this.

Thank you for your time,

Ethan
Jackie Ng
2018-07-18 14:03:35 UTC
Permalink
In your template, try modifying your fusionInitialized function like so:

var fusionInitialized = function() {
$('AppContainer').resize({forceResize: true});
var mapWidget = Fusion.getMapById('Map');
mapWidget.registerForEvent(Fusion.Event.MAP_LOADED, initPanelHandler);

//Activate the first maptip UI instance
var maptip = Fusion.Widget.uiInstances.Maptip[0];
if (maptip) {
maptip.mapTipBtn.setActive(true);
if(!Fusion.Widget.Maptip.ActiveInstance) {
maptip.activate();
Fusion.Widget.Maptip.ActiveInstance = maptip;
}
}
}

It's not enough to just activate the widget as the button representing the
widget also needs its active state changed, hence the need to peek inside
the widget internals to get at the button.

Hope that helps.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Loading...