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

Cutplanes: fixed reset selection clearing all nav state #1189

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions cypress/e2e/view-100/cutplanes.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ import {
visitHomepageWaitForModel,
waitForModel,
} from '../../support/utils'
import {
waitForModelReady,
} from '../../support/models'


// From https://github.com/bldrs-ai/Share/issues/1106
/** {@link https://github.com/bldrs-ai/Share/issues/1106} */
describe('view 100: Cutplanes', () => {
beforeEach(homepageSetup)
beforeEach(() => {
homepageSetup()
setIsReturningUser()
})

context('View model', () => {
beforeEach(() => {
setIsReturningUser()
visitHomepageWaitForModel()
})
beforeEach(visitHomepageWaitForModel)

context(('Click CutPlaneControl'), () => {
beforeEach(() => cy.get('[data-testid="control-button-cut-plane"]').click())
Expand Down Expand Up @@ -59,7 +62,6 @@ describe('view 100: Cutplanes', () => {

context('View cut-plane permalink', () => {
beforeEach(() => {
setIsReturningUser()
cy.visit('/share/v/p/index.ifc#cp:y=17.077,x=-25.551,z=5.741;c:-133.022,131.828,161.85,-38.078,22.64,-2.314')
waitForModel()
})
Expand All @@ -68,4 +70,23 @@ describe('view 100: Cutplanes', () => {
cy.percySnapshot()
})
})

context('All hidable controls visible', () => {
beforeEach(() => {
const twoLevelSelect = 'twoLevelSelect'
cy.intercept('GET', '/share/v/p/index.ifc/88/546', {fixture: '404.html'}).as(twoLevelSelect)
cy.visit('/share/v/p/index.ifc/88/546#cp:y=17.077,x=-25.551,z=5.741;i:;n:;p:;s:')
waitForModelReady(twoLevelSelect)
// cy.get('[data-testid="control-button-cut-plane"]').click()
cy.get('[data-testid="Clear"]').click()
})

it('Clearing cut-planes leaves other page state alone - Screen', () => {
cy.findByTestId('textfield-search-query').should('be.visible')
cy.findByTestId('panel-navigation').should('be.visible')
cy.findByTestId('side-drawer-panel-notes').should('be.visible')
cy.findByTestId('side-drawer-panel-properties').should('be.visible')
cy.percySnapshot()
})
})
})
5 changes: 3 additions & 2 deletions cypress/e2e/view-100/synchronized-view-and-navtree.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ describe('View 100: Synchronized View and NavTree', () => {
context('Visits permalink to selected element', () => {
beforeEach(() => {
// TODO(pablo): root id selection doesn't work after search state working. Also move this to a helper
cy.intercept('GET', '/share/v/p/index.ifc/81/621', {fixture: '404.html'}).as('twoLevelSelect')
const twoLevelSelect = 'twoLevelSelect'
cy.intercept('GET', '/share/v/p/index.ifc/81/621', {fixture: '404.html'}).as(twoLevelSelect)
cy.visit('/share/v/p/index.ifc/81/621')
waitForModelReady('twoLevelSelect')
waitForModelReady(twoLevelSelect)
})

it('Item highlighted in tree and scene - Screen', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bldrs",
"version": "1.0.1036",
"version": "1.0.1034",
"main": "src/index.jsx",
"license": "MIT",
"homepage": "https://github.com/bldrs-ai/Share",
Expand Down
4 changes: 3 additions & 1 deletion src/Components/NavTree/NavTreePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ export default function NavTreePanel({
}, [selectedElements, idToRef])


const title = 'Navigation'
return (
<Panel
title='Navigation'
title={title}
onCloseClick={() => setIsNavTreeVisible(false)}
action={<Actions navigationMode={navigationMode} setNavigationMode={setNavigationMode}/>}
sx={{m: '0 0 0 10px'}} // equal to SearchBar m:5 + p:5
paperTestId={`panel-${title.toLowerCase()}`}
>
<TreeView
aria-label={isNavTree ? 'IFC Navigator' : 'IFC Types Navigator'}
Expand Down
5 changes: 4 additions & 1 deletion src/Components/SideDrawer/PanelWithTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export default function PanelWithTitle({title, children, controlsGroup, iconSrc}
const isMobile = useIsMobile()

return (
<Box sx={{height: '100%', overflow: 'hidden'}}>
<Box
sx={{height: '100%', overflow: 'hidden'}}
data-testid={`side-drawer-panel-${title.toLowerCase()}`}
>
<PanelTitle
title={title}
iconSrc={iconSrc}
Expand Down
3 changes: 2 additions & 1 deletion src/Containers/CadView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ export default function CadView({
if (viewer) {
viewer.clipper.deleteAllPlanes()
}
resetState()
resetSelection()
resetCutPlaneState(viewer, setCutPlaneDirections, setIsCutPlaneActive)
const repoFilePath = modelPath.gitpath ? modelPath.getRepoPath() : modelPath.filepath
window.removeEventListener('beforeunload', handleBeforeUnload)
navWith(navigate, `${pathPrefix}${repoFilePath}`, {search: '', hash: ''})
Expand Down
Loading