mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 06:58:11 +08:00
Remove most of document-legacy (#1519)
* Remove boolean ops and unused doc-legacy Operations * Remove Shape legacy layers * Remove legacy layer Properties panel code * Remove additional unused doc-legacy Operations * Removed unused rendering-related legacy-layer code * Upgrade dep so CI builds * Remove various additional unused functions and messages * Remove the LayerData trait * Remove RenderData struct and usages * Banish the Operations system * Further removals
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::messages::portfolio::document::node_graph::VectorDataModification;
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
use bezier_rs::{ManipulatorGroup, Subpath};
|
||||
use document_legacy::{document::Document, document_metadata::LayerNodeIdentifier, LayerId, Operation};
|
||||
use document_legacy::{document::Document, document_metadata::LayerNodeIdentifier};
|
||||
use graph_craft::document::{value::TaggedValue, DocumentNode, NodeId, NodeInput, NodeNetwork};
|
||||
use graphene_core::raster::{BlendMode, ImageFrame};
|
||||
use graphene_core::text::Font;
|
||||
@@ -10,7 +10,7 @@ use graphene_core::uuid::ManipulatorGroupId;
|
||||
use graphene_core::vector::style::{FillType, Gradient};
|
||||
use graphene_core::Color;
|
||||
|
||||
use glam::{DAffine2, DVec2};
|
||||
use glam::DVec2;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
/// Create a new vector layer from a vector of [`bezier_rs::Subpath`].
|
||||
@@ -34,18 +34,6 @@ pub fn new_image_layer(image_frame: ImageFrame<Color>, id: NodeId, parent: Layer
|
||||
LayerNodeIdentifier::new_unchecked(id)
|
||||
}
|
||||
|
||||
/// 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);
|
||||
responses.add(Operation::AddFrame {
|
||||
path: layer_path.clone(),
|
||||
insert_index: -1,
|
||||
transform: DAffine2::ZERO.to_cols_array(),
|
||||
network,
|
||||
});
|
||||
responses.add(DocumentMessage::InputFrameRasterizeRegionBelowLayer { layer_path });
|
||||
}
|
||||
|
||||
/// Batch set all of the manipulator groups to mirror on a specific layer
|
||||
pub fn set_manipulator_mirror_angle(manipulator_groups: &[ManipulatorGroup<ManipulatorGroupId>], layer: LayerNodeIdentifier, mirror_angle: bool, responses: &mut VecDeque<Message>) {
|
||||
for manipulator_group in manipulator_groups {
|
||||
@@ -77,12 +65,6 @@ pub fn get_pivot(layer: LayerNodeIdentifier, document: &Document) -> Option<DVec
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_document_pivot(layer: LayerNodeIdentifier, document: &Document) -> DVec2 {
|
||||
let [min, max] = document.metadata.nonzero_bounding_box(layer);
|
||||
let pivot = get_pivot(layer, document).unwrap_or(DVec2::splat(0.5));
|
||||
document.metadata.transform_to_document(layer).transform_point2(min + (max - min) * pivot)
|
||||
}
|
||||
|
||||
pub fn get_viewport_pivot(layer: LayerNodeIdentifier, document: &Document) -> DVec2 {
|
||||
let [min, max] = document.metadata.nonzero_bounding_box(layer);
|
||||
let pivot = get_pivot(layer, document).unwrap_or(DVec2::splat(0.5));
|
||||
@@ -234,25 +216,6 @@ impl<'a> NodeGraphLayer<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the nearest layer node from the path and the document
|
||||
pub fn new_from_path(layer: &[LayerId], document: &'a document_legacy::document::Document) -> Option<Self> {
|
||||
let node_graph = &document.document_network;
|
||||
let outwards_links = document.document_network.collect_outwards_links();
|
||||
|
||||
let Some(mut layer_node) = layer.last().copied() else {
|
||||
error!("Tried to modify root layer");
|
||||
return None;
|
||||
};
|
||||
while !node_graph.nodes.get(&layer_node)?.is_layer() {
|
||||
layer_node = outwards_links.get(&layer_node)?.first().copied()?;
|
||||
}
|
||||
Some(Self {
|
||||
node_graph,
|
||||
_outwards_links: outwards_links,
|
||||
layer_node,
|
||||
})
|
||||
}
|
||||
|
||||
/// Return an iterator up the primary flow of the layer
|
||||
pub fn primary_layer_flow(&self) -> impl Iterator<Item = (&'a DocumentNode, u64)> {
|
||||
self.node_graph.upstream_flow_back_from_nodes(vec![self.layer_node], true)
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::messages::prelude::*;
|
||||
use crate::messages::tool::common_functionality::snapping::SnapManager;
|
||||
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use document_legacy::layers::style::RenderData;
|
||||
|
||||
use glam::{DAffine2, DVec2, Vec2Swizzles};
|
||||
|
||||
@@ -17,16 +16,16 @@ pub struct Resize {
|
||||
|
||||
impl Resize {
|
||||
/// Starts a resize, assigning the snap targets and snapping the starting position.
|
||||
pub fn start(&mut self, responses: &mut VecDeque<Message>, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler, render_data: &RenderData) {
|
||||
self.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
pub fn start(&mut self, responses: &mut VecDeque<Message>, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler) {
|
||||
self.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
self.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
let root_transform = document.metadata().document_to_viewport;
|
||||
self.drag_start = root_transform.inverse().transform_point2(self.snap_manager.snap_position(responses, document, input.mouse.position));
|
||||
}
|
||||
|
||||
/// Recalculates snap targets without snapping the starting position.
|
||||
pub fn recalculate_snaps(&mut self, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler, render_data: &RenderData) {
|
||||
self.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
pub fn recalculate_snaps(&mut self, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler) {
|
||||
self.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
self.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,8 @@ use super::shape_editor::ManipulatorPointInfo;
|
||||
use crate::consts::{SNAP_AXIS_TOLERANCE, SNAP_POINT_TOLERANCE};
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use document_legacy::document::LayerId;
|
||||
use document_legacy::layers::layer_info::LegacyLayer;
|
||||
use document_legacy::LayerId;
|
||||
use graphene_core::vector::{ManipulatorPointId, SelectedType};
|
||||
|
||||
use glam::DVec2;
|
||||
|
||||
@@ -109,42 +107,44 @@ impl SnapManager {
|
||||
/// This should be called after start_snap
|
||||
pub fn add_snap_path(
|
||||
&mut self,
|
||||
document_message_handler: &DocumentMessageHandler,
|
||||
input: &InputPreprocessorMessageHandler,
|
||||
layer: &LegacyLayer,
|
||||
path: &[LayerId],
|
||||
include_handles: bool,
|
||||
ignore_points: &[ManipulatorPointInfo],
|
||||
_document_message_handler: &DocumentMessageHandler,
|
||||
_input: &InputPreprocessorMessageHandler,
|
||||
_layer: &LegacyLayer,
|
||||
_path: &[LayerId],
|
||||
_include_handles: bool,
|
||||
_ignore_points: &[ManipulatorPointInfo],
|
||||
) {
|
||||
let Some(vector_data) = &layer.as_vector_data() else { return };
|
||||
todo!();
|
||||
|
||||
if !document_message_handler.snapping_state.node_snapping {
|
||||
return;
|
||||
};
|
||||
// let Some(vector_data) = &layer.as_vector_data() else { return };
|
||||
|
||||
let transform = document_message_handler.document_legacy.multiply_transforms(path).unwrap();
|
||||
let snap_points = vector_data
|
||||
.manipulator_groups()
|
||||
.flat_map(|group| {
|
||||
if include_handles {
|
||||
[
|
||||
Some((ManipulatorPointId::new(group.id, SelectedType::Anchor), group.anchor)),
|
||||
group.in_handle.map(|pos| (ManipulatorPointId::new(group.id, SelectedType::InHandle), pos)),
|
||||
group.out_handle.map(|pos| (ManipulatorPointId::new(group.id, SelectedType::OutHandle), pos)),
|
||||
]
|
||||
} else {
|
||||
[Some((ManipulatorPointId::new(group.id, SelectedType::Anchor), group.anchor)), None, None]
|
||||
}
|
||||
})
|
||||
.flatten()
|
||||
.filter(|&(point_id, _)| {
|
||||
!ignore_points.contains(&ManipulatorPointInfo {
|
||||
layer: LayerNodeIdentifier::from_path(path, document_message_handler.network()),
|
||||
point_id,
|
||||
})
|
||||
})
|
||||
.map(|(_, pos)| transform.transform_point2(pos));
|
||||
self.add_snap_points(document_message_handler, input, snap_points);
|
||||
// if !document_message_handler.snapping_state.node_snapping {
|
||||
// return;
|
||||
// };
|
||||
|
||||
// let transform = document_message_handler.document_legacy.multiply_transforms(path).unwrap();
|
||||
// let snap_points = vector_data
|
||||
// .manipulator_groups()
|
||||
// .flat_map(|group| {
|
||||
// if include_handles {
|
||||
// [
|
||||
// Some((ManipulatorPointId::new(group.id, SelectedType::Anchor), group.anchor)),
|
||||
// group.in_handle.map(|pos| (ManipulatorPointId::new(group.id, SelectedType::InHandle), pos)),
|
||||
// group.out_handle.map(|pos| (ManipulatorPointId::new(group.id, SelectedType::OutHandle), pos)),
|
||||
// ]
|
||||
// } else {
|
||||
// [Some((ManipulatorPointId::new(group.id, SelectedType::Anchor), group.anchor)), None, None]
|
||||
// }
|
||||
// })
|
||||
// .flatten()
|
||||
// .filter(|&(point_id, _)| {
|
||||
// !ignore_points.contains(&ManipulatorPointInfo {
|
||||
// layer: LayerNodeIdentifier::from_path(path, document_message_handler.network()),
|
||||
// point_id,
|
||||
// })
|
||||
// })
|
||||
// .map(|(_, pos)| transform.transform_point2(pos));
|
||||
// self.add_snap_points(document_message_handler, input, snap_points);
|
||||
}
|
||||
|
||||
/// Adds all of the shape handles in the document, including bézier handles of the points specified
|
||||
|
||||
@@ -7,7 +7,6 @@ use crate::messages::prelude::*;
|
||||
use crate::messages::tool::utility_types::ToolType;
|
||||
use crate::node_graph_executor::NodeGraphExecutor;
|
||||
|
||||
use document_legacy::layers::style::RenderData;
|
||||
use graphene_core::raster::color::Color;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
@@ -25,7 +24,7 @@ impl MessageHandler<ToolMessage, (&DocumentMessageHandler, u64, &InputPreprocess
|
||||
responses: &mut VecDeque<Message>,
|
||||
(document, document_id, input, persistent_data, node_graph): (&DocumentMessageHandler, u64, &InputPreprocessorMessageHandler, &PersistentData, &NodeGraphExecutor),
|
||||
) {
|
||||
let render_data = RenderData::new(&persistent_data.font_cache, document.view_mode, None);
|
||||
let font_cache = &persistent_data.font_cache;
|
||||
|
||||
#[remain::sorted]
|
||||
match message {
|
||||
@@ -89,7 +88,7 @@ impl MessageHandler<ToolMessage, (&DocumentMessageHandler, u64, &InputPreprocess
|
||||
document_id,
|
||||
global_tool_data: &self.tool_state.document_tool_data,
|
||||
input,
|
||||
render_data: &render_data,
|
||||
font_cache,
|
||||
shape_editor: &mut self.shape_editor,
|
||||
node_graph,
|
||||
};
|
||||
@@ -171,7 +170,7 @@ impl MessageHandler<ToolMessage, (&DocumentMessageHandler, u64, &InputPreprocess
|
||||
document_id,
|
||||
global_tool_data: &self.tool_state.document_tool_data,
|
||||
input,
|
||||
render_data: &render_data,
|
||||
font_cache,
|
||||
shape_editor: &mut self.shape_editor,
|
||||
node_graph,
|
||||
};
|
||||
@@ -241,7 +240,7 @@ impl MessageHandler<ToolMessage, (&DocumentMessageHandler, u64, &InputPreprocess
|
||||
document_id,
|
||||
global_tool_data: &self.tool_state.document_tool_data,
|
||||
input,
|
||||
render_data: &render_data,
|
||||
font_cache,
|
||||
shape_editor: &mut self.shape_editor,
|
||||
node_graph,
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::messages::tool::common_functionality::snapping::SnapManager;
|
||||
use crate::messages::tool::common_functionality::transformation_cage::*;
|
||||
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use document_legacy::layers::RenderData;
|
||||
|
||||
use glam::{IVec2, Vec2Swizzles};
|
||||
|
||||
@@ -117,13 +116,11 @@ impl ArtboardToolData {
|
||||
Some(edges)
|
||||
}
|
||||
|
||||
fn start_resizing(&mut self, selected_edges: (bool, bool, bool, bool), document: &DocumentMessageHandler, render_data: &RenderData, input: &InputPreprocessorMessageHandler) {
|
||||
fn start_resizing(&mut self, selected_edges: (bool, bool, bool, bool), document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler) {
|
||||
let snap_x = selected_edges.2 || selected_edges.3;
|
||||
let snap_y = selected_edges.0 || selected_edges.1;
|
||||
|
||||
let artboard = self.selected_artboard.unwrap();
|
||||
self.snap_manager
|
||||
.start_snap(document, input, document.bounding_boxes(None, Some(artboard.to_node()), render_data), snap_x, snap_y);
|
||||
self.snap_manager.start_snap(document, input, document.bounding_boxes(), snap_x, snap_y);
|
||||
self.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
|
||||
if let Some(bounds) = &mut self.bounding_box_manager {
|
||||
@@ -131,7 +128,7 @@ impl ArtboardToolData {
|
||||
}
|
||||
}
|
||||
|
||||
fn select_artboard(&mut self, document: &DocumentMessageHandler, render_data: &RenderData, input: &InputPreprocessorMessageHandler, responses: &mut VecDeque<Message>) -> bool {
|
||||
fn select_artboard(&mut self, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler, responses: &mut VecDeque<Message>) -> bool {
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
|
||||
let mut intersections = document
|
||||
@@ -143,15 +140,14 @@ impl ArtboardToolData {
|
||||
if let Some(intersection) = intersections.next() {
|
||||
self.selected_artboard = Some(intersection);
|
||||
|
||||
self.snap_manager
|
||||
.start_snap(document, input, document.bounding_boxes(None, Some(intersection.to_node()), render_data), true, true);
|
||||
self.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
self.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
|
||||
true
|
||||
} else {
|
||||
self.selected_artboard = None;
|
||||
|
||||
responses.add(PropertiesPanelMessage::ClearSelection);
|
||||
responses.add(PropertiesPanelMessage::Clear);
|
||||
|
||||
false
|
||||
}
|
||||
@@ -183,7 +179,7 @@ impl Fsm for ArtboardToolFsmState {
|
||||
type ToolOptions = ();
|
||||
|
||||
fn transition(self, event: ToolMessage, tool_data: &mut Self::ToolData, tool_action_data: &mut ToolActionHandlerData, _tool_options: &(), responses: &mut VecDeque<Message>) -> Self {
|
||||
let ToolActionHandlerData { document, input, render_data, .. } = tool_action_data;
|
||||
let ToolActionHandlerData { document, input, .. } = tool_action_data;
|
||||
|
||||
let ToolMessage::Artboard(event) = event else {
|
||||
return self;
|
||||
@@ -210,10 +206,10 @@ impl Fsm for ArtboardToolFsmState {
|
||||
|
||||
if let Some(selected_edges) = tool_data.check_dragging_bounds(input.mouse.position) {
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
tool_data.start_resizing(selected_edges, document, render_data, input);
|
||||
tool_data.start_resizing(selected_edges, document, input);
|
||||
|
||||
ArtboardToolFsmState::ResizingBounds
|
||||
} else if tool_data.select_artboard(document, render_data, input, responses) {
|
||||
} else if tool_data.select_artboard(document, input, responses) {
|
||||
ArtboardToolFsmState::Dragging
|
||||
} else {
|
||||
ArtboardToolFsmState::Drawing
|
||||
@@ -284,7 +280,7 @@ impl Fsm for ArtboardToolFsmState {
|
||||
let id = generate_uuid();
|
||||
tool_data.selected_artboard = Some(LayerNodeIdentifier::new_unchecked(id));
|
||||
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(None, Some(id), render_data), true, true);
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
tool_data.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
|
||||
responses.add(GraphOperationMessage::NewArtboard {
|
||||
@@ -367,11 +363,6 @@ impl Fsm for ArtboardToolFsmState {
|
||||
ArtboardToolFsmState::Ready
|
||||
}
|
||||
(_, ArtboardToolMessage::Abort) => {
|
||||
// Register properties when switching back to other tools
|
||||
responses.add(PropertiesPanelMessage::SetActiveLayers {
|
||||
paths: document.selected_layers().map(|path| path.to_vec()).collect(),
|
||||
});
|
||||
|
||||
tool_data.snap_manager.cleanup(responses);
|
||||
responses.add(OverlaysMessage::Draw);
|
||||
ArtboardToolFsmState::Ready
|
||||
|
||||
@@ -185,11 +185,7 @@ impl Fsm for EllipseToolFsmState {
|
||||
|
||||
fn transition(self, event: ToolMessage, tool_data: &mut Self::ToolData, tool_action_data: &mut ToolActionHandlerData, tool_options: &Self::ToolOptions, responses: &mut VecDeque<Message>) -> Self {
|
||||
let ToolActionHandlerData {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
..
|
||||
document, global_tool_data, input, ..
|
||||
} = tool_action_data;
|
||||
|
||||
let shape_data = &mut tool_data.data;
|
||||
@@ -199,11 +195,11 @@ impl Fsm for EllipseToolFsmState {
|
||||
};
|
||||
match (self, event) {
|
||||
(EllipseToolFsmState::Drawing, EllipseToolMessage::CanvasTransformed) => {
|
||||
tool_data.data.recalculate_snaps(document, input, render_data);
|
||||
tool_data.data.recalculate_snaps(document, input);
|
||||
self
|
||||
}
|
||||
(EllipseToolFsmState::Ready, EllipseToolMessage::DragStart) => {
|
||||
shape_data.start(responses, document, input, render_data);
|
||||
shape_data.start(responses, document, input);
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
|
||||
// Create a new ellipse vector shape
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::tool_prelude::*;
|
||||
use document_legacy::layers::style::Fill;
|
||||
|
||||
use graphene_core::vector::style::Fill;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FillTool {
|
||||
@@ -80,9 +81,6 @@ impl Fsm for FillToolFsmState {
|
||||
let fill = Fill::Solid(color);
|
||||
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
responses.add(DocumentMessage::SetSelectedLayers {
|
||||
replacement_selected_layers: vec![layer.clone()],
|
||||
});
|
||||
responses.add(GraphOperationMessage::FillSet { layer, fill });
|
||||
responses.add(DocumentMessage::CommitTransaction);
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::messages::tool::common_functionality::graph_modification_utils::get_g
|
||||
use crate::messages::tool::common_functionality::snapping::SnapManager;
|
||||
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use document_legacy::layers::style::{Fill, Gradient, GradientType, RenderData};
|
||||
use graphene_core::raster::color::Color;
|
||||
use graphene_core::vector::style::{Fill, Gradient, GradientType};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct GradientTool {
|
||||
@@ -267,8 +267,8 @@ struct GradientToolData {
|
||||
drag_start: DVec2,
|
||||
}
|
||||
|
||||
pub fn start_snap(snap_manager: &mut SnapManager, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler, render_data: &RenderData) {
|
||||
snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
pub fn start_snap(snap_manager: &mut SnapManager, document: &DocumentMessageHandler, input: &InputPreprocessorMessageHandler) {
|
||||
snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
}
|
||||
|
||||
@@ -278,11 +278,7 @@ impl Fsm for GradientToolFsmState {
|
||||
|
||||
fn transition(self, event: ToolMessage, tool_data: &mut Self::ToolData, tool_action_data: &mut ToolActionHandlerData, tool_options: &Self::ToolOptions, responses: &mut VecDeque<Message>) -> Self {
|
||||
let ToolActionHandlerData {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
..
|
||||
document, global_tool_data, input, ..
|
||||
} = tool_action_data;
|
||||
|
||||
let ToolMessage::Gradient(event) = event else {
|
||||
@@ -434,7 +430,7 @@ impl Fsm for GradientToolFsmState {
|
||||
let pos = transform.transform_point2(pos);
|
||||
if pos.distance_squared(mouse) < tolerance {
|
||||
dragging = true;
|
||||
start_snap(&mut tool_data.snap_manager, document, input, render_data);
|
||||
start_snap(&mut tool_data.snap_manager, document, input);
|
||||
tool_data.selected_gradient = Some(SelectedGradient {
|
||||
layer,
|
||||
transform,
|
||||
@@ -479,7 +475,7 @@ impl Fsm for GradientToolFsmState {
|
||||
|
||||
tool_data.selected_gradient = Some(selected_gradient);
|
||||
|
||||
start_snap(&mut tool_data.snap_manager, document, input, render_data);
|
||||
start_snap(&mut tool_data.snap_manager, document, input);
|
||||
|
||||
GradientToolFsmState::Drawing
|
||||
} else {
|
||||
|
||||
@@ -3,9 +3,7 @@ use crate::messages::portfolio::document::node_graph::{self, IMAGINATE_NODE};
|
||||
use crate::messages::tool::common_functionality::resize::Resize;
|
||||
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use document_legacy::Operation;
|
||||
|
||||
use glam::DAffine2;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -105,7 +103,7 @@ impl Fsm for ImaginateToolFsmState {
|
||||
self,
|
||||
event: ToolMessage,
|
||||
tool_data: &mut Self::ToolData,
|
||||
ToolActionHandlerData { document, input, render_data, .. }: &mut ToolActionHandlerData,
|
||||
ToolActionHandlerData { document, input, .. }: &mut ToolActionHandlerData,
|
||||
_tool_options: &Self::ToolOptions,
|
||||
responses: &mut VecDeque<Message>,
|
||||
) -> Self {
|
||||
@@ -116,12 +114,12 @@ impl Fsm for ImaginateToolFsmState {
|
||||
};
|
||||
match (self, event) {
|
||||
(_, ImaginateToolMessage::DocumentIsDirty | ImaginateToolMessage::SelectionChanged) => {
|
||||
//tool_data.path_outlines.update_selected(document.document_legacy.selected_visible_layers(), document, responses, render_data);
|
||||
//tool_data.path_outlines.update_selected(document.document_legacy.selected_visible_layers(), document, responses, font_cache);
|
||||
|
||||
self
|
||||
}
|
||||
(ImaginateToolFsmState::Ready, ImaginateToolMessage::DragStart) => {
|
||||
shape_data.start(responses, document, input, render_data);
|
||||
shape_data.start(responses, document, input);
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
shape_data.layer = Some(LayerNodeIdentifier::new(generate_uuid(), document.network()));
|
||||
responses.add(DocumentMessage::DeselectAllLayers);
|
||||
@@ -156,16 +154,16 @@ impl Fsm for ImaginateToolFsmState {
|
||||
imaginate_node_id,
|
||||
imaginate_node_type.to_document_node_default_inputs([Some(graph_craft::document::NodeInput::node(transform_node_id, 0))], next_pos()),
|
||||
);
|
||||
|
||||
// Add a layer with a frame to the document
|
||||
responses.add(Operation::AddFrame {
|
||||
path: shape_data.layer.unwrap().to_path(),
|
||||
insert_index: -1,
|
||||
transform: DAffine2::ZERO.to_cols_array(),
|
||||
network,
|
||||
});
|
||||
responses.add(NodeGraphMessage::ShiftNode { node_id: imaginate_node_id });
|
||||
|
||||
// // Add a layer with a frame to the document
|
||||
// responses.add(Operation::AddFrame {
|
||||
// path: shape_data.layer.unwrap().to_path(),
|
||||
// insert_index: -1,
|
||||
// transform: DAffine2::ZERO.to_cols_array(),
|
||||
// network,
|
||||
// });
|
||||
|
||||
ImaginateToolFsmState::Drawing
|
||||
}
|
||||
(state, ImaginateToolMessage::Resize { center, lock_ratio }) => {
|
||||
|
||||
@@ -166,11 +166,7 @@ impl Fsm for LineToolFsmState {
|
||||
|
||||
fn transition(self, event: ToolMessage, tool_data: &mut Self::ToolData, tool_action_data: &mut ToolActionHandlerData, tool_options: &Self::ToolOptions, responses: &mut VecDeque<Message>) -> Self {
|
||||
let ToolActionHandlerData {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
..
|
||||
document, global_tool_data, input, ..
|
||||
} = tool_action_data;
|
||||
|
||||
let ToolMessage::Line(event) = event else {
|
||||
@@ -178,7 +174,7 @@ impl Fsm for LineToolFsmState {
|
||||
};
|
||||
match (self, event) {
|
||||
(LineToolFsmState::Ready, LineToolMessage::DragStart) => {
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
tool_data.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
|
||||
let viewport_start = tool_data.snap_manager.snap_position(responses, document, input.mouse.position);
|
||||
|
||||
@@ -257,7 +257,7 @@ impl PathToolData {
|
||||
|
||||
//self
|
||||
// .snap_manager
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&selected_layers), None, render_data), true, true);
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&selected_layers), None, font_cache), true, true);
|
||||
|
||||
// Do not snap against handles when anchor is selected
|
||||
let mut additional_selected_points = Vec::new();
|
||||
|
||||
@@ -543,7 +543,6 @@ impl Fsm for PenToolFsmState {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
shape_editor,
|
||||
..
|
||||
} = tool_action_data;
|
||||
@@ -568,7 +567,7 @@ impl Fsm for PenToolFsmState {
|
||||
};
|
||||
match (self, event) {
|
||||
(_, PenToolMessage::CanvasTransformed) => {
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
self
|
||||
}
|
||||
(_, PenToolMessage::SelectionChanged) => {
|
||||
@@ -591,7 +590,7 @@ impl Fsm for PenToolFsmState {
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
|
||||
// Initialize snapping
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
tool_data.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
|
||||
// Disable this tool's mirroring
|
||||
|
||||
@@ -225,11 +225,7 @@ impl Fsm for PolygonToolFsmState {
|
||||
|
||||
fn transition(self, event: ToolMessage, tool_data: &mut Self::ToolData, tool_action_data: &mut ToolActionHandlerData, tool_options: &Self::ToolOptions, responses: &mut VecDeque<Message>) -> Self {
|
||||
let ToolActionHandlerData {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
..
|
||||
document, global_tool_data, input, ..
|
||||
} = tool_action_data;
|
||||
|
||||
let polygon_data = &mut tool_data.data;
|
||||
@@ -239,11 +235,11 @@ impl Fsm for PolygonToolFsmState {
|
||||
};
|
||||
match (self, event) {
|
||||
(PolygonToolFsmState::Drawing, PolygonToolMessage::CanvasTransformed) => {
|
||||
tool_data.data.recalculate_snaps(document, input, render_data);
|
||||
tool_data.data.recalculate_snaps(document, input);
|
||||
self
|
||||
}
|
||||
(PolygonToolFsmState::Ready, PolygonToolMessage::DragStart) => {
|
||||
polygon_data.start(responses, document, input, render_data);
|
||||
polygon_data.start(responses, document, input);
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
|
||||
let subpath = match tool_options.primitive_shape_type {
|
||||
|
||||
@@ -189,11 +189,7 @@ impl Fsm for RectangleToolFsmState {
|
||||
event: ToolMessage,
|
||||
tool_data: &mut Self::ToolData,
|
||||
ToolActionHandlerData {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
..
|
||||
document, global_tool_data, input, ..
|
||||
}: &mut ToolActionHandlerData,
|
||||
tool_options: &Self::ToolOptions,
|
||||
responses: &mut VecDeque<Message>,
|
||||
@@ -209,11 +205,11 @@ impl Fsm for RectangleToolFsmState {
|
||||
|
||||
match (self, event) {
|
||||
(Drawing, CanvasTransformed) => {
|
||||
tool_data.data.recalculate_snaps(document, input, render_data);
|
||||
tool_data.data.recalculate_snaps(document, input);
|
||||
self
|
||||
}
|
||||
(Ready, DragStart) => {
|
||||
shape_data.start(responses, document, input, render_data);
|
||||
shape_data.start(responses, document, input);
|
||||
|
||||
let subpath = bezier_rs::Subpath::new_rect(DVec2::ZERO, DVec2::ONE);
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ impl Fsm for SelectToolFsmState {
|
||||
type ToolOptions = ();
|
||||
|
||||
fn transition(self, event: ToolMessage, tool_data: &mut Self::ToolData, tool_action_data: &mut ToolActionHandlerData, _tool_options: &(), responses: &mut VecDeque<Message>) -> Self {
|
||||
let ToolActionHandlerData { document, input, render_data, .. } = tool_action_data;
|
||||
let ToolActionHandlerData { document, input, .. } = tool_action_data;
|
||||
|
||||
let ToolMessage::Select(event) = event else {
|
||||
return self;
|
||||
@@ -482,7 +482,7 @@ impl Fsm for SelectToolFsmState {
|
||||
let state = if tool_data.pivot.is_over(input.mouse.position) {
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
tool_data.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
|
||||
SelectToolFsmState::DraggingPivot
|
||||
@@ -494,7 +494,7 @@ impl Fsm for SelectToolFsmState {
|
||||
//
|
||||
// tool_data
|
||||
// .snap_manager
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&selected), None, render_data), snap_x, snap_y);
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&selected), None, font_cache), snap_x, snap_y);
|
||||
// tool_data
|
||||
// .snap_manager
|
||||
// .add_all_document_handles(document, input, &[], &selected.iter().map(|x| x.as_slice()).collect::<Vec<_>>(), &[]);
|
||||
@@ -550,7 +550,7 @@ impl Fsm for SelectToolFsmState {
|
||||
|
||||
// tool_data
|
||||
// .snap_manager
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&tool_data.layers_dragging), None, render_data), true, true);
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&tool_data.layers_dragging), None, font_cache), true, true);
|
||||
|
||||
SelectToolFsmState::Dragging
|
||||
} else {
|
||||
@@ -922,7 +922,7 @@ fn drag_shallowest_manipulation(responses: &mut VecDeque<Message>, selected: Vec
|
||||
});
|
||||
// tool_data
|
||||
// .snap_manager
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&tool_data.layers_dragging), None, render_data), true, true);
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&tool_data.layers_dragging), None, font_cache), true, true);
|
||||
}
|
||||
|
||||
fn drag_deepest_manipulation(responses: &mut VecDeque<Message>, mut selected: Vec<LayerNodeIdentifier>, tool_data: &mut SelectToolData) {
|
||||
@@ -932,7 +932,7 @@ fn drag_deepest_manipulation(responses: &mut VecDeque<Message>, mut selected: Ve
|
||||
});
|
||||
// tool_data
|
||||
// .snap_manager
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&tool_data.layers_dragging), None, render_data), true, true);
|
||||
// .start_snap(document, input, document.bounding_boxes(Some(&tool_data.layers_dragging), None, font_cache), true, true);
|
||||
}
|
||||
|
||||
fn edit_layer_shallowest_manipulation(document: &DocumentMessageHandler, layer: LayerNodeIdentifier, responses: &mut VecDeque<Message>) {
|
||||
|
||||
@@ -196,11 +196,7 @@ impl Fsm for SplineToolFsmState {
|
||||
|
||||
fn transition(self, event: ToolMessage, tool_data: &mut Self::ToolData, tool_action_data: &mut ToolActionHandlerData, tool_options: &Self::ToolOptions, responses: &mut VecDeque<Message>) -> Self {
|
||||
let ToolActionHandlerData {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
..
|
||||
document, global_tool_data, input, ..
|
||||
} = tool_action_data;
|
||||
|
||||
let ToolMessage::Spline(event) = event else {
|
||||
@@ -208,7 +204,7 @@ impl Fsm for SplineToolFsmState {
|
||||
};
|
||||
match (self, event) {
|
||||
(_, SplineToolMessage::CanvasTransformed) => {
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
self
|
||||
}
|
||||
(SplineToolFsmState::Ready, SplineToolMessage::DragStart) => {
|
||||
@@ -218,7 +214,7 @@ impl Fsm for SplineToolFsmState {
|
||||
let parent = document.new_layer_parent();
|
||||
let transform = document.metadata().transform_to_viewport(parent);
|
||||
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(None, None, render_data), true, true);
|
||||
tool_data.snap_manager.start_snap(document, input, document.bounding_boxes(), true, true);
|
||||
tool_data.snap_manager.add_all_document_handles(document, input, &[], &[], &[]);
|
||||
let snapped_position = tool_data.snap_manager.snap_position(responses, document, input.mouse.position);
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ use crate::messages::tool::common_functionality::color_selector::{ToolColorOptio
|
||||
use crate::messages::tool::common_functionality::graph_modification_utils::{self, is_layer_fed_by_node_of_name};
|
||||
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use document_legacy::layers::style::{Fill, RenderData};
|
||||
use graph_craft::document::value::TaggedValue;
|
||||
use graphene_core::renderer::Quad;
|
||||
use graphene_core::text::{load_face, Font};
|
||||
use graphene_core::text::{load_face, Font, FontCache};
|
||||
use graphene_core::vector::style::Fill;
|
||||
use graphene_core::Color;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -224,7 +224,7 @@ struct TextToolData {
|
||||
|
||||
impl TextToolData {
|
||||
/// Set the editing state of the currently modifying layer
|
||||
fn set_editing(&self, editable: bool, render_data: &RenderData, document: &DocumentMessageHandler, responses: &mut VecDeque<Message>) {
|
||||
fn set_editing(&self, editable: bool, font_cache: &FontCache, document: &DocumentMessageHandler, responses: &mut VecDeque<Message>) {
|
||||
if let Some(node_id) = graph_modification_utils::get_fill_id(self.layer, &document.document_legacy) {
|
||||
responses.add(NodeGraphMessage::SetHidden { node_id, hidden: editable });
|
||||
}
|
||||
@@ -235,7 +235,7 @@ impl TextToolData {
|
||||
line_width: None,
|
||||
font_size: editing_text.font_size,
|
||||
color: editing_text.color.unwrap_or(Color::BLACK),
|
||||
url: render_data.font_cache.get_preview_url(&editing_text.font).cloned().unwrap_or_default(),
|
||||
url: font_cache.get_preview_url(&editing_text.font).cloned().unwrap_or_default(),
|
||||
transform: editing_text.transform.to_cols_array(),
|
||||
});
|
||||
} else {
|
||||
@@ -258,9 +258,9 @@ impl TextToolData {
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn start_editing_layer(&mut self, layer: LayerNodeIdentifier, tool_state: TextToolFsmState, document: &DocumentMessageHandler, render_data: &RenderData, responses: &mut VecDeque<Message>) {
|
||||
fn start_editing_layer(&mut self, layer: LayerNodeIdentifier, tool_state: TextToolFsmState, document: &DocumentMessageHandler, font_cache: &FontCache, responses: &mut VecDeque<Message>) {
|
||||
if tool_state == TextToolFsmState::Editing {
|
||||
self.set_editing(false, render_data, document, responses);
|
||||
self.set_editing(false, font_cache, document, responses);
|
||||
}
|
||||
|
||||
self.layer = layer;
|
||||
@@ -268,19 +268,19 @@ impl TextToolData {
|
||||
|
||||
responses.add(DocumentMessage::StartTransaction);
|
||||
|
||||
self.set_editing(true, render_data, document, responses);
|
||||
self.set_editing(true, font_cache, document, responses);
|
||||
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: vec![self.layer.to_node()] });
|
||||
}
|
||||
|
||||
fn interact(&mut self, state: TextToolFsmState, mouse: DVec2, document: &DocumentMessageHandler, render_data: &RenderData, responses: &mut VecDeque<Message>) -> TextToolFsmState {
|
||||
fn interact(&mut self, state: TextToolFsmState, mouse: DVec2, document: &DocumentMessageHandler, font_cache: &FontCache, responses: &mut VecDeque<Message>) -> TextToolFsmState {
|
||||
// Check if the user has selected an existing text layer
|
||||
if let Some(clicked_text_layer_path) = document
|
||||
.document_legacy
|
||||
.click(mouse, document.network())
|
||||
.filter(|&layer| is_layer_fed_by_node_of_name(layer, &document.document_legacy, "Text"))
|
||||
{
|
||||
self.start_editing_layer(clicked_text_layer_path, state, document, render_data, responses);
|
||||
self.start_editing_layer(clicked_text_layer_path, state, document, font_cache, responses);
|
||||
|
||||
TextToolFsmState::Editing
|
||||
}
|
||||
@@ -309,32 +309,32 @@ impl TextToolData {
|
||||
skip_rerender: true,
|
||||
});
|
||||
|
||||
self.set_editing(true, render_data, document, responses);
|
||||
self.set_editing(true, font_cache, document, responses);
|
||||
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: self.layer.to_path() });
|
||||
|
||||
TextToolFsmState::Editing
|
||||
} else {
|
||||
// Removing old text as editable
|
||||
self.set_editing(false, render_data, document, responses);
|
||||
self.set_editing(false, font_cache, document, responses);
|
||||
|
||||
TextToolFsmState::Ready
|
||||
}
|
||||
}
|
||||
|
||||
fn get_bounds(&self, text: &str, render_data: &RenderData) -> Option<[DVec2; 2]> {
|
||||
fn get_bounds(&self, text: &str, font_cache: &FontCache) -> Option<[DVec2; 2]> {
|
||||
let editing_text = self.editing_text.as_ref()?;
|
||||
let buzz_face = render_data.font_cache.get(&editing_text.font).map(|data| load_face(data));
|
||||
let buzz_face = font_cache.get(&editing_text.font).map(|data| load_face(data));
|
||||
let subpaths = graphene_core::text::to_path(text, buzz_face, editing_text.font_size, None);
|
||||
let bounds = subpaths.iter().filter_map(|subpath| subpath.bounding_box());
|
||||
let combined_bounds = bounds.reduce(|a, b| [a[0].min(b[0]), a[1].max(b[1])]).unwrap_or_default();
|
||||
Some(combined_bounds)
|
||||
}
|
||||
|
||||
fn fix_text_bounds(&self, new_text: &str, _document: &DocumentMessageHandler, render_data: &RenderData, responses: &mut VecDeque<Message>) -> Option<()> {
|
||||
fn fix_text_bounds(&self, new_text: &str, _document: &DocumentMessageHandler, font_cache: &FontCache, responses: &mut VecDeque<Message>) -> Option<()> {
|
||||
let layer = self.layer.to_path();
|
||||
let old_bounds = self.get_bounds(&self.editing_text.as_ref()?.text, render_data)?;
|
||||
let new_bounds = self.get_bounds(new_text, render_data)?;
|
||||
let old_bounds = self.get_bounds(&self.editing_text.as_ref()?.text, font_cache)?;
|
||||
let new_bounds = self.get_bounds(new_text, font_cache)?;
|
||||
responses.add(GraphOperationMessage::UpdateBounds { layer, old_bounds, new_bounds });
|
||||
|
||||
Some(())
|
||||
@@ -366,7 +366,7 @@ impl Fsm for TextToolFsmState {
|
||||
document,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
font_cache,
|
||||
..
|
||||
} = transition_data;
|
||||
let ToolMessage::Text(event) = event else {
|
||||
@@ -378,7 +378,7 @@ impl Fsm for TextToolFsmState {
|
||||
transform: document.metadata().transform_to_viewport(tool_data.layer).to_cols_array(),
|
||||
});
|
||||
if let Some(editing_text) = tool_data.editing_text.as_ref() {
|
||||
let buzz_face = render_data.font_cache.get(&editing_text.font).map(|data| load_face(data));
|
||||
let buzz_face = font_cache.get(&editing_text.font).map(|data| load_face(data));
|
||||
let far = graphene_core::text::bounding_box(&tool_data.new_text, buzz_face, editing_text.font_size, None);
|
||||
if far.x != 0. && far.y != 0. {
|
||||
let quad = Quad::from_box([DVec2::ZERO, far]);
|
||||
@@ -394,7 +394,7 @@ impl Fsm for TextToolFsmState {
|
||||
let Some((text, font, font_size)) = graph_modification_utils::get_text(layer, &document.document_legacy) else {
|
||||
continue;
|
||||
};
|
||||
let buzz_face = render_data.font_cache.get(font).map(|data| load_face(data));
|
||||
let buzz_face = font_cache.get(font).map(|data| load_face(data));
|
||||
let far = graphene_core::text::bounding_box(text, buzz_face, font_size, None);
|
||||
let quad = Quad::from_box([DVec2::ZERO, far]);
|
||||
let multiplied = document.metadata().transform_to_viewport(layer) * quad;
|
||||
@@ -413,11 +413,11 @@ impl Fsm for TextToolFsmState {
|
||||
});
|
||||
tool_data.new_text = String::new();
|
||||
|
||||
tool_data.interact(state, input.mouse.position, document, render_data, responses)
|
||||
tool_data.interact(state, input.mouse.position, document, font_cache, responses)
|
||||
}
|
||||
(state, TextToolMessage::EditSelected) => {
|
||||
if let Some(layer) = can_edit_selected(document) {
|
||||
tool_data.start_editing_layer(layer, state, document, render_data, responses);
|
||||
tool_data.start_editing_layer(layer, state, document, font_cache, responses);
|
||||
return TextToolFsmState::Editing;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ impl Fsm for TextToolFsmState {
|
||||
}
|
||||
(state, TextToolMessage::Abort) => {
|
||||
if state == TextToolFsmState::Editing {
|
||||
tool_data.set_editing(false, render_data, document, responses);
|
||||
tool_data.set_editing(false, font_cache, document, responses);
|
||||
}
|
||||
|
||||
TextToolFsmState::Ready
|
||||
@@ -436,7 +436,7 @@ impl Fsm for TextToolFsmState {
|
||||
TextToolFsmState::Editing
|
||||
}
|
||||
(TextToolFsmState::Editing, TextToolMessage::TextChange { new_text }) => {
|
||||
tool_data.fix_text_bounds(&new_text, document, render_data, responses);
|
||||
tool_data.fix_text_bounds(&new_text, document, font_cache, responses);
|
||||
responses.add(NodeGraphMessage::SetQualifiedInputValue {
|
||||
layer_path: Vec::new(),
|
||||
node_path: vec![graph_modification_utils::get_text_id(tool_data.layer, &document.document_legacy).unwrap()],
|
||||
@@ -444,7 +444,7 @@ impl Fsm for TextToolFsmState {
|
||||
value: TaggedValue::String(new_text),
|
||||
});
|
||||
|
||||
tool_data.set_editing(false, render_data, document, responses);
|
||||
tool_data.set_editing(false, font_cache, document, responses);
|
||||
|
||||
TextToolFsmState::Ready
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ use crate::messages::portfolio::document::overlays::utility_types::OverlayProvid
|
||||
use crate::messages::prelude::*;
|
||||
use crate::node_graph_executor::NodeGraphExecutor;
|
||||
|
||||
use document_legacy::layers::style::RenderData;
|
||||
use graphene_core::raster::color::Color;
|
||||
use graphene_std::text::FontCache;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::{self, Debug};
|
||||
@@ -23,7 +23,7 @@ pub struct ToolActionHandlerData<'a> {
|
||||
pub document_id: u64,
|
||||
pub global_tool_data: &'a DocumentToolData,
|
||||
pub input: &'a InputPreprocessorMessageHandler,
|
||||
pub render_data: &'a RenderData<'a>,
|
||||
pub font_cache: &'a FontCache,
|
||||
pub shape_editor: &'a mut ShapeState,
|
||||
pub node_graph: &'a NodeGraphExecutor,
|
||||
}
|
||||
@@ -33,7 +33,7 @@ impl<'a> ToolActionHandlerData<'a> {
|
||||
document_id: u64,
|
||||
global_tool_data: &'a DocumentToolData,
|
||||
input: &'a InputPreprocessorMessageHandler,
|
||||
render_data: &'a RenderData<'a>,
|
||||
font_cache: &'a FontCache,
|
||||
shape_editor: &'a mut ShapeState,
|
||||
node_graph: &'a NodeGraphExecutor,
|
||||
) -> Self {
|
||||
@@ -42,7 +42,7 @@ impl<'a> ToolActionHandlerData<'a> {
|
||||
document_id,
|
||||
global_tool_data,
|
||||
input,
|
||||
render_data,
|
||||
font_cache,
|
||||
shape_editor,
|
||||
node_graph,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user