React-diagrams: UX: Zoom change programmatically should focus on canvas center

Created on 29 Nov 2019  路  4Comments  路  Source: projectstorm/react-diagrams

Currently if we change the zoom by calling setZoomLevel, it behaves not very naturally because it gives the feeling that we are zooming from somewhere else than the center of the screen.

I suppose it takes the offset X and Y as reference. It should adjust the offset to keep the elements that were in the center before the call.

feature request

Most helpful comment

Note that a separated function from setZoomLevel should probably be added. I propose setZoomLevelFromCenter

All 4 comments

Before zoom in

image

After zoom in

image

Expected result : "Over here !" node should remain at center

Note that a separated function from setZoomLevel should probably be added. I propose setZoomLevelFromCenter

I think it would be also good to have the ability to specify a zoom origin as a second argument of setZoomLevel. What do you think?

I am trying to set the zoom with dropdown. It was not working for me in 6.0.2 version.

engine.model.setZoomLevel(25)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Naveenraj006 picture Naveenraj006  路  3Comments

Nesterov-Konstantin picture Nesterov-Konstantin  路  4Comments

shortwavedave picture shortwavedave  路  3Comments

DanieLazarLDAPPS picture DanieLazarLDAPPS  路  3Comments

dixitk13 picture dixitk13  路  3Comments