Update Camera Controls to Zoo (#4755)

* update camera controls to Zoo

* update e2e and initial settings

* update types and camera controls ts

* update mod.rs test

* update test, test locally
This commit is contained in:
Josh Gomez
2024-12-11 15:03:51 -08:00
committed by GitHub
parent 3804aca27e
commit 7bc8bae0ec
5 changed files with 11 additions and 12 deletions

View File

@ -14,7 +14,7 @@ export const TEST_SETTINGS = {
}, },
modeling: { modeling: {
defaultUnit: 'in', defaultUnit: 'in',
mouseControls: 'KittyCAD', mouseControls: 'Zoo',
cameraProjection: 'perspective', cameraProjection: 'perspective',
showDebugPanel: true, showDebugPanel: true,
}, },

View File

@ -105,7 +105,7 @@ export class CameraControls {
pendingZoom: number | null = null pendingZoom: number | null = null
pendingRotation: Vector2 | null = null pendingRotation: Vector2 | null = null
pendingPan: Vector2 | null = null pendingPan: Vector2 | null = null
interactionGuards: MouseGuard = cameraMouseDragGuards.KittyCAD interactionGuards: MouseGuard = cameraMouseDragGuards.Zoo
isFovAnimationInProgress = false isFovAnimationInProgress = false
perspectiveFovBeforeOrtho = 45 perspectiveFovBeforeOrtho = 45
get isPerspective() { get isPerspective() {

View File

@ -10,7 +10,7 @@ const noModifiersPressed = (e: MouseEvent) =>
!e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey
export type CameraSystem = export type CameraSystem =
| 'KittyCAD' | 'Zoo'
| 'OnShape' | 'OnShape'
| 'Trackpad Friendly' | 'Trackpad Friendly'
| 'Solidworks' | 'Solidworks'
@ -19,7 +19,7 @@ export type CameraSystem =
| 'AutoCAD' | 'AutoCAD'
export const cameraSystems: CameraSystem[] = [ export const cameraSystems: CameraSystem[] = [
'KittyCAD', 'Zoo',
'OnShape', 'OnShape',
'Trackpad Friendly', 'Trackpad Friendly',
'Solidworks', 'Solidworks',
@ -34,9 +34,8 @@ export function mouseControlsToCameraSystem(
switch (mouseControl) { switch (mouseControl) {
// TODO: understand why the values come back without underscores and fix the root cause // TODO: understand why the values come back without underscores and fix the root cause
// @ts-ignore: TS2678 // @ts-ignore: TS2678
case 'kittycad': case 'zoo':
case 'kitty_cad': return 'Zoo'
return 'KittyCAD'
// TODO: understand why the values come back without underscores and fix the root cause // TODO: understand why the values come back without underscores and fix the root cause
// @ts-ignore: TS2678 // @ts-ignore: TS2678
case 'onshape': case 'onshape':
@ -86,7 +85,7 @@ export const btnName = (e: MouseEvent) => ({
}) })
export const cameraMouseDragGuards: Record<CameraSystem, MouseGuard> = { export const cameraMouseDragGuards: Record<CameraSystem, MouseGuard> = {
KittyCAD: { Zoo: {
pan: { pan: {
description: 'Shift + Right click drag or middle click drag', description: 'Shift + Right click drag or middle click drag',
callback: (e) => callback: (e) =>

View File

@ -283,7 +283,7 @@ export function createSettings() {
* The controls for how to navigate the 3D view * The controls for how to navigate the 3D view
*/ */
mouseControls: new Setting<CameraSystem>({ mouseControls: new Setting<CameraSystem>({
defaultValue: 'KittyCAD', defaultValue: 'Zoo',
description: 'The controls for how to navigate the 3D view', description: 'The controls for how to navigate the 3D view',
validate: (v) => cameraSystems.includes(v as CameraSystem), validate: (v) => cameraSystems.includes(v as CameraSystem),
hideOnLevel: 'project', hideOnLevel: 'project',

View File

@ -380,9 +380,9 @@ impl From<UnitLength> for kittycad_modeling_cmds::units::UnitLength {
#[display(style = "snake_case")] #[display(style = "snake_case")]
pub enum MouseControlType { pub enum MouseControlType {
#[default] #[default]
#[display("kittycad")] #[display("zoo")]
#[serde(rename = "kittycad", alias = "KittyCAD")] #[serde(rename = "zoo", alias = "Zoo", alias = "KittyCAD")]
KittyCad, Zoo,
#[display("onshape")] #[display("onshape")]
#[serde(rename = "onshape", alias = "OnShape")] #[serde(rename = "onshape", alias = "OnShape")]
OnShape, OnShape,