Skip to content

Conversation

@jonah-iden
Copy link
Contributor

Added a zoomScale property to the CenterAction to explicitly set te zoom level when centering the view.

how to test
in the circlegraph example:

  • add following new button to the circlegraph.html file
    <button id="centerZoomed">center and zoom selection</button>
  • add following code to the standalone.ts to execute the center action on click
document.getElementById('centerZoomed')!.addEventListener('click', async () => {
    dispatcher.dispatch(CenterAction.create(graph.children.map(el => el.id), {animate: true, zoomScale: 2}))
});

now when clicking the button the center action is executed and zoom level is set to 2.

@dhuebner
Copy link
Contributor

dhuebner commented Mar 3, 2023

@jonah-iden
Thanks! It works very well.
Btw. there are key bindings for center: 'KeyC', 'ctrlCmd', 'shift' and focus: 'KeyF', 'ctrlCmd', 'shift', maybe we can show them in the circles example. What do you think if we print this short cuts in the right bottom in the same color as © 2017 ? We should probably also change 2017 to © 2017-2023 or just © 2023

@dhuebner dhuebner merged commit 1996803 into eclipse-sprotty:master Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants