configureViewerOption does not take effect in glsp-examples #1591
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
I'm not sure if my usage is incorrect because I can't find any examples of how |
Beta Was this translation helpful? Give feedback.
-
|
export function configureDiagramOptions(
context: BindingContext,
diagramOptions: IDiagramOptions,
viewerOptions?: Partial<ViewerOptions>
): void {
configureViewerOptions(context, {
baseDiv: diagramOptions.clientId,
hiddenDiv: diagramOptions.clientId + '_hidden',
zoomLimits: { min: 0.1, max: 20 },
...viewerOptions
});
context.bind(TYPES.IDiagramOptions).toConstantValue(diagramOptions);
}
as the function configureDiagramOptions shows, when you call
configureDiagramOptions, and if you give zoomLimits in viewerOptions, this
value will override the default value({min: 0.1, max: 20}).
actually the glsp examples show the usage, in
file examples/workflow-standalone/src/di.config.ts
(via createDiagramOptionsModule, then createDiagramOptionsModule calls
configureDiagramOptions).
you can try to give the value here and see what will happen.
330GRX ***@***.***> 于2025年10月14日周二 17:37写道:
… I'm not sure if my usage is incorrect because I can't find any examples of
how configureViewerOption is used. If my usage is wrong, could someone
teach me? Thank you very much🙇🙇🙇🙏🙏🙏 .
—
Reply to this email directly, view it on GitHub
<#1591 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2HZ6U7ZRXVGD65Y3X5VF33XS76PAVCNFSM6AAAAACJD7MN66VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINRXGQYDOMY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
As @GazeboXu already mentioned (thanks!) there are a few helper functions that can be used to define the viewer options. By default, those options are always optional, cf. createDiagramOptionsModule or configureDiagramOptions. You can see the usage in the workflow standalone example. I believe that in your case the viewer options are probably overwritten again so you need to make sure that the module in which you define the viewer options is not loaded before the default viewer options module. From your code it seems that you added the configuration to the The good news is that most integrations that you can use (vscode, Theia, etc.) already provide hooks to create the diagram options module, e.g., GLSPStarter in VS Code or GLSPDiagramConfiguration in Theia. In general it is a good idea to look for that hook as there might be some other viewer options specific to that integration that we do not want to have overwritten. What integration are you using? |
Beta Was this translation helpful? Give feedback.



I see, so in that case you are in the Theia integration and you need to adapt the diagram configuration which creates the diagram options module, i.e., you should be able to do something like this: