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

How to set the initial position of the first object dropped in the canvas

$
0
0

@ram4unetcore wrote:

Hi,
Thanks for your continued help. How can I set the position of the first object dropped on canvas to new go.Point(50, 50), I have defined my canvas like this.

diagram = GJS(go.Diagram, 'canvas', {
      'toolManager.hoverDelay': 50,
      initialContentAlignment: go.Spot.TopLeft,
      allowDrop: true,
      'undoManager.isEnabled': true,
      'linkingTool.isEnabled': false,
      'linkingTool.direction': go.LinkingTool.ForwardsOnly,
      scrollsPageOnFocus: false,
      allowHorizontalScroll: false,
      allowVerticalScroll: false,
      initialPosition : new go.Point(50, 50),
      initialAutoScale: go.Diagram.Uniform,
      scrollMode: go.Diagram.InfiniteScroll,
    });

Previously I was using it

diagram = GJS(go.Diagram, 'canvas', {
      'toolManager.hoverDelay': 50,
      initialContentAlignment: go.Spot.TopLeft,
      allowDrop: true,
      'undoManager.isEnabled': true,
      'linkingTool.isEnabled': false,
      'linkingTool.direction': go.LinkingTool.ForwardsOnly,
      scrollsPageOnFocus: false,
      allowHorizontalScroll: false,
      allowVerticalScroll: false,
      initialPosition : new go.Point(50, 50),
      initialAutoScale: go.Diagram.Uniform,
      scrollMode: go.Diagram.InfiniteScroll,
      layout: GJS(go.LayeredDigraphLayout, {
        arrangementOrigin: new go.Point(50, 50),
       })
    });

With the second approach, it was possible but with the first one, it is not. I don’t want to use the ```layout`` on canvas.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6969

Trending Articles