Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add menu item and hotkey to center view on current selection #4068

Merged
merged 17 commits into from
Oct 4, 2024

Conversation

mlfarrell
Copy link
Contributor

@mlfarrell mlfarrell commented Oct 1, 2024

Prerequisites

Adds a new modelingMachine event and action to send the new default_camera_center_to_selection engine command, and connects this event to the mod + shift + c hotkey and the view menu in the lower-right view controls

Copy link

qa-wolf bot commented Oct 1, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Oct 4, 2024 7:18pm

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
@franknoirot
Copy link
Collaborator

franknoirot commented Oct 2, 2024

I'm tagging in to do the following:

  • add this hotkey to the list of fixed hotkeys shown in the dialog
  • fmting and clean up (remove the log)
  • add an E2E test

@mlfarrell
Copy link
Contributor Author

my b on the log. i forgot to remove that

@franknoirot
Copy link
Collaborator

Oh it's nothing at all, not to worry

@franknoirot
Copy link
Collaborator

I think the last thing this needs is a bump to the @kittycad/lib so that tsc doesn't yell at us for using the newfangled default_camera_center_to_selection command

@franknoirot franknoirot removed their request for review October 3, 2024 17:49
@franknoirot
Copy link
Collaborator

franknoirot commented Oct 3, 2024

@jtran, @nadr0 or @lf94 do you mind reviewing this? I don't think I should since I contributed to it

@franknoirot franknoirot changed the title Center to selection hotkey Add menu item and hotkey to center view on current selection Oct 3, 2024
@franknoirot franknoirot self-assigned this Oct 3, 2024
@franknoirot franknoirot requested review from lf94 and nadr0 and removed request for Irev-Dev and jessfraz October 3, 2024 18:31
@lf94
Copy link
Contributor

lf94 commented Oct 3, 2024

Oh shit yes, first thing in the morning!

/** Forces a refresh of the camera position and target displayed
* in the debug panel and then returns the values of the fields
*/
async getCameraInfo() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love our new fixture stuff :')

@@ -1,18 +1,18 @@
import { test, expect } from '@playwright/test'

import { _test, _expect } from './playwright-deprecated'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mustve missed the memo - what's going on here? :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll undo this change in a separate PR per Slack discussion

Comment on lines +248 to +256
engineCommandManager
.sendSceneCommand({
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
type: 'default_camera_center_to_selection',
},
})
.catch(reportRejection)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO should be in the CameraControls file but we can refactor later!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah good idea, that's better

Copy link
Contributor

@lf94 lf94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code reviewed and tested locally.

I noticed the center does not reset when there are no more models, but this is not a blocker.

import { test, expect } from '@playwright/test'

import { _test, _expect } from './playwright-deprecated'
import { test } from './fixtures/fixtureSetup'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we revert this name change and do something like

import { test, expect } from '@playwright/test'
import { test as fixtureSetupTest } from './fixtures/fixtureSetup'

I am confused to why we have a './playwright-deprecated' when we can just do alias importing?

Copy link
Collaborator

@nadr0 nadr0 Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After talking with the team, you do not have to fix this within this PR. We can address this importing stuff on the web team. This pattern is fine within this file for this PR.

src/clientSideScene/CameraControls.ts Show resolved Hide resolved
@jtran
Copy link
Collaborator

jtran commented Oct 4, 2024

I'd guess that if you merge main, some of the snapshot diffs should go away.

@franknoirot franknoirot merged commit d104ca2 into main Oct 4, 2024
26 checks passed
@franknoirot franknoirot deleted the mike/camera-center-hotkey branch October 4, 2024 20:47
@nadr0 nadr0 mentioned this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants