Add "Grid" to the Shape tool along with row/column gizmos (#2921)

* integrated grid shape in shape-tool

* add overlays,detection,transform for gizmo

* fix compile issues

* handle negative correctly,fix undo redo and abort

* fix missed merge conflicts

* fixed mouse cursor,correctly translatiing

* cleanup

* fix click-target area inside rect and spacing

* add 10px closer to gizmo line

* resolved conflicts

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0SlowPoke0
2025-09-08 06:23:37 +05:30
committed by GitHub
parent 65171a5b8e
commit 3e50d177b7
13 changed files with 850 additions and 87 deletions

View File

@@ -60,7 +60,7 @@ impl AsI64 for f64 {
#[widget(Radio)]
pub enum GridType {
#[default]
Rectangular,
Rectangular = 0,
Isometric,
}
@@ -102,6 +102,10 @@ pub fn dvec2_to_point(value: DVec2) -> Point {
Point { x: value.x, y: value.y }
}
pub fn get_line_endpoints(line: Line) -> (DVec2, DVec2) {
(point_to_dvec2(line.p0), point_to_dvec2(line.p1))
}
pub fn segment_to_handles(segment: &PathSeg) -> BezierHandles {
match *segment {
PathSeg::Line(_) => BezierHandles::Linear,

View File

@@ -128,7 +128,10 @@ impl PointDomain {
}
pub fn push(&mut self, id: PointId, position: DVec2) {
debug_assert!(!self.id.contains(&id));
if self.id.contains(&id) {
return;
}
self.id.push(id);
self.position.push(position);
}