-
Hi, I am having the requirement of displaying GLSP editor's canvas zoom level on the bottom right of the editor(as shown in the snap). Requirement
Requesting suggestions to implement the same. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi, in general, you can get the current zoom level using the function However, you will probably need to be notified on zoom level changes. So one approach could be to register an action handler for the configureActionHandler(context, SetViewportAction.KIND, YourActionHandler); In this action handler you can obtain the current zoom level from the parameter For the UI itself I would suggest to create a UIExtension which is plain HTML that can be statically placed on the diagram canvas. This UI extension could now either get some custom service injected to which your action handler from above publishes the zoom level info, or your UI extension could be the action handler itself. Hope this helps! |
Beta Was this translation helpful? Give feedback.
Hi,
in general, you can get the current zoom level using the function
getZoom(modelElement)
which can be imported fromimport { getZoom } from '@eclipse-glsp/client';
.However, you will probably need to be notified on zoom level changes. So one approach could be to register an action handler for the
SetViewportAction
. Register it into the di module (di.config.ts
):In this action handler you can obtain the current zoom level from the parameter
newViewport
from which you can obtain the zoom level and update it in the UI.For the UI itself I would suggest to create a UIExtension which is plain HTML that can be static…