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;
|
if (extent && extent.maxP > maxRight) maxRight = extent.maxP;
|
||||||
}
|
}
|
||||||
const outward = maxRight + pad;
|
const outward = maxRight + pad;
|
||||||
// Tip pixels = wood ends. Translate them by a single screen-axis offset so the
|
// Classic dimensioning (#70): centerline tip stations (robust 0.2%/99.8% axial
|
||||||
// dim line stays || tip-to-tip (measured span = wood tip-to-tip) and arrowheads
|
// percentiles from maskAxisSegment — keeps #69 speck immunity) offset by pure
|
||||||
// share tip y (vertical-ish) / tip x (horizontal-ish) — no past-footprint
|
// axis-right (rx,ry)*outward. Length stays || approved (ux,uy); no screen-only
|
||||||
// overshoot from (rx,ry)*outward (#69). Clearance magnitude matches classic
|
// tip translation (that made a→b follow tip-to-tip ≠ axis on irregular wood).
|
||||||
// axis-right mid (centerline + r*outward).
|
const aSrc: [number, number] = [bottom[0] + rx * outward, bottom[1] + ry * outward];
|
||||||
const tipOriented = pickBottomTowardTop(seg.tipStart, seg.tipEnd);
|
const bSrc: [number, number] = [top[0] + rx * outward, top[1] + ry * outward];
|
||||||
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];
|
|
||||||
}
|
|
||||||
const midSrc: [number, number] = [(aSrc[0] + bSrc[0]) / 2, (aSrc[1] + bSrc[1]) / 2];
|
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)
|
// 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)];
|
const labelSrc: [number, number] = [midSrc[0] + rx * (scale * 0.4), midSrc[1] + ry * (scale * 0.4)];
|
||||||
|
|||||||
Reference in New Issue
Block a user