mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 07:58:11 +08:00
Rename vector components to match new terminology (#719)
* Renamed VectorAnchor, VectorShape and VectorControlPoint. Also fixed other naming inconsistencies. * Renamed messages relating to vector and updated naming in several tools * Renamed comments + caught a few areas I had missed. * Caught a few more incorrect names * Code review pass * Review changes * Fixed warning * Additional review feedback Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
5d1d93917d
commit
03633bf313
@@ -7,7 +7,7 @@ use graphene::intersection::Quad;
|
||||
use graphene::layers::layer_info::LayerDataType;
|
||||
use graphene::layers::style::{self, Fill, Stroke};
|
||||
use graphene::layers::text_layer::FontCache;
|
||||
use graphene::layers::vector::vector_shape::VectorShape;
|
||||
use graphene::layers::vector::subpath::Subpath;
|
||||
use graphene::{LayerId, Operation};
|
||||
|
||||
use glam::{DAffine2, DVec2};
|
||||
@@ -35,12 +35,10 @@ impl PathOutline {
|
||||
|
||||
// TODO Purge this area of BezPath and Kurbo
|
||||
// Get the bezpath from the shape or text
|
||||
let vector_path = match &document_layer.data {
|
||||
let subpath = match &document_layer.data {
|
||||
LayerDataType::Shape(layer_shape) => Some(layer_shape.shape.clone()),
|
||||
LayerDataType::Text(text) => Some(text.to_vector_path_nonmut(font_cache)),
|
||||
_ => document_layer
|
||||
.aabounding_box_for_transform(DAffine2::IDENTITY, font_cache)
|
||||
.map(|[p1, p2]| VectorShape::new_rect(p1, p2)),
|
||||
LayerDataType::Text(text) => Some(text.to_subpath_nonmut(font_cache)),
|
||||
_ => document_layer.aabb_for_transform(DAffine2::IDENTITY, font_cache).map(|[p1, p2]| Subpath::new_rect(p1, p2)),
|
||||
}?;
|
||||
|
||||
// Generate a new overlay layer if necessary
|
||||
@@ -50,7 +48,7 @@ impl PathOutline {
|
||||
let overlay_path = vec![generate_uuid()];
|
||||
let operation = Operation::AddShape {
|
||||
path: overlay_path.clone(),
|
||||
vector_path: Default::default(),
|
||||
subpath: Default::default(),
|
||||
style: style::PathStyle::new(Some(Stroke::new(COLOR_ACCENT, PATH_OUTLINE_WEIGHT)), Fill::None),
|
||||
insert_index: -1,
|
||||
transform: DAffine2::IDENTITY.to_cols_array(),
|
||||
@@ -63,7 +61,7 @@ impl PathOutline {
|
||||
};
|
||||
|
||||
// Update the shape bezpath
|
||||
let operation = Operation::SetShapePath { path: overlay.clone(), vector_path };
|
||||
let operation = Operation::SetShapePath { path: overlay.clone(), subpath };
|
||||
responses.push_back(DocumentMessage::Overlays(operation.into()).into());
|
||||
|
||||
// Update the transform to match the document
|
||||
@@ -110,7 +108,7 @@ impl PathOutline {
|
||||
}
|
||||
}
|
||||
|
||||
/// Clears overlays for the seleted paths and removes references
|
||||
/// Clears overlays for the selected paths and removes references
|
||||
pub fn clear_selected(&mut self, responses: &mut VecDeque<Message>) {
|
||||
while let Some(path) = self.selected_overlay_paths.pop() {
|
||||
let operation = Operation::DeleteLayer { path };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::consts::{BOUNDS_ROTATE_THRESHOLD, BOUNDS_SELECT_THRESHOLD, COLOR_ACCENT, SELECTION_DRAG_ANGLE, VECTOR_MANIPULATOR_ANCHOR_MARKER_SIZE};
|
||||
use crate::consts::{BOUNDS_ROTATE_THRESHOLD, BOUNDS_SELECT_THRESHOLD, COLOR_ACCENT, MANIPULATOR_GROUP_MARKER_SIZE, SELECTION_DRAG_ANGLE};
|
||||
use crate::document::transformation::OriginalTransforms;
|
||||
use crate::frontend::utility_types::MouseCursorIcon;
|
||||
use crate::input::InputPreprocessorMessageHandler;
|
||||
@@ -219,7 +219,7 @@ impl BoundingBoxOverlays {
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculats the transformed handle positions based on the bounding box and the transform
|
||||
/// Calculates the transformed handle positions based on the bounding box and the transform
|
||||
pub fn evaluate_transform_handle_positions(&self) -> [DVec2; 8] {
|
||||
let (left, top): (f64, f64) = self.bounds[0].into();
|
||||
let (right, bottom): (f64, f64) = self.bounds[1].into();
|
||||
@@ -245,7 +245,7 @@ impl BoundingBoxOverlays {
|
||||
const BIAS: f64 = 0.0001;
|
||||
|
||||
for (position, path) in self.evaluate_transform_handle_positions().into_iter().zip(&self.transform_handles) {
|
||||
let scale = DVec2::splat(VECTOR_MANIPULATOR_ANCHOR_MARKER_SIZE);
|
||||
let scale = DVec2::splat(MANIPULATOR_GROUP_MARKER_SIZE);
|
||||
let translation = (position - (scale / 2.) - 0.5 + BIAS).round();
|
||||
let transform = DAffine2::from_scale_angle_translation(scale, 0., translation).to_cols_array();
|
||||
let path = path.clone();
|
||||
|
||||
Reference in New Issue
Block a user