Skip to content

Commit

Permalink
small fix for touch controls
Browse files Browse the repository at this point in the history
  • Loading branch information
moskopio committed Nov 22, 2024
1 parent 6b3d84d commit ac3b88c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "object-webgl",
"name": "react-obj",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "tsc && vite build",
"lint": "eslint --config eslint.config.js src",
"test": "vitest run",
Expand Down
1 change: 1 addition & 0 deletions src/components/Divider.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
align-items: center;
height: 16px;
color: var(--highlight-color);
user-select: none;
}

.divider::before {
Expand Down
3 changes: 1 addition & 2 deletions src/preview/hooks/camera-controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function useCameraControls(): void {
const position = useRef([0, 0])

useEffect(() => {
// TODO: touch gestures! It doesn't work well on mobile/tablet
window.addEventListener('pointerdown', onPointerDown)
window.addEventListener('contextmenu', onContextMenu)
window.addEventListener('wheel', onWheel, { passive: false })
Expand All @@ -33,8 +34,6 @@ export function useCameraControls(): void {
}

function onPointerDown(event: MouseEvent): void {
event.preventDefault()
event.stopImmediatePropagation()
if (event.type === 'contextmenu' || event.button === 2) {
shift.current = true
}
Expand Down

0 comments on commit ac3b88c

Please sign in to comment.