Fixes for removing artboards; white infinite canvas background (#1497)

* Fix crash when drawing on a deleted artboard

* Fix clear artboards button

* White background on no artboards

* Re-disable Clear Artboards since it still crashes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2023-12-10 00:17:18 +00:00
committed by GitHub
parent 33845707db
commit b60736c2c6
6 changed files with 43 additions and 4 deletions

View File

@@ -296,7 +296,6 @@ impl MessageHandler<DocumentMessage, DocumentInputs<'_>> for DocumentMessageHand
info!("{:#?}\n{:#?}", self.document_legacy, self.layer_metadata);
}
DeleteLayer { layer_path } => {
responses.add_front(DocumentOperation::DeleteLayer { path: layer_path.clone() });
responses.add(GraphOperationMessage::DeleteLayer { id: layer_path[0] });
responses.add_front(BroadcastEvent::ToolAbort);
responses.add(PropertiesPanelMessage::CheckSelectedWasDeleted { path: layer_path });

View File

@@ -709,6 +709,7 @@ impl MessageHandler<GraphOperationMessage, (&mut Document, &mut NodeGraphMessage
GraphOperationMessage::DeleteLayer { id } => {
let mut modify_inputs = ModifyInputsContext::new(document, node_graph, responses);
modify_inputs.delete_layer(id);
document.load_network_structure();
}
GraphOperationMessage::ClearArtboards => {
let mut modify_inputs = ModifyInputsContext::new(document, node_graph, responses);

View File

@@ -48,6 +48,10 @@ impl Resize {
let Some(layer) = self.layer else {
return None;
};
if !document.network().nodes.contains_key(&layer.to_node()) {
self.layer.take();
return None;
}
let mut start = self.viewport_drag_start(document);
let stop = self.snap_manager.snap_position(responses, document, ipp.mouse.position);