Improve snapping performance (#3067)

* Use lyon_geom for intersection calculation of bezier segments

* Implement approximate nearest point calculation and loosen bounding boxes

* Add algorithm explanation

* Update editor/src/messages/tool/common_functionality/snapping/layer_snapper.rs

Co-authored-by: Keavon Chambers <keavon@keavon.com>

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2025-08-20 10:47:58 +02:00
committed by GitHub
co-authored by Keavon Chambers
parent b44a4fba1e
commit 7c30f6168b
7 changed files with 186 additions and 8 deletions
Generated
+12
View File
@@ -1948,6 +1948,7 @@ dependencies = [
"image",
"kurbo",
"log",
"lyon_geom",
"node-macro",
"num-traits",
"parley",
@@ -2978,6 +2979,17 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
[[package]]
name = "lyon_geom"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8af69edc087272df438b3ee436c4bb6d7c04aa8af665cfd398feae627dbd8570"
dependencies = [
"arrayvec",
"euclid",
"num-traits",
]
[[package]]
name = "malloc_buf"
version = "0.0.6"