fix: confirm selection when object is removed (#1197)

This commit is contained in:
Tobias Linsefors
2023-03-29 14:50:13 +02:00
committed by GitHub
parent bb82663c84
commit 9ca11fe5eb

View File

@@ -232,6 +232,12 @@ export default function useObjectSelections(app, model, elements, options) {
objectSelections.addListener('deactivated', deactivateClickOut);
return () => {
// confirm selection before removing event handler
// to end the selection when the object is removed
// and remove the (ClickOut) mousedown handler from the document
if (objectSelections.isActive()) {
objectSelections.confirm();
}
objectSelections.removeListener('activated', activateClickOut);
objectSelections.removeListener('deactivated', deactivateClickOut);
};