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

GuidedDraggingTool is not working with Adornments

$
0
0

@ram4unetcore wrote:

When I drag new node from the Pallette, Guides are showing correctly, but if there are any adornments to the dragged node and dragging again, Guided dragging not works.

diagram = GJS(go.Diagram, 'canvas', {
  initialContentAlignment: go.Spot.TopLeft,
  allowDrop: true,
  'linkingTool.isEnabled': false,
  'linkingTool.direction': go.LinkingTool.ForwardsOnly,
  scrollsPageOnFocus: false,
  allowHorizontalScroll: true,
  allowVerticalScroll: true,
  scrollMode: go.Diagram.InfiniteScroll,
  draggingTool: new GuidedDraggingTool(),
  'draggingTool.gridSnapCellSpot': go.Spot.Center,
});

// attaching adornments on hover
node.addAdornment('mouseHover', nodeHoverAdornment);

nodeHoverAdornment =
  GJS(go.Adornment, 'Spot', {
    background: 'transparent',
    layerName: 'Background',
    shadowOffset: new go.Point(6, 6),
    cursor: 'pointer',
    // hide the Adornment when the mouse leaves it
    mouseLeave: function(e, obj) {
      obj.part.adornedPart.removeAdornment('mouseHover');
    },
  },
  // if I comment below code, guided dragging works, but I miss delete button and adornments
  GJS(go.Placeholder),
  GJS(go.Panel, 'Position',
     new go.Binding('itemArray', 'adornments'), {
     ...
     ...
  ),
  GJS(go.Panel, 'Horizontal', {alignment: new go.Spot(0, 0, 30, -9)},
      GJS('Button', {
        click: this.confirmDeleteObject.bind(this),
        name: 'node',
        'ButtonBorder.fill': 'transparent',
        'ButtonBorder.stroke': 'transparent',
        _buttonFillOver: 'transparent',
        _buttonStrokeOver: 'transparent',
        cursor: 'pointer'
      }
      GJS(go.Picture, {source : build_path + 'assets/icons/node_icons/others/delete_node.svg' , width : 40, height : 32})
    )
  )
);

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles