freegroup / draw2d

Create Visio like drawings, diagrams or workflows with JavaScript and HTML5
https://freegroup.github.io/draw2d/#/examples
MIT License
738 stars 227 forks source link

Canvas.setDimension dont work well #170

Closed Samanoova closed 3 years ago

Samanoova commented 3 years ago

Hi I am trying to control the canvas size by Canvas.setDimension to increase and decrease it. the problem is when I increase the size the canvas goes larger but I can't move the nodes to the new appended area that's mean if my canvas is 1000px height and I use the method to make it 2000px height I can move the nodes just inside the first 1000px. the second problem if I tried to decrease the size it's don't work and nothing change.

Samanoova commented 3 years ago

I tried to reset the regionDragDropConstraint like below

canvas.regionDragDropConstraint = new draw2d.policy.figure.RegionEditPolicy(0, 0, canvas.getWidth(), canvas.getHeight());

if I add a new node I can drag it correctly but the nodes that were added before I set the regionDragDropConstraint still can't drag them correctly :(

Samanoova commented 3 years ago

i fix it rather than give it a new value you have to set the BoundingBox for policy canvas.regionDragDropConstraint.setBoundingBox(new draw2d.geo.Rectangle(0, 0, canvas.getWidth(), canvas.getHeight()));