Integrates #1487 - touch events

Need to add:
- Pinch zoom
- Touch-specific handling (some things aren't quite right)
This commit is contained in:
psychedelicious 2022-11-19 08:52:29 +11:00 committed by blessedcoolant
parent 87439feeb2
commit d82a21cfb2
2 changed files with 4 additions and 1 deletions

View File

@ -149,6 +149,9 @@ const IAICanvas = () => {
width={stageDimensions.width}
height={stageDimensions.height}
scale={{ x: stageScale, y: stageScale }}
onTouchStart={handleMouseDown}
onTouchMove={handleMouseMove}
onTouchEnd={handleMouseUp}
onMouseDown={handleMouseDown}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseOut}

View File

@ -31,7 +31,7 @@ const useCanvasMouseDown = (stageRef: MutableRefObject<Konva.Stage | null>) => {
const { tool, isStaging } = useAppSelector(selector);
return useCallback(
(e: KonvaEventObject<MouseEvent>) => {
(e: KonvaEventObject<MouseEvent | TouchEvent>) => {
if (!stageRef.current) return;
stageRef.current.container().focus();