Skip to content

Commit

Permalink
Move loading of OS setting to Home
Browse files Browse the repository at this point in the history
  • Loading branch information
jtran committed Oct 9, 2024
1 parent a8d12a3 commit 01cbd95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 1 addition & 9 deletions src/clientSideScene/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ import {
UnreliableSubscription,
} from 'lang/std/engineConnection'
import { EngineCommand } from 'lang/std/artifactGraph'
import {
cachedNaturalScrollDirection,
refreshNaturalScrollDirection,
toSync,
uuidv4,
} from 'lib/utils'
import { cachedNaturalScrollDirection, toSync, uuidv4 } from 'lib/utils'
import { deg2Rad } from 'lib/utils2d'
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
import * as TWEEN from '@tweenjs/tween.js'
Expand All @@ -39,9 +34,6 @@ const ORTHOGRAPHIC_CAMERA_SIZE = 20
const FRAMES_TO_ANIMATE_IN = 30
const ORTHOGRAPHIC_MAGIC_FOV = 4

// Load the setting from the OS.
refreshNaturalScrollDirection().catch(reportRejection)

const tempQuaternion = new Quaternion() // just used for maths

type interactionType = 'pan' | 'rotate' | 'zoom'
Expand Down
7 changes: 7 additions & 0 deletions src/routes/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import {
} from 'lib/desktop'
import { ProjectSearchBar, useProjectSearch } from 'components/ProjectSearchBar'
import { Project } from 'lib/project'
import { refreshNaturalScrollDirection } from 'lib/utils'
import { reportRejection } from 'lib/trap'
import { useFileSystemWatcher } from 'hooks/useFileSystemWatcher'
import { useProjectsLoader } from 'hooks/useProjectsLoader'

Expand All @@ -61,6 +63,11 @@ const Home = () => {
kclManager.cancelAllExecutions()
}, [])

useEffect(() => {
// Load OS setting.
refreshNaturalScrollDirection().catch(reportRejection)
}, [])

useHotkeys('backspace', (e) => {
e.preventDefault()
})
Expand Down

0 comments on commit 01cbd95

Please sign in to comment.