mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
support making transform handles optional
This commit is contained in:
parent
61699ff3c2
commit
3d0a1106ff
9 changed files with 133 additions and 48 deletions
|
@ -223,6 +223,7 @@ import {
|
|||
withBatchedUpdatesThrottled,
|
||||
updateObject,
|
||||
setEraserCursor,
|
||||
getCustomElementConfig,
|
||||
} from "../utils";
|
||||
import ContextMenu, { ContextMenuOption } from "./ContextMenu";
|
||||
import LayerUI from "./LayerUI";
|
||||
|
@ -422,10 +423,13 @@ class App extends React.Component<AppProps, AppState> {
|
|||
coords: { x: number; y: number },
|
||||
name: string = "",
|
||||
) => {
|
||||
const config = this.props.customElementsConfig!.find(
|
||||
(config) => config.name === name,
|
||||
)!;
|
||||
|
||||
const config = getCustomElementConfig(
|
||||
this.props.customElementsConfig,
|
||||
name,
|
||||
);
|
||||
if (!config) {
|
||||
return;
|
||||
}
|
||||
const [gridX, gridY] = getGridPoint(
|
||||
coords.x,
|
||||
coords.y,
|
||||
|
@ -3393,6 +3397,15 @@ class App extends React.Component<AppProps, AppState> {
|
|||
const elements = this.scene.getElements();
|
||||
const selectedElements = getSelectedElements(elements, this.state);
|
||||
if (selectedElements.length === 1 && !this.state.editingLinearElement) {
|
||||
if (selectedElements[0].type === "custom") {
|
||||
const config = getCustomElementConfig(
|
||||
this.props.customElementsConfig,
|
||||
selectedElements[0].name,
|
||||
);
|
||||
if (!config?.transformHandles) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const elementWithTransformHandleType =
|
||||
getElementWithTransformHandleType(
|
||||
elements,
|
||||
|
@ -4209,6 +4222,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
const elementsWithinSelection = getElementsWithinSelection(
|
||||
elements,
|
||||
draggingElement,
|
||||
this.props.customElementsConfig,
|
||||
);
|
||||
this.setState((prevState) =>
|
||||
selectGroupsForSelectedElements(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue