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

feat: snap #543

Merged
merged 9 commits into from
Apr 28, 2023
Merged

feat: snap #543

merged 9 commits into from
Apr 28, 2023

Conversation

cazala
Copy link
Member

@cazala cazala commented Apr 26, 2023

Closes decentraland/sdk#706

  • Add snapManager to control snap distance for position/scale/rotation and enable/disable
  • Add keybinding: hold shift to toggle snapping
  • Add UI to edit snap distances and enable/disable
  • Add tests
snap.mp4

Hint: hold shift to toggle the snapping

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 26, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: e593572
Status: ✅  Deploy successful!
Preview URL: https://76da4f19.js-sdk-toolchain.pages.dev
Branch Preview URL: https://feat-snap.js-sdk-toolchain.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Apr 26, 2023

Test this pull request

  • The @dcl/sdk package can be tested in scenes by running

    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/feat/snap/dcl-sdk-7.1.10-4831303398.commit-255c3a1.tgz"
  • To test with npx init

    export SDK_COMMANDS="https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/feat/snap/dcl-sdk-commands-7.1.10-4831303398.commit-255c3a1.tgz"
    npx $SDK_COMMANDS init
  • The @dcl/inspector package can be tested by visiting this url

    • Or by installing it via NPM
    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/feat/snap/@dcl/inspector/dcl-inspector-7.1.10-4831303398.commit-255c3a1.tgz"
  • The /changerealm command to test test in-world

    /changerealm https://sdk-team-cdn.decentraland.org/ipfs/feat/snap-e2e
    
  • You can preview this build entering:
    https://playground.decentraland.org/?sdk-branch=feat/snap

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Patch coverage: 81.54% and project coverage change: +0.41 🎉

Comparison is base (7d7f70a) 69.16% compared to head (e593572) 69.58%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #543      +/-   ##
==========================================
+ Coverage   69.16%   69.58%   +0.41%     
==========================================
  Files         229      235       +6     
  Lines        7870     8097     +227     
  Branches      967     1021      +54     
==========================================
+ Hits         5443     5634     +191     
- Misses       2326     2358      +32     
- Partials      101      105       +4     
Impacted Files Coverage Δ
...pector/src/components/Toolbar/Gizmos/Snap/index.ts 0.00% <0.00%> (ø)
...l/inspector/src/components/Toolbar/Gizmos/index.ts 0.00% <0.00%> (ø)
...ctor/src/components/Toolbar/ToolbarButton/index.ts 0.00% <0.00%> (ø)
...ckages/@dcl/inspector/src/hooks/useOutsideClick.ts 0.00% <0.00%> (ø)
...ctor/src/lib/babylon/decentraland/gizmo-manager.ts 12.16% <7.69%> (-0.34%) ⬇️
...ages/@dcl/inspector/src/lib/babylon/setup/input.ts 26.90% <42.85%> (+1.15%) ⬆️
...ackages/@dcl/inspector/src/hooks/editor/useSnap.ts 100.00% <100.00%> (ø)
...ector/src/lib/babylon/decentraland/snap-manager.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@cazala cazala force-pushed the feat/snap branch 3 times, most recently from f341815 to 03a8698 Compare April 27, 2023 21:42
@cazala cazala marked this pull request as ready for review April 27, 2023 21:58
@@ -25,7 +25,7 @@ module.exports = {
collectCoverageFrom: ["src/**/*.ts"],
verbose: true,
testMatch: ["**/*.spec.(ts)"],
testEnvironment: "node",
testEnvironment: "jsdom",
Copy link
Contributor

Choose a reason for hiding this comment

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

thankkkkkkkkkks ❤️

Copy link
Contributor

Choose a reason for hiding this comment

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

should this svg be react components 🤔 ?
Just to be consistent with the app, no idea just thinking out loud

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, we can do that but it would require to configure a loader for svgs so que can import Icon from "./path/to/icon.svg" and then use it as <Icon />. I would rather do that as a separate PR.

@@ -0,0 +1,21 @@
import { useEffect, useRef } from 'react'

export const useOutsideClick = (callback: () => void) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

yes!

@cazala cazala merged commit a2ec881 into main Apr 28, 2023
@cazala cazala deleted the feat/snap branch April 28, 2023 14:10
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.

Composite renderer: snap translation, rotation & scaling
2 participants