fix hit testing for custom elements
This commit is contained in:
parent
8706277d14
commit
47498796e0
@ -33,13 +33,20 @@ import { Point } from "../types";
|
|||||||
import { Drawable } from "roughjs/bin/core";
|
import { Drawable } from "roughjs/bin/core";
|
||||||
import { AppState } from "../types";
|
import { AppState } from "../types";
|
||||||
import { getShapeForElement } from "../renderer/renderElement";
|
import { getShapeForElement } from "../renderer/renderElement";
|
||||||
import { hasBoundTextElement, isImageElement } from "./typeChecks";
|
import {
|
||||||
|
hasBoundTextElement,
|
||||||
|
isCustomElement,
|
||||||
|
isImageElement,
|
||||||
|
} from "./typeChecks";
|
||||||
import { isTextElement } from ".";
|
import { isTextElement } from ".";
|
||||||
import { isTransparent } from "../utils";
|
import { isTransparent } from "../utils";
|
||||||
|
|
||||||
const isElementDraggableFromInside = (
|
const isElementDraggableFromInside = (
|
||||||
element: NonDeletedExcalidrawElement,
|
element: NonDeletedExcalidrawElement,
|
||||||
): boolean => {
|
): boolean => {
|
||||||
|
if (isCustomElement(element)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (element.type === "arrow") {
|
if (element.type === "arrow") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
ExcalidrawImageElement,
|
ExcalidrawImageElement,
|
||||||
ExcalidrawTextElementWithContainer,
|
ExcalidrawTextElementWithContainer,
|
||||||
ExcalidrawTextContainer,
|
ExcalidrawTextContainer,
|
||||||
|
ExcalidrawCustomElement,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
|
||||||
export const isGenericElement = (
|
export const isGenericElement = (
|
||||||
@ -133,3 +134,7 @@ export const isBoundToContainer = (
|
|||||||
element !== null && isTextElement(element) && element.containerId !== null
|
element !== null && isTextElement(element) && element.containerId !== null
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isCustomElement = (
|
||||||
|
element: ExcalidrawElement,
|
||||||
|
): element is ExcalidrawCustomElement => element && element.type === "custom";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user