Andrei486 / uml-diagram-collab

0 stars 0 forks source link

Remove previews when an element is deleted #87

Closed Andrei486 closed 7 months ago

Andrei486 commented 7 months ago

Resolves https://github.com/Andrei486/uml-diagram-collab/issues/72.

Needs testing with multiple users. Tested locally by alt-tabbing during move and resize operations, which keeps the previews open, and then deleting the element without resuming the operation. The preview is deleted in both cases as expected.

This change requires that from now on, all FXMLs corresponding to DiagramElements expose their controller in the node's properties - previously only the connector did for different reasons. Without this, the preview removal will not work, but nothing should break.

Example of how to expose the controller in FXML:

<properties>
    <!-- Set controller as property so commands can find it-->
    <controller><fx:reference source="controller"/></controller>
</properties>

The element ID manager has been updated so it can find controllers from IDs, and the remove command uses this to remove all previews from the removed elements before removing the elements themselves.