mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
render and toggle split points for linear elements as well
This commit is contained in:
parent
4372e992e0
commit
bf7c91536f
2 changed files with 18 additions and 14 deletions
|
@ -266,6 +266,16 @@ const renderSingleLinearPoint = (
|
|||
}
|
||||
};
|
||||
|
||||
const isLinearPointAtIndexSquared = (
|
||||
element: NonDeleted<ExcalidrawLinearElement>,
|
||||
index: number,
|
||||
) => {
|
||||
const splitting = element.segmentSplitIndices
|
||||
? element.segmentSplitIndices.includes(index)
|
||||
: false;
|
||||
return element.roundness ? splitting : !splitting;
|
||||
};
|
||||
|
||||
const renderLinearPointHandles = (
|
||||
context: CanvasRenderingContext2D,
|
||||
appState: InteractiveCanvasAppState,
|
||||
|
@ -287,19 +297,13 @@ const renderLinearPointHandles = (
|
|||
const isSelected =
|
||||
!!appState.editingLinearElement?.selectedPointsIndices?.includes(idx);
|
||||
|
||||
const segmented = element.roundness
|
||||
? element.segmentSplitIndices
|
||||
? element.segmentSplitIndices.includes(idx)
|
||||
: false
|
||||
: false;
|
||||
|
||||
renderSingleLinearPoint(
|
||||
context,
|
||||
appState,
|
||||
point,
|
||||
radius,
|
||||
isSelected,
|
||||
segmented,
|
||||
isLinearPointAtIndexSquared(element, idx),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -393,15 +397,15 @@ const renderLinearElementPointHighlight = (
|
|||
element,
|
||||
hoverPointIndex,
|
||||
);
|
||||
const segmented = element.roundness
|
||||
? element.segmentSplitIndices
|
||||
? element.segmentSplitIndices.includes(hoverPointIndex)
|
||||
: false
|
||||
: false;
|
||||
|
||||
context.save();
|
||||
context.translate(appState.scrollX, appState.scrollY);
|
||||
highlightPoint(point, context, appState, segmented);
|
||||
highlightPoint(
|
||||
point,
|
||||
context,
|
||||
appState,
|
||||
isLinearPointAtIndexSquared(element, hoverPointIndex),
|
||||
);
|
||||
context.restore();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue