Hello,
I'm having problems with Tooltips on the AJAX xMaps:
Here's the scenario:
1. I add some POI elements[1] and set their tooltipContent property
All POIs are shown and their tooltips show up, too. Nice -so far-
2. I add a Line element[2] and attach a DynamicTooltip element[3] via "DynamicTooltip#setAttachedElement" to it.
Now, the tooltip is shown for the line, but not for any of the POIs added at (1)!
Furthermore, even if the line is removed, the POIs will not show any tooltip!
I have no idea what might be the reason for this or how to work around this problem.
/Regards,
Peter
---------------------
[1] com.ptvag.webcomponent.map.vector.POI
[2] com.ptvag.webcomponent.map.vector.Line
[3] com.ptvag.webcomponent.map.vector.DynamicTooltip
POI#tooltipContent & DynamicTooltip mutual exclusive?
Re: POI#tooltipContent & DynamicTooltip mutual exclusive?
I was able to remove the problem (I hope) with the following procedure:
When removing the Line from the Layer, I also "detach" the DynamicTooltip and the Line from each other.
That seems to resolve the issue.
So something in the lines of:
Note: this code is "cut'n'paste", so might not contain all necessary parts.
/Peter
When removing the Line from the Layer, I also "detach" the DynamicTooltip and the Line from each other.
That seems to resolve the issue.
So something in the lines of:
Code: Select all
var lineId; // 'private' class members
var tooltipId; // " "
// ----------------------------------------------
function addLine ()
{
var vectorNS = com.ptvag.webcomponent.map.vector; // namespace shortcut
var vectorLayer = map.getLayer("vector"); // map beeing instanceof com.ptvag.webcomponent.map.Map
var line = new vectorNS.Line();
line.setPixelSize(8);
// ...
line.setCoordinates(lineCoords);
lineId = vectorLayer.addElement(line);
var tooltip = new vectorNS.DynamicTooltip();
tooltip.setAttachedElement(line);
tooltip.setContentProvider(...);
tooltipId = vectorLayer.addElement(tooltip);
};
// ----------------------------------------------
function removeLine ()
{
var vectorLayer = map.getLayer("vector");
// 'detach' line <-> Tooltip connection!
var tooltip = vectorLayer.getElement(tooltipId);
tooltip.setAttachedElement(null);
vectorLayer.removeElement(tooltipId);
vectorLayer.removeElement(lineId);
};
/Peter
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: POI#tooltipContent & DynamicTooltip mutual exclusive?
Hello Mr Schneider,
one of our developers took a look at this part of the code and he wasn't able to recognize the solution in this visible code. He assumes that you resolved it somewhere else.
We will therefore not be able to investigate this
Best regards
Bernd
one of our developers took a look at this part of the code and he wasn't able to recognize the solution in this visible code. He assumes that you resolved it somewhere else.
We will therefore not be able to investigate this
Best regards
Bernd