Add a trackball camera setting (#4764)

* Add a setting that does nothing

* Make the setting actually change the interaction type

* fmt

* Bump `@kittycad/lib` to get the proper camera drag interaction types

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* Fix camera orientation bugs to support proper camera resetting on "camera orbit" setting change (#5031)

* Add a setting that does nothing

* Make the setting actually change the interaction type

* fmt

* fix: up vector bug fix and camera reset fix. Pushing code to cleanup after debugging

* fix: deleting debugging code

* fix: removing debugging code

* fix: removing debugging console log

* fix: removing console log debugs

* fix: adding comment, restoring code from debugging

* fix: removed lookAt when the orientation is already set from the engine.. I do not think we should be recomputing it?

* fix: this fixes the bug because I was pointing to the getter not the value

* Remove unused imports

* Fix lint for unawaited Promise

* Remove pointless change

---------

Co-authored-by: Frank Noirot <frank@kittycad.io>
Co-authored-by: Frank Noirot <frankjohnson1993@gmail.com>

* Re-run CI

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* Re-run CI

* Add display attributes to try to fix cargo test

* Remove backwards compat test case

it's failing because I didn't add cameraOrbit to that type and I don't
want to

* Fix test value (prev user value would have been Spherical before Trackball)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
This commit is contained in:
Frank Noirot
2025-02-01 15:03:04 -05:00
committed by GitHub
parent 229433126d
commit f1a458f124
9 changed files with 81 additions and 7 deletions

View File

@ -20,6 +20,7 @@ import { toSync } from 'lib/utils'
import { reportRejection } from 'lib/trap'
import { CameraProjectionType } from 'wasm-lib/kcl/bindings/CameraProjectionType'
import { OnboardingStatus } from 'wasm-lib/kcl/bindings/OnboardingStatus'
import { CameraOrbitType } from 'wasm-lib/kcl/bindings/CameraOrbitType'
/**
* A setting that can be set at the user or project level
@ -380,6 +381,30 @@ export function createSettings() {
})),
},
}),
/**
* What methodology to use for orbiting the camera
*/
cameraOrbit: new Setting<CameraOrbitType>({
defaultValue: 'spherical',
hideOnLevel: 'project',
description: 'What methodology to use for orbiting the camera',
validate: (v) => ['spherical', 'trackball'].includes(v),
commandConfig: {
inputType: 'options',
defaultValueFromContext: (context) =>
context.modeling.cameraOrbit.current,
options: (cmdContext, settingsContext) =>
(['spherical', 'trackball'] as const).map((v) => ({
name: v.charAt(0).toUpperCase() + v.slice(1),
value: v,
isCurrent:
settingsContext.modeling.cameraOrbit.shouldShowCurrentLabel(
cmdContext.argumentsToSubmit.level as SettingsLevel,
v
),
})),
},
}),
/**
* Whether to highlight edges of 3D objects
*/