Skip to content

Commit

Permalink
fix(imgui): touch event handling (FF/Safari)
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Aug 6, 2019
1 parent 588a321 commit af697d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/imgui/src/gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ export class IMGUI implements IToHiccup {

const setMouse = (e: MouseEvent | TouchEvent, mouse: Vec) => {
const b = (<HTMLCanvasElement>e.target).getBoundingClientRect();
const t = e instanceof TouchEvent ? e.touches[0] : e;
const t = (<TouchEvent>e).changedTouches
? (<TouchEvent>e).changedTouches[0]
: <MouseEvent>e;
setC2(mouse, t.clientX - b.left, t.clientY - b.top);
};

0 comments on commit af697d9

Please sign in to comment.