/** * The user selection rectangle gets displayed when a user drags the mouse while pressing shift */ import { XYPosition } from '../../types'; import { defineComponent, PropType } from 'vue-demi'; import store from '../../store'; type UserSelectionProps = { selectionKeyPressed: boolean; }; function getMousePosition(event: MouseEvent): XYPosition | void { const reactFlowNode = (event.target as Element).closest('.react-flow'); if (!reactFlowNode) { return; } const containerBounds = reactFlowNode.getBoundingClientRect(); return { x: event.clientX - containerBounds.left, y: event.clientY - containerBounds.top }; } const SelectionRect = defineComponent({ setup() { const pinia = store(); if (!pinia.userSelectionRect.draw) { return null; } return () => (
); } }); export default defineComponent({ components: { SelectionRect }, props: { selectionKeyPressed: { type: Boolean as PropType