implement top-left positioning for elements based on x and y values #988
-
Hello everyone, I have recently completed a task in which I added two input fields called "x" and "y" for each element that could be drawn in my view from the tool palette. These fields represent the position of the element on the view. However, the project owner has come up with a new demand, he wants me to modify the behavior such that when the user types I am seeking advice on how to approach this modification. What are some best practices for implementing this behavior? Any help would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @Adem-Kri,
ValidationFor input validation you could reuse the const requestAction= RequestEditValidationAction.create({ contextId: 'label-edit', modelElementId: 'yourInputId', text: '100' });
const result= await this.actionDispatcher.requestUntil<SetEditValidationResultAction>(action);
// show result in your decorator On the server side you can then implement and bind a Triggering an operationAfter a successful edit (i.e. inputing a valid value) you have to dispatch the corresponding (Note if you don't want to reuse the LabelEdit API you could also implement custom actions for this) |
Beta Was this translation helpful? Give feedback.
Ah, I see, the 0; 0 isn't relative to an intermediate parent, but to the graph itself.
The solution in that case is very similar, except you can ignore the parent/compartment/layout issues. The Graph always places its children based on their position.x / y attribute.
So you can simply make sure these nodes derive their position.x/y attributes from your underlying model, when creating them from the GModelFactory.
The resulting graph model should look like this (minimal example):