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:
		@ -14,7 +14,7 @@ export const TEST_SETTINGS = {
 | 
			
		||||
  },
 | 
			
		||||
  modeling: {
 | 
			
		||||
    defaultUnit: 'in',
 | 
			
		||||
    mouseControls: 'KittyCAD',
 | 
			
		||||
    mouseControls: 'Zoo',
 | 
			
		||||
    cameraProjection: 'perspective',
 | 
			
		||||
    showDebugPanel: true,
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@ -105,7 +105,7 @@ export class CameraControls {
 | 
			
		||||
  pendingZoom: number | null = null
 | 
			
		||||
  pendingRotation: Vector2 | null = null
 | 
			
		||||
  pendingPan: Vector2 | null = null
 | 
			
		||||
  interactionGuards: MouseGuard = cameraMouseDragGuards.KittyCAD
 | 
			
		||||
  interactionGuards: MouseGuard = cameraMouseDragGuards.Zoo
 | 
			
		||||
  isFovAnimationInProgress = false
 | 
			
		||||
  perspectiveFovBeforeOrtho = 45
 | 
			
		||||
  get isPerspective() {
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ const noModifiersPressed = (e: MouseEvent) =>
 | 
			
		||||
  !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey
 | 
			
		||||
 | 
			
		||||
export type CameraSystem =
 | 
			
		||||
  | 'KittyCAD'
 | 
			
		||||
  | 'Zoo'
 | 
			
		||||
  | 'OnShape'
 | 
			
		||||
  | 'Trackpad Friendly'
 | 
			
		||||
  | 'Solidworks'
 | 
			
		||||
@ -19,7 +19,7 @@ export type CameraSystem =
 | 
			
		||||
  | 'AutoCAD'
 | 
			
		||||
 | 
			
		||||
export const cameraSystems: CameraSystem[] = [
 | 
			
		||||
  'KittyCAD',
 | 
			
		||||
  'Zoo',
 | 
			
		||||
  'OnShape',
 | 
			
		||||
  'Trackpad Friendly',
 | 
			
		||||
  'Solidworks',
 | 
			
		||||
@ -34,9 +34,8 @@ export function mouseControlsToCameraSystem(
 | 
			
		||||
  switch (mouseControl) {
 | 
			
		||||
    // TODO: understand why the values come back without underscores and fix the root cause
 | 
			
		||||
    // @ts-ignore: TS2678
 | 
			
		||||
    case 'kittycad':
 | 
			
		||||
    case 'kitty_cad':
 | 
			
		||||
      return 'KittyCAD'
 | 
			
		||||
    case 'zoo':
 | 
			
		||||
      return 'Zoo'
 | 
			
		||||
    // TODO: understand why the values come back without underscores and fix the root cause
 | 
			
		||||
    // @ts-ignore: TS2678
 | 
			
		||||
    case 'onshape':
 | 
			
		||||
@ -86,7 +85,7 @@ export const btnName = (e: MouseEvent) => ({
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
export const cameraMouseDragGuards: Record<CameraSystem, MouseGuard> = {
 | 
			
		||||
  KittyCAD: {
 | 
			
		||||
  Zoo: {
 | 
			
		||||
    pan: {
 | 
			
		||||
      description: 'Shift + Right click drag or middle click drag',
 | 
			
		||||
      callback: (e) =>
 | 
			
		||||
 | 
			
		||||
@ -283,7 +283,7 @@ export function createSettings() {
 | 
			
		||||
       * The controls for how to navigate the 3D view
 | 
			
		||||
       */
 | 
			
		||||
      mouseControls: new Setting<CameraSystem>({
 | 
			
		||||
        defaultValue: 'KittyCAD',
 | 
			
		||||
        defaultValue: 'Zoo',
 | 
			
		||||
        description: 'The controls for how to navigate the 3D view',
 | 
			
		||||
        validate: (v) => cameraSystems.includes(v as CameraSystem),
 | 
			
		||||
        hideOnLevel: 'project',
 | 
			
		||||
 | 
			
		||||
@ -380,9 +380,9 @@ impl From<UnitLength> for kittycad_modeling_cmds::units::UnitLength {
 | 
			
		||||
#[display(style = "snake_case")]
 | 
			
		||||
pub enum MouseControlType {
 | 
			
		||||
    #[default]
 | 
			
		||||
    #[display("kittycad")]
 | 
			
		||||
    #[serde(rename = "kittycad", alias = "KittyCAD")]
 | 
			
		||||
    KittyCad,
 | 
			
		||||
    #[display("zoo")]
 | 
			
		||||
    #[serde(rename = "zoo", alias = "Zoo", alias = "KittyCAD")]
 | 
			
		||||
    Zoo,
 | 
			
		||||
    #[display("onshape")]
 | 
			
		||||
    #[serde(rename = "onshape", alias = "OnShape")]
 | 
			
		||||
    OnShape,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user