mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: Refactor and remove scene from elbow arrow generation (#8342)
* Refactor and remove scene from elbow arrow generation
This commit is contained in:
parent
72d6ee48fc
commit
dd1370381d
18 changed files with 115 additions and 156 deletions
|
@ -1,7 +1,6 @@
|
|||
import type { AppStateChange, ElementsChange } from "./change";
|
||||
import type { SceneElementsMap } from "./element/types";
|
||||
import { Emitter } from "./emitter";
|
||||
import type Scene from "./scene/Scene";
|
||||
import type { Snapshot } from "./store";
|
||||
import type { AppState } from "./types";
|
||||
|
||||
|
@ -65,7 +64,6 @@ export class History {
|
|||
elements: SceneElementsMap,
|
||||
appState: AppState,
|
||||
snapshot: Readonly<Snapshot>,
|
||||
scene: Scene,
|
||||
) {
|
||||
return this.perform(
|
||||
elements,
|
||||
|
@ -73,7 +71,6 @@ export class History {
|
|||
snapshot,
|
||||
() => History.pop(this.undoStack),
|
||||
(entry: HistoryEntry) => History.push(this.redoStack, entry, elements),
|
||||
scene,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -81,7 +78,6 @@ export class History {
|
|||
elements: SceneElementsMap,
|
||||
appState: AppState,
|
||||
snapshot: Readonly<Snapshot>,
|
||||
scene: Scene,
|
||||
) {
|
||||
return this.perform(
|
||||
elements,
|
||||
|
@ -89,7 +85,6 @@ export class History {
|
|||
snapshot,
|
||||
() => History.pop(this.redoStack),
|
||||
(entry: HistoryEntry) => History.push(this.undoStack, entry, elements),
|
||||
scene,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -99,7 +94,6 @@ export class History {
|
|||
snapshot: Readonly<Snapshot>,
|
||||
pop: () => HistoryEntry | null,
|
||||
push: (entry: HistoryEntry) => void,
|
||||
scene: Scene,
|
||||
): [SceneElementsMap, AppState] | void {
|
||||
try {
|
||||
let historyEntry = pop();
|
||||
|
@ -116,7 +110,7 @@ export class History {
|
|||
while (historyEntry) {
|
||||
try {
|
||||
[nextElements, nextAppState, containsVisibleChange] =
|
||||
historyEntry.applyTo(nextElements, nextAppState, snapshot, scene);
|
||||
historyEntry.applyTo(nextElements, nextAppState, snapshot);
|
||||
} finally {
|
||||
// make sure to always push / pop, even if the increment is corrupted
|
||||
push(historyEntry);
|
||||
|
@ -187,10 +181,9 @@ export class HistoryEntry {
|
|||
elements: SceneElementsMap,
|
||||
appState: AppState,
|
||||
snapshot: Readonly<Snapshot>,
|
||||
scene: Scene,
|
||||
): [SceneElementsMap, AppState, boolean] {
|
||||
const [nextElements, elementsContainVisibleChange] =
|
||||
this.elementsChange.applyTo(elements, snapshot.elements, scene);
|
||||
this.elementsChange.applyTo(elements, snapshot.elements);
|
||||
|
||||
const [nextAppState, appStateContainsVisibleChange] =
|
||||
this.appStateChange.applyTo(appState, nextElements);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue