mirror of
				https://github.com/excalidraw/excalidraw.git
				synced 2025-10-31 19:04:35 +01:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			v0.17.5
			...
			frame-issu
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 0bf1b4c4af | ||
|   | d9d1a3ab99 | ||
|   | c43d9d44f0 | ||
|   | c9af72e2ee | 
| @@ -10,17 +10,12 @@ const shouldLock = (elements: readonly ExcalidrawElement[]) => | ||||
| export const actionToggleElementLock = register({ | ||||
|   name: "toggleElementLock", | ||||
|   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) => { | ||||
|     // 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({ | ||||
|       selectedElementIds: appState.selectedElementIds, | ||||
|       includeBoundTextElement: true, | ||||
|       includeElementsInFrames: true, | ||||
|     }); | ||||
|  | ||||
|     if (!selectedElements.length) { | ||||
| @@ -31,7 +26,12 @@ export const actionToggleElementLock = register({ | ||||
|     const selectedElementsMap = arrayToMap(selectedElements); | ||||
|     return { | ||||
|       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; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -1137,7 +1137,10 @@ class App extends React.Component<AppProps, AppState> { | ||||
|             overflow: f.id === this.state.editingFrame ? "visible" : "hidden", | ||||
|             whiteSpace: "nowrap", | ||||
|             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 | ||||
|               ? POINTER_EVENTS.disabled | ||||
|               : POINTER_EVENTS.enabled, | ||||
|   | ||||
| @@ -263,7 +263,6 @@ exports[`contextMenu element > right-clicking on a group should select whole gro | ||||
|         "keyTest": [Function], | ||||
|         "name": "toggleElementLock", | ||||
|         "perform": [Function], | ||||
|         "predicate": [Function], | ||||
|         "trackEvent": { | ||||
|           "category": "element", | ||||
|         }, | ||||
| @@ -4847,7 +4846,6 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi | ||||
|         "keyTest": [Function], | ||||
|         "name": "toggleElementLock", | ||||
|         "perform": [Function], | ||||
|         "predicate": [Function], | ||||
|         "trackEvent": { | ||||
|           "category": "element", | ||||
|         }, | ||||
| @@ -5427,7 +5425,6 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro | ||||
|         "keyTest": [Function], | ||||
|         "name": "toggleElementLock", | ||||
|         "perform": [Function], | ||||
|         "predicate": [Function], | ||||
|         "trackEvent": { | ||||
|           "category": "element", | ||||
|         }, | ||||
| @@ -6345,7 +6342,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap | ||||
|         "keyTest": [Function], | ||||
|         "name": "toggleElementLock", | ||||
|         "perform": [Function], | ||||
|         "predicate": [Function], | ||||
|         "trackEvent": { | ||||
|           "category": "element", | ||||
|         }, | ||||
| @@ -6719,7 +6715,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap | ||||
|         "keyTest": [Function], | ||||
|         "name": "toggleElementLock", | ||||
|         "perform": [Function], | ||||
|         "predicate": [Function], | ||||
|         "trackEvent": { | ||||
|           "category": "element", | ||||
|         }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user