Restore original

This commit is contained in:
Mark Tolmacs 2025-05-12 16:10:15 +02:00
parent 47cb16822c
commit 13bd8cad96
No known key found for this signature in database
2 changed files with 11 additions and 16 deletions

View File

@ -959,10 +959,7 @@ export const bindPointToSnapToElementOutline = (
otherPoint, otherPoint,
), ),
), ),
FIXED_BINDING_DISTANCE * FIXED_BINDING_DISTANCE,
(bindableElement.type === "diamond"
? 1.414 // sqrt(2)
: 1),
)[0]; )[0];
} else { } else {
intersection = intersectElementWithLineSegment( intersection = intersectElementWithLineSegment(
@ -1180,7 +1177,7 @@ export const snapToMid = (
)[0] ?? otherPoint )[0] ?? otherPoint
); );
} else if (element.type === "diamond") { } else if (element.type === "diamond") {
const distance = FIXED_BINDING_DISTANCE * 0.7071; // 1 / sqrt(2) const distance = FIXED_BINDING_DISTANCE;
const topLeft = pointFrom<GlobalPoint>( const topLeft = pointFrom<GlobalPoint>(
x + width / 4 - distance, x + width / 4 - distance,
y + height / 4 - distance, y + height / 4 - distance,
@ -1202,25 +1199,25 @@ export const snapToMid = (
pointDistance(topLeft, nonRotated) < pointDistance(topLeft, nonRotated) <
Math.max(horizontalThreshold, verticalThreshold) Math.max(horizontalThreshold, verticalThreshold)
) { ) {
return topLeft; return pointRotateRads(topLeft, center, angle);
} }
if ( if (
pointDistance(topRight, nonRotated) < pointDistance(topRight, nonRotated) <
Math.max(horizontalThreshold, verticalThreshold) Math.max(horizontalThreshold, verticalThreshold)
) { ) {
return topRight; return pointRotateRads(topRight, center, angle);
} }
if ( if (
pointDistance(bottomLeft, nonRotated) < pointDistance(bottomLeft, nonRotated) <
Math.max(horizontalThreshold, verticalThreshold) Math.max(horizontalThreshold, verticalThreshold)
) { ) {
return bottomLeft; return pointRotateRads(bottomLeft, center, angle);
} }
if ( if (
pointDistance(bottomRight, nonRotated) < pointDistance(bottomRight, nonRotated) <
Math.max(horizontalThreshold, verticalThreshold) Math.max(horizontalThreshold, verticalThreshold)
) { ) {
return bottomRight; return pointRotateRads(bottomRight, center, angle);
} }
} }

View File

@ -779,7 +779,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": "0.00000", "height": 0,
"id": "id668", "id": "id668",
"index": "a2", "index": "a2",
"isDeleted": false, "isDeleted": false,
@ -855,14 +855,14 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
[ [
100, 100,
"-0.00000", 0,
], ],
], ],
}, },
"inserted": { "inserted": {
"endBinding": { "endBinding": {
"elementId": "id665", "elementId": "id665",
"focus": "0.00000", "focus": -0,
"gap": 1, "gap": 1,
}, },
"points": [ "points": [
@ -918,7 +918,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
], ],
"startBinding": null, "startBinding": null,
"y": 0,
}, },
"inserted": { "inserted": {
"points": [ "points": [
@ -928,15 +927,14 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
[ [
100, 100,
"-0.00000", 0,
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id664", "elementId": "id664",
"focus": "-0.00000", "focus": 0,
"gap": 1, "gap": 1,
}, },
"y": "0.00000",
}, },
}, },
}, },