I tried conditionally change padding on the diagram using go.Margin(), but it triggers viewportBoundsChanged which I do not want. Is there a better way to change padding?
What are the other Diagram settings do you have?
Can you not ignore that event when you modify the Diagram.padding?
Is there a way to ignore the viewportBoundsChanged after padding changes?
I don’t think there is any code in the library that automatically changes the value of Diagram.padding. So whenever you modify it, you know that you’ve done so.
Yes so on a certain condition I’m using this snippet:
const bottom = 10;
diagram.padding = new window.go.Margin(
diagram.padding.top,
diagram.padding.right,
bottom,
diagram.padding.left
);
this triggers viewportBoundsChanged
So that will happen at most once, unless you have other code modifying the Diagram.padding property.
Can you just set it correctly when you initialize the diagram? Why are you doing this at all? What is the “ViewportBoundsChanged” listener for, or is it unrelated?
ViewportBoundsChanged is unrelated. I’ll try to do it on diagram initialization then. Thanks