Closed a22jacka closed 6 months ago
What I find is that the variable "felem" is undefined on the line 7430. Also find that the actors but also the diagrams get a negative value on the width when you ctrl+z after you change the size. It seems like it gets the same result when you move the actor/ diagrams around first then ctrl+z.
Observations:
After placing an element on the diagram then reselecting it with the pointer to adjust its size, the selection is somehow still on the element or somehow the resized elements was placed in an array or clumped together with the last placed element, which after pressing CTRL+Z, removes the it along with all the other elements which have had their sizes changed using the pointer.
EDIT: attaching video to demonstrate clearer.
https://github.com/HGustavs/LenaSYS/assets/129370135/1c301bed-cb05-425e-aaf1-e2764143d7e4
Another example but with ER entity, to show that it doesn't affect just one specific element, but all that are resized.
https://github.com/HGustavs/LenaSYS/assets/129370135/8220174f-6f25-4ab0-b724-6a0cd2c9139e
On closer inspection, it seems the code enters (around line 499) scrubHistory() and then gotoInitialState() (around line 614) where the problem lies. It seems after a resize of elements, their new widths and heights are not kept/saved here, but are wiped, and so when elements are getting redrawn, the elements with unknown sizes has both their widths and heights set to 0 (or sometimes 1), making them "disappear".
Changed size to 200px in width and 100px in height:
And here is the same element on the diagram after manually resizing it:
Therefore the problem lies not with some type of misselection as previously thought, but with the history log/array not having all information needed to redraw the elements properly.
Below is a code snippet that shows a change of 7 x coordinates and a width change of 1. This may seem weird but when an element is resized, it does so a few pixels at a time when the user drags the mouse to reduce/expand the size.
It seems that this is not actually where the problem lies (or might be, hard to tell, but most probabluy not).
Additionally, it seems that after resizing an element then pressing CTRL+Z (which will cause the resized element(s) to disappear), it also breaks the diagram in the way that if you still have a placable element, you can still place it, however you cannot change tool to use, whether by clicking the tool in the toolbar with the mouse cursor or by using the keybindings. it will cause the cursor to lose the active placable element and nothing will react to the cursor at all. E.g. placed elements that were not resized will not react when clicked upon, and pressing other tools in the toolbar will not work either.
I still cannot find the solution to this issue but I believe it lies somewhere in StateMachine.save(). So,I will leave this and hope for the best for the next person that is assigned this monstrosity. Good luck!
Will continue working on this issue after weekly merge. A new issue will be created and linked to this.
Description
When using ctrl + z removes every lifelife along with the latest element
The most recently changed is the activtion furthest right
After ctrl + z the latest element and every lifeline are removed
Job
Make it so that ctrl + z don't remove lifelines