Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {
  createClickHandler,
  createMouseDownHandler,
  createMouseMoveHandler,
  createMouseUpHandler,
} from "./mouseHandlers";
import type { EventHandlerProps, EventHandlers } from "./types";
 
export function createEventHandlers(props: EventHandlerProps): EventHandlers {
  // Track if we've already handled selection in mousedown to prevent click from re-selecting
  const handledSelectionInMouseDown = { current: false };
 
  return {
    handleLayerMouseDown: createMouseDownHandler(props, handledSelectionInMouseDown),
    handleLayerClick: createClickHandler(props, handledSelectionInMouseDown),
    handleLayerMouseMove: createMouseMoveHandler(props, handledSelectionInMouseDown),
    handleLayerMouseUp: createMouseUpHandler(props),
  };
}
 
// Re-export types and utilities for convenience
export type { EventHandlerProps, EventHandlers } from "./types";
export * from "./utils";
export * from "./pointSelection";
export * from "./drawing";
 
// Re-export the unified point addition functions
export {
  addPoint,
  addPointFromGhostDrag,
  addBezierPoint,
  addPointAtPosition,
  type AddPointOptions,
} from "./drawing";