Fix group element removing (#1676)

This commit is contained in:
David Luzar 2020-05-30 22:48:57 +02:00 committed by GitHub
parent 17e9cc4506
commit f413bab3de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 478 additions and 43 deletions

View file

@ -30,7 +30,6 @@ import {
isNonDeletedElement,
} from "../element";
import {
deleteSelectedElements,
getElementsWithinSelection,
isOverScrollBars,
getElementAtPosition,
@ -126,7 +125,7 @@ import { invalidateShapeForElement } from "../renderer/renderElement";
import { unstable_batchedUpdates } from "react-dom";
import { SceneStateCallbackRemover } from "../scene/globalScene";
import { isLinearElement } from "../element/typeChecks";
import { actionFinalize } from "../actions";
import { actionFinalize, actionDeleteSelected } from "../actions";
import {
restoreUsernameFromLocalStorage,
saveUsernameToLocalStorage,
@ -593,13 +592,7 @@ class App extends React.Component<any, AppState> {
return;
}
this.copyAll();
const { elements: nextElements, appState } = deleteSelectedElements(
globalSceneState.getElementsIncludingDeleted(),
this.state,
);
globalSceneState.replaceAllElements(nextElements);
history.resumeRecording();
this.setState({ ...appState });
this.actionManager.executeAction(actionDeleteSelected);
event.preventDefault();
});