By Daniel Du
Have you ever run into following scenario? When I have tool tips enabled in the point data, I have to be exactly right on the center for the tool tip to show. There doesn't seem to be any tolerance on the center or symbol. Is there a way to increase the tolerance or sensitivity for the tool tip in the code?
Yes, There is. If you are using Ajax viewer (basic web layout), it can be done by making changes in: ajaxmappane.templ which is in Viewerfiles.
function RequestHyperLinkData(id, x, y, exec) {
if (lastMapRcv != mapId) return;
if (isPopupOpen(tbMenu) || isPopupOpen(ctxMenu)) return;
req = CreateRequestHandler();
req.open("POST", webAgent, true);
req.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
// default tolerance is 2 pixies, you can edit this line
// to change the tolerance
// x1 = x - 2; x2 = x + 2; (original. changed to show tooltip)
// y1 = y - 2; y2 = y + 2; (original)
//Change the tolerance to 5 pixies
x1 = x - 5; x2 = x + 5;
y1 = y - 5; y2 = y + 5;
pt1 = ScreenToMapUnits(x1, y1);
pt2 = ScreenToMapUnits(x2, y2);
geom = MakeWktPolygon(pt1.X, pt1.Y, pt2.X, pt2.Y);
reqParams =
"OPERATION=QUERYMAPFEATURES&VERSION=1.0.0
&PERSIST=0&MAPNAME="
+encodeURIComponent(mapName)
+ "&SESSION=" + sessionId + "&SEQ="
+ Math.random() + "&LAYERNAMES="
+ encodeURIComponent(GetVisLayers())
+ "&GEOMETRY=" + geom
+ "&SELECTIONVARIANT=INTERSECTS&MAXFEATURES=1";
obj = new HlRequest(id, x, y, req, exec);
req.onreadystatechange = obj.OnHl;
try { req.send(reqParams); } catch (e) { }
}
For fusion viewer (flexible web layout), the configuration of map tip tolerance is stored in the application definition (flexible web layout) which is stored in repository.
To solve your problem, you need to edit the ApplicationDefinition resource in repository directly. It can be done by Resource Service API(MgResourceService:GetResourceContent and MgResourceService.SetResource), or by MapAgent, or Maestro, which is an open source tool and not supported by DevTech.
Here is a snippet of application definition resource content, you can increase the value of <Tolerance> tag of MapTip .
<Widget>
<Name>Maptip</Name>
<Type>Maptip</Type>
<Location />
<Extension>
<Tolerance>2</Tolerance>
<Target>MaptipWindow</Target>
<WinFeatures>
menubar=no,location=no,resizable=no,status=no
</WinFeatures>
<Delay>350</Delay>
<Layer />
</Extension>
</Widget>
Hope this helps.