fix some element types reset to selection when the lock is active (#746)

* keep arrows and lines selected if locked

* keep element type selected if locked after inserting text

* ensure clicking outside doesn't create new text

* esc should switch to selection even if locked

* reset cursor when creating text via doubleClick

Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
lissitz 2020-02-10 15:09:50 +01:00 committed by GitHub
parent 1ec3946ed6
commit fa12125db0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 15 deletions

View file

@ -2,6 +2,7 @@ import { Action } from "./types";
import { KEYS } from "../keys";
import { clearSelection } from "../scene";
import { isInvisiblySmallElement } from "../element";
import { resetCursor } from "../utils";
export const actionFinalize: Action = {
name: "finalize",
@ -20,11 +21,17 @@ export const actionFinalize: Action = {
}
appState.multiElement.shape = null;
}
if (!appState.elementLocked || !appState.multiElement) {
resetCursor();
}
return {
elements: newElements,
appState: {
...appState,
elementType: "selection",
elementType:
appState.elementLocked && appState.multiElement
? appState.elementType
: "selection",
draggingElement: null,
multiElement: null,
},