Page 1 of 1

POI#tooltipContent & DynamicTooltip mutual exclusive?

Posted: Thu Oct 29, 2015 2:56 pm
by tisptv
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

Re: POI#tooltipContent & DynamicTooltip mutual exclusive?

Posted: Thu Oct 29, 2015 5:02 pm
by tisptv
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:

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);
};
Note: this code is "cut'n'paste", so might not contain all necessary parts.
/Peter

Re: POI#tooltipContent & DynamicTooltip mutual exclusive?

Posted: Wed Nov 04, 2015 4:00 pm
by Bernd Welter
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 :roll: ;-)

Best regards
Bernd