Update UI when deleting last point of shape with Path tool (#979)

* Added new DocumentResponse variant

* Update Operation::DeleteSelectedManipulatorPoints to update Layer Tree by delegating deletion to Operation::DeleteLayer. Also emits Operation::DeletedSelectedManipulatorPoints to let editor clear Properties panel

* Update process_message() to deal with new DocumentResponse::DeletedSelectedManipulatorPoints match case. When this DocumentResponse is emitted, it clears the Properties panel.

* Added Display trait implementation for DocumentResponse::DeletedSelectedManipulatorPoints. Updated imports in document_message_handler.rs to get the correct types for messages emitted from DocumentResponse::DeletedSelectedManipulatorPoints match case in process_message().

* Removed useless import. Capitalized comments for style consistency.

* Updated messages emitted to clear Properties panel by emitting LayoutMessage::SendLayout's instead, which update the backend widget state

* Revert inclusion of unused imports

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
kadir
2023-01-28 18:32:31 -05:00
committed by Keavon Chambers
parent 43b75dab52
commit abe3470627
3 changed files with 29 additions and 4 deletions

View File

@@ -143,6 +143,23 @@ impl MessageHandler<DocumentMessage, (u64, &InputPreprocessorMessageHandler, &Pe
);
}
DocumentResponse::DocumentChanged => responses.push_back(RenderDocument.into()),
DocumentResponse::DeletedSelectedManipulatorPoints => {
// Clear Properties panel after deleting all points by updating backend widget state.
responses.push_back(
LayoutMessage::SendLayout {
layout: Layout::WidgetLayout(WidgetLayout::new(vec![])),
layout_target: LayoutTarget::PropertiesOptions,
}
.into(),
);
responses.push_back(
LayoutMessage::SendLayout {
layout: Layout::WidgetLayout(WidgetLayout::new(vec![])),
layout_target: LayoutTarget::PropertiesSections,
}
.into(),
);
}
};
responses.push_back(BroadcastEvent::DocumentIsDirty.into());
}