mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
limit which linear elements can be switched
This commit is contained in:
parent
beb0bd1528
commit
8e9e0e2709
2 changed files with 48 additions and 14 deletions
|
@ -379,8 +379,29 @@ export const getSwitchableTypeFromElements = (
|
|||
}
|
||||
|
||||
if (onlyLinear) {
|
||||
// check at least some linear element is switchable
|
||||
// for a linear to be swtichable:
|
||||
// - no labels
|
||||
// - not bound to anything
|
||||
|
||||
let linear = true;
|
||||
|
||||
for (const element of elements) {
|
||||
if (
|
||||
isArrowElement(element) &&
|
||||
(element.startBinding !== null || element.endBinding !== null)
|
||||
) {
|
||||
linear = false;
|
||||
} else if (element.boundElements && element.boundElements.length > 0) {
|
||||
linear = false;
|
||||
} else {
|
||||
linear = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
linear: true,
|
||||
linear,
|
||||
generic: false,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue