-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #87 Scene appears to delete wrong item #97
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, could you rebase on top of main & squash to maybe 2 commits (1 for the actual fix, one for the refactor?).
Makes easier to work with
8202f19
to
e3950bd
Compare
Rebase done and the changes requested. Not sure I understand what you mean by squashing to a fix commit and a refactor commit. Really, there wasn't a fix as such - the refactor removed the issue (using only one vector, so no need to synchronise them) |
Closes #87
ElementViewList
maintained astd::vector<ElementView*> elements_;
, andElementsContainer
also maintained astd::vector<std::shared_ptr<ElementView>> elements;
- these could get out of sync, and hence why the UI appeared to be deleting the wrong item.The easy fix would have been to modify the
JuceSceneFrontendConnector::elementMoved
method to ensure it updates the ordering of vector elements in theElementViewList
(which it already did) AND the vector of elements inElementsContainer
such that the indices always matched and operations were always enacted on the correct vector elements.However, it seemed redundant to me to be maintaining two vectors. It seems much more logical to just use the vector in
ElementsContainer
, and all operations concerning adding, moving and removing elements to be handled byElementsContainer
(this also meant moving the listeners toElementsContainer
too).