2020-03-17 20:55:40 +01:00
|
|
|
import {
|
|
|
|
ExcalidrawElement,
|
|
|
|
ExcalidrawTextElement,
|
|
|
|
ExcalidrawLinearElement,
|
|
|
|
} from "./types";
|
2020-01-06 19:34:22 +04:00
|
|
|
|
|
|
|
export function isTextElement(
|
2020-01-24 12:04:54 +02:00
|
|
|
element: ExcalidrawElement,
|
2020-01-06 19:34:22 +04:00
|
|
|
): element is ExcalidrawTextElement {
|
|
|
|
return element.type === "text";
|
|
|
|
}
|
2020-02-24 15:21:13 +01:00
|
|
|
|
2020-03-17 20:55:40 +01:00
|
|
|
export function isLinearElement(
|
|
|
|
element?: ExcalidrawElement | null,
|
|
|
|
): element is ExcalidrawLinearElement {
|
|
|
|
return (
|
|
|
|
element != null && (element.type === "arrow" || element.type === "line")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-02-24 15:21:13 +01:00
|
|
|
export function isExcalidrawElement(element: any): boolean {
|
|
|
|
return (
|
|
|
|
element?.type === "text" ||
|
|
|
|
element?.type === "diamond" ||
|
|
|
|
element?.type === "rectangle" ||
|
|
|
|
element?.type === "ellipse" ||
|
|
|
|
element?.type === "arrow" ||
|
|
|
|
element?.type === "line"
|
|
|
|
);
|
|
|
|
}
|