feat: prevents user highlighting while dragging

This commit is contained in:
Mark Mankarious
2023-08-10 19:40:41 +01:00
parent 494a6a0a7c
commit 7a5b99668b
3 changed files with 9 additions and 1 deletions

View File

@@ -3,6 +3,12 @@ import { InteractionReducer } from 'src/types';
export const DragItems: InteractionReducer = {
type: 'DRAG_ITEMS',
entry: (draftState) => {
draftState.rendererRef.style.userSelect = 'none';
},
exit: (draftState) => {
draftState.rendererRef.style.userSelect = 'auto';
},
mousemove: (draftState) => {
if (draftState.mode.type !== 'DRAG_ITEMS') return;

View File

@@ -87,7 +87,8 @@ export const useInteractionManager = () => {
mode,
scroll,
contextMenu,
itemControls
itemControls,
rendererRef: rendererRef.current
};
const getTransitionaryState = () => {

View File

@@ -15,6 +15,7 @@ export interface State {
scene: Scene;
contextMenu: ContextMenu;
itemControls: ItemControls;
rendererRef: HTMLElement;
}
export type InteractionReducerAction = (state: Draft<State>) => void;