update: use store injection in UserSelection component
fix: keypress not displaying working properly
This commit is contained in:
+4
-4
@@ -1,9 +1,9 @@
|
||||
import { Dimensions, XYPosition, NodeExtent } from '../types';
|
||||
import { DraggableEvent } from '@braks/revue-draggable';
|
||||
|
||||
export const isInputDOMNode = (e: MouseEvent | /* DraggableEvent | */ KeyboardEvent): boolean => {
|
||||
export const isInputDOMNode = (e: MouseEvent | DraggableEvent | KeyboardEvent): boolean => {
|
||||
const target = e.target as HTMLElement;
|
||||
|
||||
return ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON'].includes(target.nodeName) || target.hasAttribute('contenteditable');
|
||||
return ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON'].includes(target.nodeName) || target.hasAttribute('contentEditable');
|
||||
};
|
||||
|
||||
export const getDimensions = (node: HTMLDivElement): Dimensions => ({
|
||||
@@ -13,7 +13,7 @@ export const getDimensions = (node: HTMLDivElement): Dimensions => ({
|
||||
|
||||
export const clamp = (val: number, min = 0, max = 1): number => Math.min(Math.max(val, min), max);
|
||||
|
||||
export const clampPosition = (position: XYPosition, extent: NodeExtent) => ({
|
||||
export const clampPosition = (position: XYPosition, extent: NodeExtent): XYPosition => ({
|
||||
x: clamp(position.x, extent[0][0], extent[1][0]),
|
||||
y: clamp(position.y, extent[0][1], extent[1][1])
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user