mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
Fix stuck outline overlay (#925)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
3bce11edb5
commit
af7779769a
1 changed files with 23 additions and 1 deletions
|
|
@ -21,7 +21,7 @@ pub struct PathOutline {
|
|||
|
||||
impl PathOutline {
|
||||
/// Creates an outline of a layer either with a pre-existing overlay or by generating a new one
|
||||
fn create_outline(
|
||||
fn try_create_outline(
|
||||
document_layer_path: Vec<LayerId>,
|
||||
overlay_path: Option<Vec<LayerId>>,
|
||||
document: &DocumentMessageHandler,
|
||||
|
|
@ -72,6 +72,28 @@ impl PathOutline {
|
|||
Some(overlay)
|
||||
}
|
||||
|
||||
/// Creates an outline of a layer either with a pre-existing overlay or by generating a new one
|
||||
///
|
||||
/// Creates an outline, discarding the overlay on failiure
|
||||
fn create_outline(
|
||||
document_layer_path: Vec<LayerId>,
|
||||
overlay_path: Option<Vec<LayerId>>,
|
||||
document: &DocumentMessageHandler,
|
||||
responses: &mut VecDeque<Message>,
|
||||
font_cache: &FontCache,
|
||||
) -> Option<Vec<LayerId>> {
|
||||
let copied_overlay_path = overlay_path.clone();
|
||||
let result = Self::try_create_outline(document_layer_path, overlay_path, document, responses, font_cache);
|
||||
if result.is_none() {
|
||||
// Discard the overlay layer if it exists
|
||||
if let Some(overlay_path) = copied_overlay_path {
|
||||
let operation = Operation::DeleteLayer { path: overlay_path };
|
||||
responses.push_back(DocumentMessage::Overlays(operation.into()).into());
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/// Removes the hovered overlay and deletes path references
|
||||
pub fn clear_hovered(&mut self, responses: &mut VecDeque<Message>) {
|
||||
if let Some(path) = self.hovered_overlay_path.take() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue