mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
improve & granularize ExcalidrawElement types (#991)
* improve & granularize ExcalidrawElement types * fix incorrectly passing type * fix tests * fix more tests * fix unnecessary spreads & refactor * add comments
This commit is contained in:
parent
1c545c1d47
commit
373d16abe6
22 changed files with 430 additions and 272 deletions
|
@ -5,6 +5,7 @@ import { getSelectedElements } from "../scene";
|
|||
|
||||
import "./HintViewer.scss";
|
||||
import { AppState } from "../types";
|
||||
import { isLinearElement } from "../element/typeChecks";
|
||||
|
||||
interface Hint {
|
||||
appState: AppState;
|
||||
|
@ -23,12 +24,8 @@ const getHints = ({ appState, elements }: Hint) => {
|
|||
|
||||
if (isResizing) {
|
||||
const selectedElements = getSelectedElements(elements, appState);
|
||||
if (
|
||||
selectedElements.length === 1 &&
|
||||
(selectedElements[0].type === "arrow" ||
|
||||
selectedElements[0].type === "line") &&
|
||||
selectedElements[0].points.length > 2
|
||||
) {
|
||||
const targetElement = selectedElements[0];
|
||||
if (isLinearElement(targetElement) && targetElement.points.length > 2) {
|
||||
return null;
|
||||
}
|
||||
return t("hints.resize");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue