- Home
- Forum
- Angular - EJ 2
- positionChange and node
positionChange and node
Hi
I'm using the diagram with bpmn objects. When I drag an Activity node I use the positionChange event to move any connected DataObject nodes by the same amount. I do this by setting the offsetX and offsetY when args.state === 'Completed'.
The problem is, if I then press Undo, my Activity node moves back to where it started but the DataObjects do not. Further it would seem that their movement wasn't logged so there is no ability to 'Undo' the change to change of position for the Data Objects that moved.
My preference would be that everything moves back in one 'Undo' but I'm open to other ideas.
Thoughts?
Hi,
We have created a sample to check the reported issue. The DataObject nodes are also able to undo and redo like other nodes. We could not replicate the issue. Please refer to the sample below and video. If you still face any issues, modify the sample to replicate the issue so that we can validate and provide you with more details.
Regards,
Vivisa
Attachment: UndoRedo_438abc7.zip
Hi! Thanks for the setting up the stackblitz.
Here is a stackblitz that demonstrates the issue:
https://stackblitz.com/edit/angular-m3k8ei-xdnby2?file=src%2Fapp.component.ts
I also attached a video. Notice how when I 'undo' near the end of the video with Ctrl Z that the data object does not undo.
I also reposted my original text below but BOLDED the important parts.
I think that that Data Object should also 'undo'
-----
I'm using the diagram with bpmn objects. When I drag an Activity node I use the positionChange event to move any connected DataObject nodes by the same amount. I do this by setting the offsetX and offsetY when args.state === 'Completed'.
The problem is, if I then press Undo, my Activity node moves back to where it started but the DataObjects do not. Further it would seem that their movement wasn't logged so there is no ability to 'Undo' the change to change of position for the Data Objects that moved.
My preference would be that everything moves back in one 'Undo' but I'm open to other ideas.
Attachment: no_undo_eac11c85.zip
Hi,
We will validate and update you with more details on August 6,2024.
Regards,
Vivisa
Hi kabe,
We have prepared a sample to meet your requirements. To capture the property changes of the connected DataObject node while changing the position of the selected node in the position change event, use the setTimeout function. Set the new values to the DataObject node, which should be retrieved from the diagram nodes collection by iterating through the diagram nodes collection and connected nodes' IDs. Please refer to the sample for reference.
Sample : https://stackblitz.com/edit/angular-m3k8ei-nfvfrd?file=src%2Fapp.component.ts
Best Regards,
Moulidharan
Hi - that interesting. It's a good idea but if I set the timeout to 100 or even 1000 and move my node around a few times the attached DataObject doesn't undo properly.
Plus ideally I'd want to use historyManager.startGroupAction() and historyManager.endGroupAction() so that a single undo would undo the position change of both nodes at the same time.
Can you give me an idea of what's going on here? Why is a work around needed in the first place?
Hi,
Please note that during the position change event, external property changes are ignored and are not pushed to the undo stack. This event only captures interactive changes in the diagram, not code-level modifications; only the PositionChanged entry is added. To capture changes made during the position change event, we recommend using a timeout to add the changes as property modifications. If you require both types of changes to be captured, we will analyze the feasibility of implementing a custom undo/redo function and update you by August 16th, 2024.
Regards,
Moulidharan
Thanks a bunch for the explanation. Now I can at least understand what is happening.
I do think it would be ideal if it were possible to capture the 'non-interactive' position changes so I will stand by and see what you say on August 16th.
Thanks!
Hi,
On further analysis, we found that it is not possible to push the non-interactive changes to the undo stack. As we mentioned earlier, you should use setTimeout to capture the property changes of the connected DataObject node while changing the position of the selected node in the position change event.
Regards,
Chella Dhurai
- 8 Replies
- 4 Participants
-
KA Kabe
- Jul 31, 2024 03:45 PM UTC
- Aug 21, 2024 11:31 AM UTC