mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Fix snapping bug where snapped-together shapes couldn't be moved (#1818)
* Fixup dragging snap * Reenable snapping by default on some demo art files --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
2
demo-artwork/isometric-fountain.graphite
generated
2
demo-artwork/isometric-fountain.graphite
generated
File diff suppressed because one or more lines are too long
2
demo-artwork/just-a-potted-cactus.graphite
generated
2
demo-artwork/just-a-potted-cactus.graphite
generated
File diff suppressed because one or more lines are too long
2
demo-artwork/procedural-string-lights.graphite
generated
2
demo-artwork/procedural-string-lights.graphite
generated
File diff suppressed because one or more lines are too long
2
demo-artwork/valley-of-spires.graphite
generated
2
demo-artwork/valley-of-spires.graphite
generated
File diff suppressed because one or more lines are too long
@@ -72,7 +72,7 @@ pub struct SnappingState {
|
||||
impl Default for SnappingState {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
snapping_enabled: false, // TODO: Reenable this by default once <https://github.com/GraphiteEditor/Graphite/issues/1817> is fixed
|
||||
snapping_enabled: true,
|
||||
grid_snapping: false,
|
||||
bounds: Default::default(),
|
||||
nodes: Default::default(),
|
||||
|
||||
@@ -226,24 +226,25 @@ pub fn snap_drag(start: DVec2, current: DVec2, axis_align: bool, snap_data: Snap
|
||||
let mut best_snap = SnappedPoint::infinite_snap(document.metadata.document_to_viewport.inverse().transform_point2(mouse_position));
|
||||
|
||||
for point in candidates {
|
||||
let origin = point.document_point + total_mouse_delta_document;
|
||||
let mut point = point.clone();
|
||||
point.document_point += total_mouse_delta_document;
|
||||
|
||||
let snapped = if axis_align {
|
||||
snap_manager.constrained_snap(
|
||||
&snap_data,
|
||||
point,
|
||||
&point,
|
||||
SnapConstraint::Line {
|
||||
origin,
|
||||
origin: point.document_point,
|
||||
direction: total_mouse_delta_document.try_normalize().unwrap_or(DVec2::X),
|
||||
},
|
||||
None,
|
||||
)
|
||||
} else {
|
||||
snap_manager.free_snap(&snap_data, point, None, false)
|
||||
snap_manager.free_snap(&snap_data, &point, None, false)
|
||||
};
|
||||
|
||||
if best_snap.other_snap_better(&snapped) {
|
||||
offset = snapped.snapped_point_document - origin + mouse_delta_document;
|
||||
offset = snapped.snapped_point_document - point.document_point + mouse_delta_document;
|
||||
best_snap = snapped;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
[target.wasm32-unknown-unknown]
|
||||
|
||||
rustflags = [
|
||||
# Currently disabled because of https://github.com/GraphiteEditor/Graphite/issues/1262
|
||||
# The current simd implementation leads to undefined behavior
|
||||
|
||||
Reference in New Issue
Block a user