mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-07 15:55:00 +00:00
fix: 3 stuff
This commit is contained in:
parent
bdc5dee8ee
commit
154ad8bd4b
3 changed files with 21 additions and 17 deletions
|
@ -12,9 +12,9 @@ use glam::{DAffine2, DVec2};
|
|||
use graphene_std::{transform::ReferencePoint, vector::ManipulatorPointId};
|
||||
use std::fmt;
|
||||
|
||||
pub fn pin_pivot_widget(inactive: bool, enabled: bool, source: Source) -> WidgetHolder {
|
||||
IconButton::new(if inactive { "PinInactive" } else { "PinActive" }, 24)
|
||||
.tooltip(if inactive { "Pin Transform Pivot" } else { "Unpin Transform Pivot" })
|
||||
pub fn pin_pivot_widget(active: bool, enabled: bool, source: Source) -> WidgetHolder {
|
||||
IconButton::new(if active { "PinActive" } else { "PinInactive" }, 24)
|
||||
.tooltip(if active { "Unpin Transform Pivot" } else { "Pin Transform Pivot" })
|
||||
.disabled(!enabled)
|
||||
.on_update(move |_| match source {
|
||||
Source::Select => SelectToolMessage::SelectOptions(SelectOptionsUpdate::TogglePivotPinned()).into(),
|
||||
|
@ -104,8 +104,8 @@ impl Dot {
|
|||
self.pivot.transform_from_normalized
|
||||
}
|
||||
|
||||
pub fn pin_inactive(&self) -> bool {
|
||||
!self.pivot.pinned || !self.state.is_pivot()
|
||||
pub fn pin_active(&self) -> bool {
|
||||
self.pivot.pinned && self.state.is_pivot_type()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ impl LayoutHolder for PathTool {
|
|||
let has_somrthing = !self.tool_data.saved_points_before_anchor_convert_smooth_sharp.is_empty();
|
||||
let _pivot_reference = pivot_reference_point_widget(has_somrthing || !self.tool_data.dot.state.is_pivot(), self.tool_data.dot.pivot.to_pivot_position(), Source::Path);
|
||||
|
||||
let _pin_pivot = pin_pivot_widget(self.tool_data.dot.pin_inactive(), false, Source::Path);
|
||||
let _pin_pivot = pin_pivot_widget(self.tool_data.dot.pin_active(), false, Source::Path);
|
||||
|
||||
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row {
|
||||
widgets: vec![
|
||||
|
|
|
@ -204,19 +204,22 @@ impl LayoutHolder for SelectTool {
|
|||
widgets.push(Separator::new(SeparatorType::Unrelated).widget_holder());
|
||||
widgets.extend(dot_type_widget(self.tool_data.dot.state, Source::Select));
|
||||
|
||||
// Reference point 9-box widget
|
||||
widgets.push(Separator::new(SeparatorType::Related).widget_holder());
|
||||
widgets.push(pivot_reference_point_widget(
|
||||
self.tool_data.selected_layers_count == 0 || !self.tool_data.dot.state.is_pivot(),
|
||||
self.tool_data.dot.pivot.to_pivot_position(),
|
||||
Source::Select,
|
||||
));
|
||||
if self.tool_data.dot.state.is_pivot_type() {
|
||||
// Reference point 9-box widget
|
||||
widgets.push(Separator::new(SeparatorType::Related).widget_holder());
|
||||
widgets.push(pivot_reference_point_widget(
|
||||
self.tool_data.selected_layers_count == 0 || !self.tool_data.dot.state.is_pivot(),
|
||||
self.tool_data.dot.pivot.to_pivot_position(),
|
||||
Source::Select,
|
||||
));
|
||||
|
||||
// Pivot pin
|
||||
widgets.push(Separator::new(SeparatorType::Related).widget_holder());
|
||||
// Pivot pin
|
||||
widgets.push(Separator::new(SeparatorType::Related).widget_holder());
|
||||
|
||||
let pin_enabled = self.tool_data.dot.pivot.old_pivot_position == ReferencePoint::None;
|
||||
widgets.push(pin_pivot_widget(self.tool_data.dot.pin_inactive(), pin_enabled, Source::Select));
|
||||
let pin_enabled = self.tool_data.dot.pivot.old_pivot_position == ReferencePoint::None || !self.tool_data.dot.state.enabled;
|
||||
|
||||
widgets.push(pin_pivot_widget(self.tool_data.dot.pin_active(), pin_enabled, Source::Select));
|
||||
}
|
||||
|
||||
// Align
|
||||
let disabled = self.tool_data.selected_layers_count < 2;
|
||||
|
@ -1542,6 +1545,7 @@ impl Fsm for SelectToolFsmState {
|
|||
responses.add(DocumentMessage::StartTransaction);
|
||||
|
||||
tool_data.dot.pivot.last_non_none_reference = position;
|
||||
tool_data.dot.pivot.pinned = false;
|
||||
let pos: Option<DVec2> = position.into();
|
||||
tool_data.dot.pivot.set_normalized_position(pos.unwrap());
|
||||
let dot = tool_data.get_as_dot();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue