Resize handler detection should not be active when moving multip… (#767)
* Fix bug. * Implement `getSelectedElements`. * Explicit condition. * Respect variable naming. * Keep state consistent. * Use `isSomeElementSelected` abstraction. * Missing ones.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { Action } from "./types";
|
||||
import { deleteSelectedElements } from "../scene";
|
||||
import { deleteSelectedElements, isSomeElementSelected } from "../scene";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
export const actionDeleteSelected: Action = {
|
||||
@ -12,6 +12,6 @@ export const actionDeleteSelected: Action = {
|
||||
},
|
||||
contextItemLabel: "labels.delete",
|
||||
contextMenuOrder: 3,
|
||||
commitToHistory: (_, elements) => elements.some(el => el.isSelected),
|
||||
commitToHistory: (_, elements) => isSomeElementSelected(elements),
|
||||
keyTest: event => event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE,
|
||||
};
|
||||
|
@ -1,7 +1,10 @@
|
||||
import React from "react";
|
||||
import { Action } from "./types";
|
||||
import { ExcalidrawElement, ExcalidrawTextElement } from "../element/types";
|
||||
import { getCommonAttributeOfSelectedElements } from "../scene";
|
||||
import {
|
||||
getCommonAttributeOfSelectedElements,
|
||||
isSomeElementSelected,
|
||||
} from "../scene";
|
||||
import { ButtonSelect } from "../components/ButtonSelect";
|
||||
import { isTextElement, redrawTextBoundingBox } from "../element";
|
||||
import { ColorPicker } from "../components/ColorPicker";
|
||||
@ -28,7 +31,7 @@ const getFormValue = function<T>(
|
||||
): T | null {
|
||||
return (
|
||||
(editingElement && getAttribute(editingElement)) ??
|
||||
(elements.some(element => element.isSelected)
|
||||
(isSomeElementSelected(elements)
|
||||
? getCommonAttributeOfSelectedElements(elements, getAttribute)
|
||||
: defaultValue) ??
|
||||
null
|
||||
|
Reference in New Issue
Block a user