Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Tooltip is going beyond my diagram

$
0
0

@mithun wrote:

Hi,

I am using html based tooltip and my tooltip is going beyond my diagram when I set its position based on which node is selected.

Is there any way smartly goJs can handle and place the tooltip to right x and y?

I am trying to write a custom function to figure out the position of x and y, but no luck.

toolTipContainer.style.left = tooltipXPosition(parseInt(me.goJsDiagram.transformDocToView(obj.part.location).x.toFixed(0)), toolTipContainer.offsetWidth, me.goJsDiagram.documentBounds.right);
    toolTipContainer.style.top = tooltipYPosition(parseInt(me.goJsDiagram.transformDocToView(obj.part.location).y.toFixed(0)), toolTipContainer.offsetHeight, me.goJsDiagram.documentBounds.bottom);

 function tooltipXPosition(pos,containerSize,diagramExtreme) {
     if( pos + containerSize < diagramExtreme) {
       return pos+70+'px';
     }
     else {
       var offset = pos + containerSize - diagramExtreme;
       return pos - offset  + 'px';
     }
 }

 function tooltipYPosition(pos,containerSize,diagramExtreme) {
     if( pos + containerSize < diagramExtreme) {
       return pos+'px';
     }
     else {
       var offset = pos + containerSize - diagramExtreme;
       return pos - containerSize + 'px';
     }
 }

Somehow, the diagramExtreme is not getting the right value to solve this puzzle. Could you please help?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles