mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 19:08:12 +08:00
Fix vector mesh editing behavior in various edge cases (#2943)
* Fix colinear switch behaviour * Fix Tab to switch handles * Code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
3a8c1b6f97
commit
75614eb9d4
@@ -583,7 +583,12 @@ impl PathToolData {
|
||||
SelectionStatus::None => false,
|
||||
SelectionStatus::One(single_selected_point) => {
|
||||
let vector_data = document.network_interface.compute_modified_vector(single_selected_point.layer).unwrap();
|
||||
single_selected_point.id.get_handle_pair(&vector_data).is_some()
|
||||
if single_selected_point.id.get_handle_pair(&vector_data).is_some() {
|
||||
let anchor = single_selected_point.id.get_anchor(&vector_data).expect("Cannot find connected anchor");
|
||||
vector_data.all_connected(anchor).count() <= 2
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
SelectionStatus::Multiple(_) => true,
|
||||
};
|
||||
@@ -600,7 +605,7 @@ impl PathToolData {
|
||||
}
|
||||
|
||||
fn next_drill_through_cycle(&mut self, position: DVec2) -> usize {
|
||||
if self.last_drill_through_click_position.map_or(true, |last_pos| last_pos.distance(position) > DRILL_THROUGH_THRESHOLD) {
|
||||
if self.last_drill_through_click_position.is_none_or(|last_pos| last_pos.distance(position) > DRILL_THROUGH_THRESHOLD) {
|
||||
// New position, reset cycle
|
||||
self.drill_through_cycle_index = 0;
|
||||
} else {
|
||||
@@ -620,7 +625,7 @@ impl PathToolData {
|
||||
}
|
||||
|
||||
fn has_drill_through_mouse_moved(&self, position: DVec2) -> bool {
|
||||
self.last_drill_through_click_position.map_or(true, |last_pos| last_pos.distance(position) > DRILL_THROUGH_THRESHOLD)
|
||||
self.last_drill_through_click_position.is_none_or(|last_pos| last_pos.distance(position) > DRILL_THROUGH_THRESHOLD)
|
||||
}
|
||||
|
||||
fn set_ghost_outline(&mut self, shape_editor: &ShapeState, document: &DocumentMessageHandler) {
|
||||
@@ -2406,15 +2411,15 @@ impl Fsm for PathToolFsmState {
|
||||
|
||||
let compatible_type = first_layer.and_then(|layer| {
|
||||
let graph_layer = graph_modification_utils::NodeGraphLayer::new(layer, &document.network_interface);
|
||||
graph_layer.horizontal_layer_flow().nth(1).and_then(|node_id| {
|
||||
graph_layer.horizontal_layer_flow().nth(1).map(|node_id| {
|
||||
let (output_type, _) = document.network_interface.output_type(&node_id, 0, &[]);
|
||||
Some(format!("type:{}", output_type.nested_type()))
|
||||
format!("type:{}", output_type.nested_type())
|
||||
})
|
||||
});
|
||||
|
||||
let is_compatible = compatible_type.as_deref() == Some("type:Instances<VectorData>");
|
||||
|
||||
let is_modifiable = first_layer.map_or(false, |layer| {
|
||||
let is_modifiable = first_layer.is_some_and(|layer| {
|
||||
let graph_layer = graph_modification_utils::NodeGraphLayer::new(layer, &document.network_interface);
|
||||
matches!(graph_layer.find_input("Path", 1), Some(TaggedValue::VectorModification(_)))
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user