Skip to content

feat: add coordinates to preview - #737

Merged
aarthificial merged 5 commits into
motion-canvas:mainfrom
Logon27:feature/coordinates
Jun 18, 2023
Merged

feat: add coordinates to preview#737
aarthificial merged 5 commits into
motion-canvas:mainfrom
Logon27:feature/coordinates

Conversation

@Logon27

@Logon27 Logon27 commented Jun 5, 2023

Copy link
Copy Markdown
Contributor

This feature was made in to address issue #289

Added Coordinates to preview. Press P to copy. There is a toggle for the coordinates in the settings. I added a video showing how the feature works. There will likely need to be some revisions to how the canvas is element is referenced. As well as probably some React best practices as this is fairly new to me.

@aarthificial whenever you have time to review, feel free.

(Video is outdated. Will be updated when comments are resolved.)
2023-06-05 19-36-49.webm

@Logon27
Logon27 requested a review from aarthificial as a code owner June 5, 2023 23:45
Comment thread packages/ui/src/components/controls/Controls.module.scss Outdated
Comment thread packages/ui/src/components/viewport/Coordinates.tsx Outdated
Comment thread packages/ui/src/contexts/shortcuts.tsx Outdated
Comment on lines +33 to +34
{key: 'v', action: 'Toggle coordinates'},
{key: 'c', action: 'Copy coordinates'},

@aarthificial aarthificial Jun 6, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not a huge fan of adding multiple shortcuts to do one thing.
I'd imagine it working the same way as the color picker, so:

  1. Initial State - the coordinates are displayed in the top left, next to a button
    a. Clicking on the button switches to the Sampling State
    b. Pressing v switches to the Sampling State
  2. Sampling State
    a. Clicking LMB anywhere on the canvas copies the position.
    b. Clicking ESC cancels sampling.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just thought I would add a toggle to turn the coordinates off in case someone did not want to see them. Do you want the coordinates always displayed?

@aarthificial aarthificial Jun 8, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, we could also go this way.
If you think hiding the coordinates can be useful then we can add it as a checkbox in the application settings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added the coordinates as a toggle in the settings. I did not make it a select button like the color picker. Currently its just a keybind to copy the coordinates. This is kind of a stretch goal for me if I have the time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aarthificial Couple clarity questions if you want it to be a sampling state instead.

For the sampling state do you want the same EyeDropper selection as the color picker? Or do you want something different?

What svg icon would you like for the button itself?

Comment thread packages/ui/src/components/viewport/EditorPreview.tsx Outdated
Comment thread packages/ui/src/components/viewport/EditorPreview.tsx Outdated
Comment thread packages/ui/src/components/viewport/EditorPreview.tsx Outdated
Comment thread packages/ui/src/components/viewport/Coordinates.tsx Outdated
Comment thread packages/ui/src/components/viewport/Coordinates.tsx Outdated
Added Coordinates to preview. C to copy. V to toggle.
@Logon27
Logon27 force-pushed the feature/coordinates branch from c0572f1 to 78ad0b2 Compare June 6, 2023 02:37
Comment thread packages/2d/src/scenes/Scene2D.ts Outdated
Comment thread packages/core/src/scenes/Inspectable.ts Outdated
Comment thread packages/2d/src/scenes/Scene2D.ts Outdated
Comment thread packages/2d/src/scenes/Scene2D.ts Outdated
Comment thread packages/ui/src/components/viewport/Coordinates.tsx Outdated
Comment thread packages/ui/src/components/viewport/Coordinates.tsx Outdated
Comment thread packages/core/src/app/SettingsMetadata.ts Outdated
@aarthificial
aarthificial merged commit 330c1f9 into motion-canvas:main Jun 18, 2023
@aarthificial aarthificial mentioned this pull request Oct 4, 2023
4 tasks
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.

3 participants