Skip to content

Commit

Permalink
fix: fix elementGuidelines #555
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Nov 15, 2021
1 parent b2ce28e commit beec433
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ export function renderDashedGuidelines(
const targetStart = targetRect[mainNames.start]!;
const targetEnd = targetRect[mainNames.end]!;


groups.forEach(({ total, start, end, inner }) => {
const sidePos = targetPos[otherIndex] + total[0].pos[otherIndex] - targetRect[sideNames.start]!;

Expand All @@ -267,43 +266,49 @@ export function renderDashedGuidelines(
start.forEach(guideline => {
const nextRect = guideline.elementRect!.rect;
const size = prevRect[mainNames.start]! - nextRect[mainNames.end]!;
const renderPos = [0, 0];

renderPos[index] = targetPos[index] + prevRect[mainNames.start]! - targetStart - size;
renderPos[otherIndex] = sidePos;

rendered.push(renderDigitLine(
moveable,
type,
"dashed",
rendered.length,
size,
renderPos,
guideline.className,
React
));
if (size > 0) {
const renderPos = [0, 0];

renderPos[index] = targetPos[index] + prevRect[mainNames.start]! - targetStart - size;
renderPos[otherIndex] = sidePos;

rendered.push(renderDigitLine(
moveable,
type,
"dashed",
rendered.length,
size,
renderPos,
guideline.className,
React
));
}
prevRect = nextRect;
});

prevRect = targetRect;
end.forEach(guideline => {
const nextRect = guideline.elementRect!.rect;
const size = nextRect[mainNames.start]! - prevRect[mainNames.end]!;
const renderPos = [0, 0];

renderPos[index] = targetPos[index] + prevRect[mainNames.end]! - targetStart;
renderPos[otherIndex] = sidePos;

rendered.push(renderDigitLine(
moveable,
type,
"dashed",
rendered.length,
size,
renderPos,
guideline.className,
React
));
if (size > 0) {
const renderPos = [0, 0];

renderPos[index] = targetPos[index] + prevRect[mainNames.end]! - targetStart;
renderPos[otherIndex] = sidePos;

rendered.push(renderDigitLine(
moveable,
type,
"dashed",
rendered.length,
size,
renderPos,
guideline.className,
React
));
}
prevRect = nextRect;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function triggerAble(
convertDragDist(moveable.state, e);
}
// const isGroup = eventAffix.indexOf("Group") > -1;
const ables: Able[] = [BeforeRenderable, ...(moveable as any)[ableType].slice(), Renderable];
const ables: Able[] = [BeforeRenderable, ...(moveable as any)[ableType], Renderable];

if (isRequest) {
const requestAble = e.requestAble;
Expand Down

0 comments on commit beec433

Please sign in to comment.