refactor: rename draggingElement -> newElement (#8294)

* add newElement to appState

* freedraw should not be an editing element

* do not set editing element for freedraw and generic

* remove ununsed `appState.draggingElement`

* remove setting dragged for new linear element

* decouple selection element from new element

* fix hint for text bindables

* update snapshot

* fixes

* fix frame regressions

* add comments to types

* document `editingElement`

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Ryan Di
2024-08-06 19:26:06 +08:00
committed by GitHub
parent 8d530cf102
commit 3cf14c73a3
17 changed files with 554 additions and 684 deletions

View File

@@ -151,10 +151,7 @@ export class LinearElementEditor {
setState: React.Component<any, AppState>["setState"],
elementsMap: NonDeletedSceneElementsMap,
) {
if (
!appState.editingLinearElement ||
appState.draggingElement?.type !== "selection"
) {
if (!appState.editingLinearElement || !appState.selectionElement) {
return false;
}
const { editingLinearElement } = appState;
@@ -166,7 +163,7 @@ export class LinearElementEditor {
}
const [selectionX1, selectionY1, selectionX2, selectionY2] =
getElementAbsoluteCoords(appState.draggingElement, elementsMap);
getElementAbsoluteCoords(appState.selectionElement, elementsMap);
const pointsSceneCoords = LinearElementEditor.getPointsGlobalCoordinates(
element,