Desktop: Fix pivot and axis constraint overlays (#3463)

* fix pivot gizmo native dowel_pin overlay

* fix native snapping overlay
This commit is contained in:
Timon
2025-12-15 14:53:43 +00:00
committed by GitHub
parent 820865389c
commit b4fc3d0580
2 changed files with 19 additions and 19 deletions
@@ -804,34 +804,32 @@ impl OverlayContextInternal {
let transform = self.get_transform();
// Draw the background circle with a white fill and colored outline
let circle = kurbo::Circle::new((x, y), DOWEL_PIN_RADIUS);
self.scene.fill(peniko::Fill::NonZero, transform, Self::parse_color(COLOR_OVERLAY_WHITE), None, &circle);
self.scene.stroke(&kurbo::Stroke::new(1.), transform, Self::parse_color(color), None, &circle);
// Draw the two filled sectors using paths
let mut path = BezPath::new();
// Top-left sector
let start1 = FRAC_PI_2 + angle;
let start1_x = x + DOWEL_PIN_RADIUS * start1.cos();
let start1_y = y + DOWEL_PIN_RADIUS * start1.sin();
path.move_to(kurbo::Point::new(x, y));
let end_x = x + DOWEL_PIN_RADIUS * (FRAC_PI_2 + angle.cos());
let end_y = y + DOWEL_PIN_RADIUS * (FRAC_PI_2 + angle.sin());
path.line_to(kurbo::Point::new(end_x, end_y));
// Draw arc manually
let arc = kurbo::Arc::new((x, y), (DOWEL_PIN_RADIUS, DOWEL_PIN_RADIUS), FRAC_PI_2 + angle, FRAC_PI_2, 0.0);
arc.to_cubic_beziers(0.1, |p1, p2, p| {
path.line_to(kurbo::Point::new(start1_x, start1_y));
let arc1 = kurbo::Arc::new((x, y), (DOWEL_PIN_RADIUS, DOWEL_PIN_RADIUS), start1, FRAC_PI_2, 0.0);
arc1.to_cubic_beziers(0.1, |p1, p2, p| {
path.curve_to(p1, p2, p);
});
path.close_path();
// Bottom-right sector
let start2 = PI + FRAC_PI_2 + angle;
let start2_x = x + DOWEL_PIN_RADIUS * start2.cos();
let start2_y = y + DOWEL_PIN_RADIUS * start2.sin();
path.move_to(kurbo::Point::new(x, y));
let end_x = x + DOWEL_PIN_RADIUS * (PI + FRAC_PI_2 + angle.cos());
let end_y = y + DOWEL_PIN_RADIUS * (PI + FRAC_PI_2 + angle.sin());
path.line_to(kurbo::Point::new(end_x, end_y));
// Draw arc manually
let arc = kurbo::Arc::new((x, y), (DOWEL_PIN_RADIUS, DOWEL_PIN_RADIUS), PI + FRAC_PI_2 + angle, FRAC_PI_2, 0.0);
arc.to_cubic_beziers(0.1, |p1, p2, p| {
path.line_to(kurbo::Point::new(start2_x, start2_y));
let arc2 = kurbo::Arc::new((x, y), (DOWEL_PIN_RADIUS, DOWEL_PIN_RADIUS), start2, FRAC_PI_2, 0.0);
arc2.to_cubic_beziers(0.1, |p1, p2, p| {
path.curve_to(p1, p2, p);
});
path.close_path();