mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 20:58:12 +08:00
Add reference point input to the Mirror node
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
use super::graph_modification_utils;
|
||||
use crate::consts::PIVOT_DIAMETER;
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||
use crate::messages::prelude::*;
|
||||
use glam::{DAffine2, DVec2};
|
||||
use graphene_std::transform::ReferencePoint;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -18,7 +18,7 @@ pub struct Pivot {
|
||||
/// The viewspace pivot position (if applicable)
|
||||
pivot: Option<DVec2>,
|
||||
/// The old pivot position in the GUI, used to reduce refreshes of the document bar
|
||||
old_pivot_position: PivotPosition,
|
||||
old_pivot_position: ReferencePoint,
|
||||
}
|
||||
|
||||
impl Default for Pivot {
|
||||
@@ -27,7 +27,7 @@ impl Default for Pivot {
|
||||
normalized_pivot: DVec2::splat(0.5),
|
||||
transform_from_normalized: Default::default(),
|
||||
pivot: Default::default(),
|
||||
old_pivot_position: PivotPosition::Center,
|
||||
old_pivot_position: ReferencePoint::Center,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ impl Pivot {
|
||||
should_refresh
|
||||
}
|
||||
|
||||
pub fn to_pivot_position(&self) -> PivotPosition {
|
||||
pub fn to_pivot_position(&self) -> ReferencePoint {
|
||||
self.normalized_pivot.into()
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ use glam::DMat2;
|
||||
use graph_craft::document::NodeId;
|
||||
use graphene_core::renderer::Quad;
|
||||
use graphene_std::renderer::Rect;
|
||||
use graphene_std::transform::ReferencePoint;
|
||||
use graphene_std::vector::misc::BooleanOperation;
|
||||
use std::fmt;
|
||||
|
||||
@@ -96,7 +97,7 @@ pub enum SelectToolMessage {
|
||||
PointerOutsideViewport(SelectToolPointerKeys),
|
||||
SelectOptions(SelectOptionsUpdate),
|
||||
SetPivot {
|
||||
position: PivotPosition,
|
||||
position: ReferencePoint,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -129,9 +130,9 @@ impl SelectTool {
|
||||
.widget_holder()
|
||||
}
|
||||
|
||||
fn pivot_widget(&self, disabled: bool) -> WidgetHolder {
|
||||
PivotInput::new(self.tool_data.pivot.to_pivot_position())
|
||||
.on_update(|pivot_input: &PivotInput| SelectToolMessage::SetPivot { position: pivot_input.position }.into())
|
||||
fn pivot_reference_point_widget(&self, disabled: bool) -> WidgetHolder {
|
||||
ReferencePointInput::new(self.tool_data.pivot.to_pivot_position())
|
||||
.on_update(|pivot_input: &ReferencePointInput| SelectToolMessage::SetPivot { position: pivot_input.value }.into())
|
||||
.disabled(disabled)
|
||||
.widget_holder()
|
||||
}
|
||||
@@ -204,7 +205,7 @@ impl LayoutHolder for SelectTool {
|
||||
|
||||
// Pivot
|
||||
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
|
||||
widgets.push(self.pivot_widget(self.tool_data.selected_layers_count == 0));
|
||||
widgets.push(self.pivot_reference_point_widget(self.tool_data.selected_layers_count == 0));
|
||||
|
||||
// Align
|
||||
let disabled = self.tool_data.selected_layers_count < 2;
|
||||
|
||||
Reference in New Issue
Block a user