Skip to content

Commit f116e9b

Browse files
committed
changed algo for state being dragged on touch devices such that state will be dropped at random x y coordinates within canvas
1 parent 05a539e commit f116e9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/Editor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const Editor = () => {
127127
];
128128
const [states, setStates] = useState<DraggableStateModel[]>([]);
129129
const [transitions, setTransitions] = useState<TransitionModel[]>([]);
130-
130+
131131
const [nullClosureRows, setNullClosureRows] = useState<RowModel[]>([]);
132132
const [modifiedTableRows, setModifiedTableRows] = useState<RowModel[]>([]);
133133

@@ -535,8 +535,8 @@ export const Editor = () => {
535535
let stateX: number, stateY: number;
536536
// check if event has touch data (mobile) or mouse data (desktop)
537537
if (e.touches) {
538-
stateX = e.touches[0].clientX - rect.x;
539-
stateY = e.touches[0].clientY - rect.y;
538+
stateX = Math.floor(Math.random() * playgroundSize.width);
539+
stateY = Math.floor(Math.random() * playgroundSize.height);
540540
} else {
541541
stateX = e.clientX - rect.x;
542542
stateY = e.clientY - rect.y;

0 commit comments

Comments
 (0)