blackhard
blackhard

Reputation: 542

How to prevent unnecessary scrolling in diagram?

I have the following diagram with overview:

var $ = go.GraphObject.make;
var diagram =
      $(go.Diagram, element[0],{
            initialContentAlignment: go.Spot.TopCenter,
            initialScale: (pageBodyWidth > 500 ? 1 : 0.6),
            contentAlignment: go.Spot.TopCenter,
            layout: $(go.LayeredDigraphLayout, { direction: 0 }),
            isReadOnly: false,
            allowLink: true,
            allowClipboard: false,
            'animationManager.duration': 200,
            'undoManager.isEnabled': false
      });
var overview = $(go.Overview, 'diagramOverview', { observed: diagram });

After this I see a diagram but there is unnecessary scrolling and it exists on overview: enter image description here

How to disable this scrolling? I want to have a fixed diagram area.

Also I see that diagram has an extra space: enter image description here

What is this space? Is it possible to have a diagram without this space as in example here http://gojs.net/latest/samples/orgChartStatic.html ?

Upvotes: 0

Views: 1237

Answers (1)

Pavel Aslanov
Pavel Aslanov

Reputation: 180

Try setting "allowHorizontalScroll: false" and "allowVerticalScroll: false" when you define the diagram so it will become: var $ = go.GraphObject.make; var diagram = $(go.Diagram, element[0],{ initialContentAlignment: go.Spot.TopCenter, initialScale: (pageBodyWidth > 500 ? 1 : 0.6), contentAlignment: go.Spot.TopCenter, layout: $(go.LayeredDigraphLayout, { direction: 0 }), isReadOnly: false, allowLink: true, allowClipboard: false, 'animationManager.duration': 200, 'undoManager.isEnabled': false, allowHorizontalScroll: false, allowVerticalScroll: false }); var overview = $(go.Overview, 'diagramOverview', { observed: diagram });

Upvotes: 2

Related Questions