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

Edge over come on Label when highlighted

$
0
0

@opkeydev wrote:

Issue
If i highlight the edge it come over the Label.

Expected:
Edge should not come over the label even if edge is highlighted.

Code:

        myDiagram.linkTemplate =
          $(go.Link,
            {
                routing: go.Link.AvoidsNodes,
                relinkableFrom: true,
                relinkableTo: true,
                reshapable: true,
                resegmentable: true,
                fromLinkable: true,
                fromLinkableSelfNode: true,
                fromLinkableDuplicates: true,
                toLinkable: true,
                toLinkableSelfNode: true,
                toLinkableDuplicates: true,
                zOrder: 1,
                mouseEnter: function (e, link) {

                    var x = e.event.clientX - myDiagram.div.offsetLeft;
                    var y = e.event.clientY - myDiagram.div.offsetTop - 130;  // set - 130 as per keyword node size to set the y position 
                    console.log('link focus in. x is' + x + " y is " + y);


                    dataFactory.customNodeObject['e'] = e;
                    dataFactory.customNodeObject['link'] = link;
                    dataFactory.customNodeObject['x'] = x;
                    dataFactory.customNodeObject['y'] = y;
                    link.findObject("HIGHLIGHT").stroke = "rgba(24,87,255,2.0)";
                    link.isHighlighted = true;

                },
                mouseLeave: function (e, link) {
                    var x = e.event.clientX - myDiagram.div.offsetLeft;
                    var y = e.event.clientY - myDiagram.div.offsetTop - 130;  // set - 130 as per keyword node size to set the y position 
                    console.log('link focus out. x is' + x + " y is " + y);
                    if (!((dataFactory.customNodeObject['x'] - x) >= -5 && (dataFactory.customNodeObject['x'] - x) <= 5) || !((dataFactory.customNodeObject['y'] - y) >= -5 && (dataFactory.customNodeObject['y'] - y) <= 5)) {
                        dataFactory.customNodeObject = new Object();
                        link.findObject("HIGHLIGHT").stroke = "gray"; link.isHighlighted = false;

                    }
                },
                mouseDrop: CheckLockBeforeDragDropOnLink,
                toShortLength: 2,

            },
            new go.Binding("points").makeTwoWay(),
             new go.Binding("zOrder"),
            new go.Binding("routing", "routing"),
            new go.Binding("curviness"),
            $(go.Shape, { stroke: "gray", strokeWidth: 1.5, name: "HIGHLIGHT" }),

            $(go.Shape, { fromArrow: "Circle", fill: "gray", strokeWidth: 2, stroke: "gray" }),
            $(go.Shape, { toArrow: 'Standard', fill: "gray", strokeWidth: 2, stroke: "gray" }),

                $(go.Panel, "Auto",
             { _isLinkLabel: true, cursor: "move" },  // marks this Panel as being a draggable label

           $(go.Shape, { isPanelMain: true, fill: "white", stroke: "orange", strokeWidth: 2 },
                 new go.Binding("stroke", "stroke").makeTwoWay()
            ),
          $(go.Shape, "StopSign",
          {
              alignment: go.Spot.TopLeft, margin: 3,
              width: 8, height: 8, fill: "red", visible: visible, stroke: null
          },
         new go.Binding("visible", "visible").makeTwoWay()),
         new go.Binding('visible', 'text', function (t) { return t.trim() !== '' }),


        $(go.TextBlock, "Label", {
            //zOrder: 2,
            margin: 3, editable: true,
            isMultiline: true,  // don't allow embedded newlines
            textValidation: validateText,
            segmentIndex: 0, segmentFraction: 0.5,
            textEdited: function (textBlock, previousText, currentText) {
                if (previousText != currentText) {
                    var selectedData = myDiagram.selection.first().data;
                    if (selectedData.hasOwnProperty('EdgeID')) {
                        var edgeName = currentText.split('\u00AD');
                        if (edgeName.length > 1) {
                            edgeName = currentText.split('\u00AD')[1].trim();
                        } else {
                            edgeName = currentText.trim();
                        }
                        $scope.MBTOperationScope.renameEdge(edgeName);
                    }
                }
            }
        },
            new go.Binding('visible', 'text', function (t) {
                return t.trim() !== ''
            }),
                new go.Binding("text", "text", function (e) {
                    if (e != "") {
                        return "\u00AD   " + e;
                    }
                }).makeTwoWay(),
         {
             toolTip:
                    $("ToolTip",
                      new go.Binding("visible", "text", function (t) {
                          if (t.trim('') == "Associated FL Name :") {
                              t = '';
                          }
                          return !!t;
                      }).ofObject("TB"),
                      $(go.TextBlock,
                        { name: "TB", margin: 4, font: "bold 12px Verdana,serif", stroke: "black" },
                        new go.Binding("text", "", diagramNodeInfo))
                    )
         }
               ),
                { contextMenu: $(go.Adornment) },
             new go.Binding("segmentIndex").makeTwoWay(),
             new go.Binding("segmentFraction").makeTwoWay()
           )
         );

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6977

Latest Images

Trending Articles



Latest Images