Fix collision check for rectangles and rendering of binding area (#2221)
This commit is contained in:
parent
3835fa60e4
commit
8a10f2a0b8
@ -199,11 +199,10 @@ const distanceToRectangle = (
|
|||||||
point: Point,
|
point: Point,
|
||||||
): number => {
|
): number => {
|
||||||
const [, pointRel, hwidth, hheight] = pointRelativeToElement(element, point);
|
const [, pointRel, hwidth, hheight] = pointRelativeToElement(element, point);
|
||||||
const nearSide =
|
return Math.max(
|
||||||
GAPoint.distanceToLine(pointRel, GALine.vector(hwidth, hheight)) > 0
|
GAPoint.distanceToLine(pointRel, GALine.equation(0, 1, -hheight)),
|
||||||
? GALine.equation(0, 1, -hheight)
|
GAPoint.distanceToLine(pointRel, GALine.equation(1, 0, -hwidth)),
|
||||||
: GALine.equation(1, 0, -hwidth);
|
);
|
||||||
return GAPoint.distanceToLine(pointRel, nearSide);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const distanceToDiamond = (
|
const distanceToDiamond = (
|
||||||
|
@ -679,7 +679,7 @@ const renderBindingHighlightForBindableElement = (
|
|||||||
const strokeOffset = 4;
|
const strokeOffset = 4;
|
||||||
context.strokeStyle = "rgba(0,0,0,.05)";
|
context.strokeStyle = "rgba(0,0,0,.05)";
|
||||||
context.lineWidth = threshold - strokeOffset;
|
context.lineWidth = threshold - strokeOffset;
|
||||||
const padding = strokeOffset + threshold / 2;
|
const padding = strokeOffset / 2 + threshold / 2;
|
||||||
|
|
||||||
switch (element.type) {
|
switch (element.type) {
|
||||||
case "rectangle":
|
case "rectangle":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user