Add properties panel entries for artboards (#572)

* Artboards can have properties

* fix crash when renaming artboards

* moved target document to utility types

* moved import and added test for file version information

* fixed missing import

* fix error from merging

* - typed properties message handler data
- removed name from WidgetRow

* clippy warnings

* artboards have seperate properties section

* - color input can be forced to have selection
- crop tool shows on switch
- select tool shows on switch

* variable renamed

* change to use PropType<boolean> instead of PropType<Boolean>

* Add an artboard icon

* Add the "Delete Artboard" hint

* fix unselect glitch

* even better

* Remove the Transform properties group

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
mfish33
2022-04-20 18:42:32 -07:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent c7e80180c2
commit e01f0081a9
22 changed files with 367 additions and 75 deletions
@@ -3,6 +3,7 @@ use crate::message_prelude::*;
use graphene::color::Color;
use graphene::document::Document as GrapheneDocument;
use graphene::layers::style::{self, Fill, ViewMode};
use graphene::DocumentResponse;
use graphene::Operation as DocumentOperation;
use glam::DAffine2;
@@ -31,7 +32,18 @@ impl MessageHandler<ArtboardMessage, ()> for ArtboardMessageHandler {
// Sub-messages
#[remain::unsorted]
DispatchOperation(operation) => match self.artboards_graphene_document.handle_operation(*operation) {
Ok(_) => (),
Ok(Some(document_responses)) => {
for response in document_responses {
match &response {
DocumentResponse::LayerChanged { path } => responses.push_back(PropertiesPanelMessage::CheckSelectedWasUpdated { path: path.clone() }.into()),
DocumentResponse::DeletedLayer { path } => responses.push_back(PropertiesPanelMessage::CheckSelectedWasDeleted { path: path.clone() }.into()),
DocumentResponse::DocumentChanged => responses.push_back(ArtboardMessage::RenderArtboards.into()),
_ => {}
};
responses.push_back(ToolMessage::DocumentIsDirty.into());
}
}
Ok(None) => {}
Err(e) => log::error!("Artboard Error: {:?}", e),
},