mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Element locking (#4964)
Co-authored-by: dwelle <luzar.david@gmail.com> Co-authored-by: Zsolt Viczian <viczian.zsolt@gmail.com>
This commit is contained in:
parent
c2fce6d8c4
commit
327ed0e2d1
31 changed files with 1066 additions and 53 deletions
|
@ -15,6 +15,7 @@ import path from "path";
|
|||
import { getMimeType } from "../../data/blob";
|
||||
import { newFreeDrawElement } from "../../element/newElement";
|
||||
import { Point } from "../../types";
|
||||
import { getSelectedElements } from "../../scene/selection";
|
||||
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
|
||||
|
@ -30,10 +31,10 @@ export class API {
|
|||
});
|
||||
};
|
||||
|
||||
static getSelectedElements = (): ExcalidrawElement[] => {
|
||||
return h.elements.filter(
|
||||
(element) => h.state.selectedElementIds[element.id],
|
||||
);
|
||||
static getSelectedElements = (
|
||||
includeBoundTextElement: boolean = false,
|
||||
): ExcalidrawElement[] => {
|
||||
return getSelectedElements(h.elements, h.state, includeBoundTextElement);
|
||||
};
|
||||
|
||||
static getSelectedElement = (): ExcalidrawElement => {
|
||||
|
@ -100,6 +101,7 @@ export class API {
|
|||
? ExcalidrawTextElement["containerId"]
|
||||
: never;
|
||||
points?: T extends "arrow" | "line" ? readonly Point[] : never;
|
||||
locked?: boolean;
|
||||
}): T extends "arrow" | "line"
|
||||
? ExcalidrawLinearElement
|
||||
: T extends "freedraw"
|
||||
|
@ -125,6 +127,7 @@ export class API {
|
|||
roughness: rest.roughness ?? appState.currentItemRoughness,
|
||||
opacity: rest.opacity ?? appState.currentItemOpacity,
|
||||
boundElements: rest.boundElements ?? null,
|
||||
locked: rest.locked ?? false,
|
||||
};
|
||||
switch (type) {
|
||||
case "rectangle":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue