mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Reverse refactor
This commit is contained in:
parent
2605c3f962
commit
9ab7e55377
8 changed files with 31 additions and 43 deletions
|
@ -11,13 +11,8 @@ import type Scene from "@excalidraw/element/Scene";
|
|||
|
||||
import { angleIcon } from "../icons";
|
||||
|
||||
import DragInput from "./DragInput";
|
||||
import {
|
||||
type DragInputCallbackType,
|
||||
getStepSizedValue,
|
||||
isPropertyEditable,
|
||||
updateBindings,
|
||||
} from "./utils";
|
||||
import DragInput, { type DragInputCallbackType } from "./DragInput";
|
||||
import { getStepSizedValue, isPropertyEditable, updateBindings } from "./utils";
|
||||
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
|
|
|
@ -12,12 +12,8 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|||
|
||||
import type Scene from "@excalidraw/element/Scene";
|
||||
|
||||
import DragInput from "./DragInput";
|
||||
import {
|
||||
type DragInputCallbackType,
|
||||
getStepSizedValue,
|
||||
isPropertyEditable,
|
||||
} from "./utils";
|
||||
import DragInput, { type DragInputCallbackType } from "./DragInput";
|
||||
import { getStepSizedValue, isPropertyEditable } from "./utils";
|
||||
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
|
|
|
@ -13,13 +13,30 @@ import { CaptureUpdateAction } from "../../store";
|
|||
import { useApp } from "../App";
|
||||
import { InlineIcon } from "../InlineIcon";
|
||||
|
||||
import { type DragInputCallbackType, SMALLEST_DELTA } from "./utils";
|
||||
import { SMALLEST_DELTA } from "./utils";
|
||||
|
||||
import "./DragInput.scss";
|
||||
|
||||
import type { StatsInputProperty } from "./utils";
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
export type DragInputCallbackType<
|
||||
P extends StatsInputProperty,
|
||||
E = ExcalidrawElement,
|
||||
> = (props: {
|
||||
accumulatedChange: number;
|
||||
instantChange: number;
|
||||
originalElements: readonly E[];
|
||||
originalElementsMap: ElementsMap;
|
||||
shouldKeepAspectRatio: boolean;
|
||||
shouldChangeByStepSize: boolean;
|
||||
scene: Scene;
|
||||
nextValue?: number;
|
||||
property: P;
|
||||
originalAppState: AppState;
|
||||
setInputValue: (value: number) => void;
|
||||
}) => void;
|
||||
|
||||
interface StatsDragInputProps<
|
||||
T extends StatsInputProperty,
|
||||
E = ExcalidrawElement,
|
||||
|
|
|
@ -16,8 +16,8 @@ import type Scene from "@excalidraw/element/Scene";
|
|||
|
||||
import { fontSizeIcon } from "../icons";
|
||||
|
||||
import StatsDragInput from "./DragInput";
|
||||
import { type DragInputCallbackType, getStepSizedValue } from "./utils";
|
||||
import StatsDragInput, { type DragInputCallbackType } from "./DragInput";
|
||||
import { getStepSizedValue } from "./utils";
|
||||
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
|
|
|
@ -13,12 +13,8 @@ import type Scene from "@excalidraw/element/Scene";
|
|||
|
||||
import { angleIcon } from "../icons";
|
||||
|
||||
import DragInput from "./DragInput";
|
||||
import {
|
||||
type DragInputCallbackType,
|
||||
getStepSizedValue,
|
||||
isPropertyEditable,
|
||||
} from "./utils";
|
||||
import DragInput, { type DragInputCallbackType } from "./DragInput";
|
||||
import { getStepSizedValue, isPropertyEditable } from "./utils";
|
||||
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ import type {
|
|||
|
||||
import type Scene from "@excalidraw/element/Scene";
|
||||
|
||||
import DragInput from "./DragInput";
|
||||
import DragInput, { type DragInputCallbackType } from "./DragInput";
|
||||
import { getAtomicUnits, getStepSizedValue, isPropertyEditable } from "./utils";
|
||||
import { type DragInputCallbackType, getElementsInAtomicUnit } from "./utils";
|
||||
import { getElementsInAtomicUnit } from "./utils";
|
||||
|
||||
import type { AtomicUnit } from "./utils";
|
||||
import type { AppState } from "../../types";
|
||||
|
|
|
@ -19,8 +19,8 @@ import type Scene from "@excalidraw/element/Scene";
|
|||
|
||||
import { fontSizeIcon } from "../icons";
|
||||
|
||||
import StatsDragInput from "./DragInput";
|
||||
import { DragInputCallbackType, getStepSizedValue } from "./utils";
|
||||
import StatsDragInput, { type DragInputCallbackType } from "./DragInput";
|
||||
import { getStepSizedValue } from "./utils";
|
||||
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import type {
|
|||
import type Scene from "@excalidraw/element/Scene";
|
||||
|
||||
import type { AppState } from "../../types";
|
||||
import type { DragInputCallbackType } from "./DragInput";
|
||||
|
||||
export type StatsInputProperty =
|
||||
| "x"
|
||||
|
@ -41,23 +42,6 @@ export type StatsInputProperty =
|
|||
| "fontSize"
|
||||
| "gridStep";
|
||||
|
||||
export type DragInputCallbackType<
|
||||
P extends StatsInputProperty,
|
||||
E = ExcalidrawElement,
|
||||
> = (props: {
|
||||
accumulatedChange: number;
|
||||
instantChange: number;
|
||||
originalElements: readonly E[];
|
||||
originalElementsMap: ElementsMap;
|
||||
shouldKeepAspectRatio: boolean;
|
||||
shouldChangeByStepSize: boolean;
|
||||
scene: Scene;
|
||||
nextValue?: number;
|
||||
property: P;
|
||||
originalAppState: AppState;
|
||||
setInputValue: (value: number) => void;
|
||||
}) => void;
|
||||
|
||||
export const SMALLEST_DELTA = 0.01;
|
||||
|
||||
export const isPropertyEditable = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue