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:
Oliver Davies
2022-07-12 17:59:06 -07:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent 5d1d93917d
commit 03633bf313
39 changed files with 1125 additions and 1095 deletions
+13 -10
View File
@@ -1,6 +1,6 @@
use super::layer_info::LayerData;
use super::style::{PathStyle, RenderData, ViewMode};
use super::vector::vector_shape::VectorShape;
use super::vector::subpath::Subpath;
use crate::intersection::{intersect_quad_bez_path, Quad};
use crate::LayerId;
pub use font_cache::{Font, FontCache};
@@ -29,7 +29,7 @@ pub struct TextLayer {
#[serde(skip)]
pub editable: bool,
#[serde(skip)]
pub cached_path: Option<VectorShape>,
pub cached_path: Option<Subpath>,
}
impl LayerData for TextLayer {
@@ -68,7 +68,7 @@ impl LayerData for TextLayer {
} else {
let buzz_face = self.load_face(render_data.font_cache);
let mut path = self.to_vector_path(buzz_face);
let mut path = self.to_subpath(buzz_face);
let kurbo::Rect { x0, y0, x1, y1 } = path.bounding_box();
let bounds = [(x0, y0).into(), (x1, y1).into()];
@@ -136,10 +136,10 @@ impl TextLayer {
new
}
/// Converts to a [VectorShape], populating the cache if necessary.
/// Converts to a [Subpath], populating the cache if necessary.
#[inline]
pub fn to_vector_path(&mut self, buzz_face: Option<Face>) -> VectorShape {
if self.cached_path.as_ref().filter(|x| !x.anchors().is_empty()).is_none() {
pub fn to_subpath(&mut self, buzz_face: Option<Face>) -> Subpath {
if self.cached_path.as_ref().filter(|subpath| !subpath.manipulator_groups().is_empty()).is_none() {
let path = self.generate_path(buzz_face);
self.cached_path = Some(path.clone());
return path;
@@ -147,16 +147,19 @@ impl TextLayer {
self.cached_path.clone().unwrap()
}
/// Converts to a [VectorShape], without populating the cache.
/// Converts to a [Subpath], without populating the cache.
#[inline]
pub fn to_vector_path_nonmut(&self, font_cache: &FontCache) -> VectorShape {
pub fn to_subpath_nonmut(&self, font_cache: &FontCache) -> Subpath {
let buzz_face = self.load_face(font_cache);
self.cached_path.clone().filter(|x| !x.anchors().is_empty()).unwrap_or_else(|| self.generate_path(buzz_face))
self.cached_path
.clone()
.filter(|subpath| !subpath.manipulator_groups().is_empty())
.unwrap_or_else(|| self.generate_path(buzz_face))
}
#[inline]
pub fn generate_path(&self, buzz_face: Option<Face>) -> VectorShape {
pub fn generate_path(&self, buzz_face: Option<Face>) -> Subpath {
to_path::to_path(&self.text, buzz_face, self.size, self.line_width)
}