mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
defined split array
This commit is contained in:
parent
14bca119f7
commit
c2867c9a93
4 changed files with 25 additions and 0 deletions
|
@ -1472,6 +1472,28 @@ export class LinearElementEditor {
|
|||
|
||||
return coords;
|
||||
};
|
||||
|
||||
static toggleSegmentSplitAtIndex(
|
||||
element: NonDeleted<ExcalidrawLinearElement>,
|
||||
appState: AppState,
|
||||
index: number,
|
||||
) {
|
||||
let found = false;
|
||||
const splitIndices = (element.segmentSplitIndices || []).filter((idx) => {
|
||||
if (idx === index) {
|
||||
found = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (!found) {
|
||||
splitIndices.push(index);
|
||||
}
|
||||
|
||||
mutateElement(element, {
|
||||
segmentSplitIndices: splitIndices,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const normalizeSelectedPoints = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue