mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-31 21:27:00 -06:00
Live Corners: a corner rounds until its cut reaches its neighbours (#2332)
A corner's radius was capped at half its shorter side whatever its neighbours did, so one corner of a 100 pt square rounded alone stopped at 50 pt. Each corner now rounds until its cut reaches the cuts its neighbours ask for: the whole side when the neighbour is square, halfway when both ask for more. The corner widget drag, the red limit outline and CSS border-radius export follow the same limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed by
bflatastic
co-authored by
Claude Opus 5.5
parent
0746519517
commit
8875b3fbca
@@ -622,9 +622,9 @@ fn corners(path: &PathData, live: Option<&LiveShape>) -> Option<Corners> {
|
||||
Some(LiveShape::Rectangle { w, h, radii, kinds, xf })
|
||||
if upright(xf) && radii.iter().zip(kinds).all(|(r, k)| *r <= 0.0 || *k == CornerKind::Round) =>
|
||||
{
|
||||
// The radii as drawn, none past half the shorter side (CSS draws one further when its
|
||||
// neighbours leave room).
|
||||
let radii = radii.map(|r| shapes::fitted_corner_radius(*w, *h, r));
|
||||
// The radii as drawn: no two neighbours' cuts add up to more than their side, so CSS
|
||||
// draws them as they are.
|
||||
let radii = shapes::fitted_corner_radii(*w, *h, *radii);
|
||||
if radii.iter().all(|r| *r <= 0.0) {
|
||||
Some(Corners::Square)
|
||||
} else if radii.iter().all(|r| (r - radii[0]).abs() < 1e-9) {
|
||||
|
||||
Reference in New Issue
Block a user