Skip to content

Commit

Permalink
Converted Stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Patty committed May 10, 2022
1 parent e68d38e commit 06364f2
Show file tree
Hide file tree
Showing 6 changed files with 359 additions and 286 deletions.
18 changes: 6 additions & 12 deletions src/components/Draggable/Draggable.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { MouseEventHandler, MutableRefObject, RefObject, WheelEventHandler } from "react";
import React, { HTMLProps, MutableRefObject, RefObject } from "react";
import { Coordinate, StageState } from "../../types";

interface DraggableProps {
children?: React.ReactNode;
type DraggableProps = Omit<HTMLProps<HTMLDivElement>, "onDrag" | "onDragEnd"> & {
stageState: StageState;
stageRect: RefObject<DOMRect>;
stageRect?: RefObject<DOMRect>;
onDragDelayStart?: (event: React.MouseEvent | React.TouchEvent) => void;
onDragStart?: (event: React.MouseEvent | React.TouchEvent) => void;
onDrag?: (coordinates: Coordinate, event: MouseEvent) => void;
Expand All @@ -14,12 +13,8 @@ interface DraggableProps {
disabled?: boolean;
delay?: number;
innerRef?: MutableRefObject<HTMLDivElement | null>;
className?: string;
style?: React.CSSProperties;
onContextMenu?: MouseEventHandler<HTMLDivElement>;
onDoubleClick?: MouseEventHandler<HTMLDivElement>;
onWheel?: WheelEventHandler<HTMLDivElement>;
}
id?: string;
};

const Draggable = ({
children,
Expand Down Expand Up @@ -131,8 +126,7 @@ const Draggable = ({
onDragDelayStart(e);
}
e.stopPropagation();
let x;
let y;
let x: number, y: number;
if ("ontouchstart" in window && (e as React.TouchEvent).touches) {
const touch = (e as React.TouchEvent).touches[0];
x = touch.clientX;
Expand Down
262 changes: 0 additions & 262 deletions src/components/Stage/Stage.js

This file was deleted.

Loading

0 comments on commit 06364f2

Please sign in to comment.