mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
Add nondestructive vector editing (#1676)
* Initial vector modify node * Initial extraction of data from monitor nodes * Migrate to point id * Start converting to modify node * Non destructive spline tool (tout le reste est cassé) * Fix unconnected modify node * Fix freehand tool * Pen tool * Migrate demo art * Select points * Fix the demo artwork * Fix the X and Y inputs for path tool * G1 continous toggle * Delete points * Fix test * Insert point * Improve robustness of handles * Fix GRS shortcuts on path * Dragging points * Fix build * Preserve opposing handle lengths * Update demo art and snapping * Fix polygon tool * Double click end anchor * Improve dragging * Fix text shifting * Select only connected verts * Colinear alt * Cleanup * Fix imports * Improve pen tool avoiding handle placement * Improve disolve * Remove pivot widget from Transform node properties * Fix demo art * Fix bugs * Re-save demo artwork * Code review * Serialize hashmap as tuple vec to enable deserialize_inputs * Fix migrate * Add document upgrade function to editor_api.rs * Finalize document upgrading * Rename to the Path node * Remove smoothing from Freehand tool * Upgrade demo artwork * Propertly disable raw-rs tests --------- Co-authored-by: Keavon Chambers <keavon@keavon.com> Co-authored-by: Adam <adamgerhant@gmail.com> Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
@@ -152,7 +152,7 @@ pub struct TransformNode<TransformTarget, Translation, Rotation, Scale, Shear, P
|
||||
pub(crate) rotate: Rotation,
|
||||
pub(crate) scale: Scale,
|
||||
pub(crate) shear: Shear,
|
||||
pub(crate) pivot: Pivot,
|
||||
pub(crate) _pivot: Pivot,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, dyn_any::DynAny, PartialEq)]
|
||||
@@ -165,7 +165,7 @@ pub enum RenderQuality {
|
||||
Scale(f32),
|
||||
/// Flip a coin to decide if the render should be available with the current quality or done at full quality
|
||||
/// This should be used to gradually update the render quality of a cached node
|
||||
Probabilty(f32),
|
||||
Probability(f32),
|
||||
/// Render at full quality
|
||||
Full,
|
||||
}
|
||||
@@ -249,23 +249,18 @@ pub(crate) async fn transform_vector_data<Fut: Future>(
|
||||
rotate: f64,
|
||||
scale: DVec2,
|
||||
shear: DVec2,
|
||||
pivot: DVec2,
|
||||
_pivot: DVec2,
|
||||
) -> Fut::Output
|
||||
where
|
||||
Fut::Output: TransformMut,
|
||||
{
|
||||
// TODO: This is hack and might break for Vector data because the pivot may be incorrect
|
||||
let transform = DAffine2::from_scale_angle_translation(scale, rotate, translate) * DAffine2::from_cols_array(&[1., shear.y, shear.x, 1., 0., 0.]);
|
||||
let modification = DAffine2::from_scale_angle_translation(scale, rotate, translate) * DAffine2::from_cols_array(&[1., shear.y, shear.x, 1., 0., 0.]);
|
||||
if !footprint.ignore_modifications {
|
||||
let pivot_transform = DAffine2::from_translation(pivot);
|
||||
let modification = pivot_transform * transform * pivot_transform.inverse();
|
||||
*footprint.transform_mut() = footprint.transform() * modification;
|
||||
}
|
||||
|
||||
let mut data = self.transform_target.eval(footprint).await;
|
||||
let pivot_transform = DAffine2::from_translation(data.local_pivot(pivot));
|
||||
|
||||
let modification = pivot_transform * transform * pivot_transform.inverse();
|
||||
let data_transform = data.transform_mut();
|
||||
*data_transform = modification * (*data_transform);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user