fix(photos): length dim parallel to approved axis (#70)
This commit is contained in:
@@ -237,29 +237,12 @@ export function buildOverlayPlan(input: OverlayPlanInput): OverlayPlan {
|
||||
if (extent && extent.maxP > maxRight) maxRight = extent.maxP;
|
||||
}
|
||||
const outward = maxRight + pad;
|
||||
// Tip pixels = wood ends. Translate them by a single screen-axis offset so the
|
||||
// dim line stays || tip-to-tip (measured span = wood tip-to-tip) and arrowheads
|
||||
// share tip y (vertical-ish) / tip x (horizontal-ish) — no past-footprint
|
||||
// overshoot from (rx,ry)*outward (#69). Clearance magnitude matches classic
|
||||
// axis-right mid (centerline + r*outward).
|
||||
const tipOriented = pickBottomTowardTop(seg.tipStart, seg.tipEnd);
|
||||
const aClassic: [number, number] = [bottom[0] + rx * outward, bottom[1] + ry * outward];
|
||||
const bClassic: [number, number] = [top[0] + rx * outward, top[1] + ry * outward];
|
||||
const tipMidX = (tipOriented.bottom[0] + tipOriented.top[0]) / 2;
|
||||
const tipMidY = (tipOriented.bottom[1] + tipOriented.top[1]) / 2;
|
||||
const classicMidX = (aClassic[0] + bClassic[0]) / 2;
|
||||
const classicMidY = (aClassic[1] + bClassic[1]) / 2;
|
||||
let aSrc: [number, number];
|
||||
let bSrc: [number, number];
|
||||
if (Math.abs(uy) >= Math.abs(ux)) {
|
||||
const dx = classicMidX - tipMidX;
|
||||
aSrc = [tipOriented.bottom[0] + dx, tipOriented.bottom[1]];
|
||||
bSrc = [tipOriented.top[0] + dx, tipOriented.top[1]];
|
||||
} else {
|
||||
const dy = classicMidY - tipMidY;
|
||||
aSrc = [tipOriented.bottom[0], tipOriented.bottom[1] + dy];
|
||||
bSrc = [tipOriented.top[0], tipOriented.top[1] + dy];
|
||||
}
|
||||
// Classic dimensioning (#70): centerline tip stations (robust 0.2%/99.8% axial
|
||||
// percentiles from maskAxisSegment — keeps #69 speck immunity) offset by pure
|
||||
// axis-right (rx,ry)*outward. Length stays || approved (ux,uy); no screen-only
|
||||
// tip translation (that made a→b follow tip-to-tip ≠ axis on irregular wood).
|
||||
const aSrc: [number, number] = [bottom[0] + rx * outward, bottom[1] + ry * outward];
|
||||
const bSrc: [number, number] = [top[0] + rx * outward, top[1] + ry * outward];
|
||||
const midSrc: [number, number] = [(aSrc[0] + bSrc[0]) / 2, (aSrc[1] + bSrc[1]) / 2];
|
||||
// Nudge label further outward a bit (axis-right of dim line)
|
||||
const labelSrc: [number, number] = [midSrc[0] + rx * (scale * 0.4), midSrc[1] + ry * (scale * 0.4)];
|
||||
|
||||
Reference in New Issue
Block a user