mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 08:28:31 +00:00
feat v1.23.1: openings — hover outline, drag along walls, double-click properties
- Hover: an accent outline hugs the opening's wall strip + grab cursor. - Drag (view mode): re-snaps continuously to the nearest derived wall; snapToWall now normalizes the angle to [-90,90) — neighbouring rooms yield the same wall in opposite directions, which used to flip the hinge while dragging across segment boundaries. setPointerCapture wrapped in try/catch (an inactive pointerId must not kill the drag). - Click still opens the status card (via a 250ms timer); double click opens the properties dialog from view mode. Hit zone is now a slightly thicker strip along the wall instead of the whole swing square (fewer accidental hovers). +1 test (77). Verified live: drag moved a test door exactly along a vertical wall (angle 90 -> -90), click/dblclick/markup-tool paths all работают; the user's 12 real openings untouched.
This commit is contained in:
@@ -432,3 +432,15 @@ test('openingAmount: doors default open, windows closed; outages freeze the defa
|
||||
assert.equal(openingAmount('door', 'off', true), 1);
|
||||
assert.equal(openingAmount('door', 'unavailable', true), 1);
|
||||
});
|
||||
|
||||
test('snapToWall: the angle is normalized to [-90, 90) so opposite edge directions cannot flip a dragged opening', () => {
|
||||
// the same wall as seen from two neighbouring rooms (opposite winding)
|
||||
const a = [{ poly: [[0, 0], [10, 0], [10, 10], [0, 10]] }];
|
||||
const b = [{ poly: [[10, 0], [0, 0], [0, 10], [10, 10]] }]; // reversed
|
||||
const sa = snapToWall([5, 0.4], a, 1);
|
||||
const sb = snapToWall([5, 0.4], b, 1);
|
||||
assert.equal(sa.angle, sb.angle);
|
||||
assert.ok(sa.angle >= -90 && sa.angle < 90);
|
||||
const v = snapToWall([10.3, 5], a, 1); // vertical wall
|
||||
assert.ok(v.angle >= -90 && v.angle < 90);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user