mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 08:48:11 +08:00
Insert pasted images as layers in document graph (#1418)
Changes: Graph is evaluated on every viewport change move all navigation logic into the viewport reduce the number of js roundtrips add canvas rendering enable image pasting various cleanups Fix cache nodes being reset every evaluation
This commit is contained in:
committed by
Keavon Chambers
parent
d82f133514
commit
833f41bccb
@@ -4,8 +4,10 @@ use crate::messages::prelude::*;
|
||||
use bezier_rs::{ManipulatorGroup, Subpath};
|
||||
use document_legacy::{document::Document, document_metadata::LayerNodeIdentifier, LayerId, Operation};
|
||||
use graph_craft::document::{value::TaggedValue, DocumentNode, NodeId, NodeInput, NodeNetwork};
|
||||
use graphene_core::raster::ImageFrame;
|
||||
use graphene_core::uuid::ManipulatorGroupId;
|
||||
use graphene_core::vector::style::{FillType, Gradient};
|
||||
use graphene_core::Color;
|
||||
|
||||
use glam::DAffine2;
|
||||
use std::collections::VecDeque;
|
||||
@@ -18,6 +20,14 @@ pub fn new_vector_layer(subpaths: Vec<Subpath<ManipulatorGroupId>>, layer_path:
|
||||
});
|
||||
}
|
||||
|
||||
/// Creat a new bitmap layer from an [`graphene_core::raster::ImageFrame<Color>`]
|
||||
pub fn new_image_layer(image_frame: ImageFrame<Color>, layer_path: Vec<LayerId>, responses: &mut VecDeque<Message>) {
|
||||
responses.add(GraphOperationMessage::NewBitmapLayer {
|
||||
id: *layer_path.last().unwrap(),
|
||||
image_frame,
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a legacy node graph frame TODO: remove
|
||||
pub fn new_custom_layer(network: NodeNetwork, layer_path: Vec<LayerId>, responses: &mut VecDeque<Message>) {
|
||||
responses.add(DocumentMessage::DeselectAllLayers);
|
||||
|
||||
@@ -393,8 +393,7 @@ impl Fsm for PathToolFsmState {
|
||||
};
|
||||
remove_bounding_box(tool_data.drag_box_overlay_layer.take(), responses);
|
||||
|
||||
PathToolFsmState::Ready
|
||||
|
||||
PathToolFsmState::Ready
|
||||
}
|
||||
|
||||
// Mouse up
|
||||
@@ -410,7 +409,8 @@ impl Fsm for PathToolFsmState {
|
||||
remove_bounding_box(tool_data.drag_box_overlay_layer.take(), responses);
|
||||
|
||||
responses.add(PathToolMessage::SelectedPointUpdated);
|
||||
}
|
||||
PathToolFsmState::Ready
|
||||
}
|
||||
|
||||
(_, PathToolMessage::DragStop { shift_mirror_distance }) => {
|
||||
let shift_pressed = input.keyboard.get(shift_mirror_distance as usize);
|
||||
|
||||
Reference in New Issue
Block a user