Compare commits
4 Commits
master
...
frame-issu
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0bf1b4c4af | ||
![]() |
d9d1a3ab99 | ||
![]() |
c43d9d44f0 | ||
![]() |
c9af72e2ee |
@ -10,17 +10,12 @@ const shouldLock = (elements: readonly ExcalidrawElement[]) =>
|
|||||||
export const actionToggleElementLock = register({
|
export const actionToggleElementLock = register({
|
||||||
name: "toggleElementLock",
|
name: "toggleElementLock",
|
||||||
trackEvent: { category: "element" },
|
trackEvent: { category: "element" },
|
||||||
predicate: (elements, appState, _, app) => {
|
|
||||||
const selectedElements = app.scene.getSelectedElements(appState);
|
|
||||||
return !selectedElements.some(
|
|
||||||
(element) => element.locked && element.frameId,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
perform: (elements, appState, _, app) => {
|
perform: (elements, appState, _, app) => {
|
||||||
|
// Frames and their children should not be selected at the same time.
|
||||||
|
// Therefore, there's no need to include elements in frame in the selection.
|
||||||
const selectedElements = app.scene.getSelectedElements({
|
const selectedElements = app.scene.getSelectedElements({
|
||||||
selectedElementIds: appState.selectedElementIds,
|
selectedElementIds: appState.selectedElementIds,
|
||||||
includeBoundTextElement: true,
|
includeBoundTextElement: true,
|
||||||
includeElementsInFrames: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!selectedElements.length) {
|
if (!selectedElements.length) {
|
||||||
@ -31,7 +26,12 @@ export const actionToggleElementLock = register({
|
|||||||
const selectedElementsMap = arrayToMap(selectedElements);
|
const selectedElementsMap = arrayToMap(selectedElements);
|
||||||
return {
|
return {
|
||||||
elements: elements.map((element) => {
|
elements: elements.map((element) => {
|
||||||
if (!selectedElementsMap.has(element.id)) {
|
if (
|
||||||
|
!selectedElementsMap.has(element.id) &&
|
||||||
|
(!element.frameId ||
|
||||||
|
// lock frame children if frame is selected
|
||||||
|
(element.frameId && !selectedElementsMap.has(element.frameId)))
|
||||||
|
) {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1137,7 +1137,10 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
overflow: f.id === this.state.editingFrame ? "visible" : "hidden",
|
overflow: f.id === this.state.editingFrame ? "visible" : "hidden",
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
cursor: CURSOR_TYPE.MOVE,
|
cursor:
|
||||||
|
!f.locked && this.state.activeTool.type === "selection"
|
||||||
|
? CURSOR_TYPE.MOVE
|
||||||
|
: this.interactiveCanvas?.style.cursor,
|
||||||
pointerEvents: this.state.viewModeEnabled
|
pointerEvents: this.state.viewModeEnabled
|
||||||
? POINTER_EVENTS.disabled
|
? POINTER_EVENTS.disabled
|
||||||
: POINTER_EVENTS.enabled,
|
: POINTER_EVENTS.enabled,
|
||||||
|
@ -263,7 +263,6 @@ exports[`contextMenu element > right-clicking on a group should select whole gro
|
|||||||
"keyTest": [Function],
|
"keyTest": [Function],
|
||||||
"name": "toggleElementLock",
|
"name": "toggleElementLock",
|
||||||
"perform": [Function],
|
"perform": [Function],
|
||||||
"predicate": [Function],
|
|
||||||
"trackEvent": {
|
"trackEvent": {
|
||||||
"category": "element",
|
"category": "element",
|
||||||
},
|
},
|
||||||
@ -4847,7 +4846,6 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi
|
|||||||
"keyTest": [Function],
|
"keyTest": [Function],
|
||||||
"name": "toggleElementLock",
|
"name": "toggleElementLock",
|
||||||
"perform": [Function],
|
"perform": [Function],
|
||||||
"predicate": [Function],
|
|
||||||
"trackEvent": {
|
"trackEvent": {
|
||||||
"category": "element",
|
"category": "element",
|
||||||
},
|
},
|
||||||
@ -5427,7 +5425,6 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro
|
|||||||
"keyTest": [Function],
|
"keyTest": [Function],
|
||||||
"name": "toggleElementLock",
|
"name": "toggleElementLock",
|
||||||
"perform": [Function],
|
"perform": [Function],
|
||||||
"predicate": [Function],
|
|
||||||
"trackEvent": {
|
"trackEvent": {
|
||||||
"category": "element",
|
"category": "element",
|
||||||
},
|
},
|
||||||
@ -6345,7 +6342,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap
|
|||||||
"keyTest": [Function],
|
"keyTest": [Function],
|
||||||
"name": "toggleElementLock",
|
"name": "toggleElementLock",
|
||||||
"perform": [Function],
|
"perform": [Function],
|
||||||
"predicate": [Function],
|
|
||||||
"trackEvent": {
|
"trackEvent": {
|
||||||
"category": "element",
|
"category": "element",
|
||||||
},
|
},
|
||||||
@ -6719,7 +6715,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap
|
|||||||
"keyTest": [Function],
|
"keyTest": [Function],
|
||||||
"name": "toggleElementLock",
|
"name": "toggleElementLock",
|
||||||
"perform": [Function],
|
"perform": [Function],
|
||||||
"predicate": [Function],
|
|
||||||
"trackEvent": {
|
"trackEvent": {
|
||||||
"category": "element",
|
"category": "element",
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user