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

Viewer: CutPlane: Created cut plane form normal and point #332

Merged
merged 6 commits into from Sep 9, 2022

Conversation

OlegMoshkovich
Copy link
Member

@OlegMoshkovich OlegMoshkovich commented Aug 15, 2022

This PR is addressing #153.

  • Add a basic menu to the cut plane UI that allows the user to create a cut plane at the center of the model on one of the axes.
  • Introduce plane hash URL(:p) parameter.
  • At the moment only a single plane can be created which simplifies the issue of sharing the cut plane in the permalink.
  • The menu buttons have a toggle state and can be deselected.
  • deselecting the cut plane clears the URL parameter.

https://deploy-preview-332--bldrs-share.netlify.app/share/v/gh/Swiss-Property-AG/Portfolio/main/ASTRA.ifc#p:z::c:-3.98,12.13,-51.23,18.61,6.65,-8.62

@netlify
Copy link

netlify bot commented Aug 15, 2022

Deploy Preview for bldrs-share ready!

Name Link
🔨 Latest commit 1e1bf06
🔍 Latest deploy log https://app.netlify.com/sites/bldrs-share/deploys/631b350b8c18060009889a27
😎 Deploy Preview https://deploy-preview-332--bldrs-share.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@OlegMoshkovich OlegMoshkovich marked this pull request as ready for review August 15, 2022 20:06
@pablo-mayrgundter
Copy link
Member

Heya, I think this still qualifies as draft since it's not working quite yet. Sound right?

@OlegMoshkovich OlegMoshkovich marked this pull request as draft August 16, 2022 09:01
@OlegMoshkovich
Copy link
Member Author

yes, not sure why it is switched to normal pr.

@OlegMoshkovich
Copy link
Member Author

@pablo-mayrgundter were you able to get any more clarity about why the plane is not cutting through the model?

src/utils/cutPlane.js Show resolved Hide resolved
@OlegMoshkovich OlegMoshkovich marked this pull request as ready for review August 20, 2022 18:43
Copy link
Contributor

@mkeshavarzi mkeshavarzi left a comment

Choose a reason for hiding this comment

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

Looks great!

@OlegMoshkovich
Copy link
Member Author

@pablo-mayrgundter PTAL

@OlegMoshkovich OlegMoshkovich self-assigned this Aug 22, 2022
Copy link
Member

@pablo-mayrgundter pablo-mayrgundter left a comment

Choose a reason for hiding this comment

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

Tests please. Likes in issues, url -> function, button -> function, clear.

@pablo-mayrgundter
Copy link
Member

Is it intended that only one cut plain is active at a time? Would be nice to support multiple if it fits in this PR.

@OlegMoshkovich
Copy link
Member Author

Yes one for now.
The scope feels right, and useful.

@OlegMoshkovich
Copy link
Member Author

tests .. yes, will add.

@OlegMoshkovich OlegMoshkovich changed the title Created cut plane form normal and point Viewer: UI: Created cut plane form normal and point Aug 23, 2022
@OlegMoshkovich OlegMoshkovich changed the title Viewer: UI: Created cut plane form normal and point Viewer: CutPlane: Created cut plane form normal and point Aug 23, 2022
@OlegMoshkovich
Copy link
Member Author

Testing successfully getting to create plane function.
It requires a viewer.
how do we test viewer functionality?
image

@pablo-mayrgundter
Copy link
Member

if you're testing A, and A calls B, and B is a mess to test, then you "mock" B

jest.mock('../B')
const b = require('../B')

// b is a mock function
b.mockImplementation(() => 42)
b()
// > 42

See docs here: https://jestjs.io/docs/mock-functions#mock-implementations

@OlegMoshkovich
Copy link
Member Author

I see.. so in this case we would need to create viewer mock which contains a clipper and deleteAllPlaces methods?

@OlegMoshkovich
Copy link
Member Author

@pablo-mayrgundter created checklist in the #153
everything is complete besides the tests, and those are stubbed out.
Can you please help with the test to make it production ready?
This is issue is on a critical path.

src/utils/cutPlane.js Outdated Show resolved Hide resolved
@pablo-mayrgundter
Copy link
Member

Ok, please merge in #358, with the improved web-ifc-viewer mock. Then try following the CadView.test for how to go from URL -> asserts on IFCjs.

@pablo-mayrgundter
Copy link
Member

Heya, looking back at your original question about testing, you'll want to add a jest.fn() mock method to mocks/web-ifc-viewer.js for viewer.clipper.deleteAllPlanes and assert on it after your code-under-test. Hope that helps!

@pablo-mayrgundter pablo-mayrgundter marked this pull request as draft September 9, 2022 11:19
@OlegMoshkovich OlegMoshkovich marked this pull request as ready for review September 9, 2022 12:45
@OlegMoshkovich
Copy link
Member Author

@pablo-mayrgundter PTAL

Copy link
Member

@pablo-mayrgundter pablo-mayrgundter left a comment

Choose a reason for hiding this comment

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

Wowow! Super jağ!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

None yet

3 participants