Skip to content

Commit

Permalink
Linting and adjusting viewer mockup
Browse files Browse the repository at this point in the history
  • Loading branch information
aozien committed Feb 12, 2023
1 parent 4dbb68e commit ae683d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
6 changes: 6 additions & 0 deletions __mocks__/web-ifc-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ const impl = {
material: null,
},
},
loader: {
ifcManager: {
parser: {},
},
},
},
clipper: {
active: false,
Expand Down Expand Up @@ -88,6 +93,7 @@ const impl = {
}),
setSelection: jest.fn(),
pickIfcItemsByID: jest.fn(),
loadIfcUrl: jest.fn(jest.fn(() => loadedModel)),
}
const constructorMock = ifcjsMock.IfcViewerAPI
constructorMock.mockImplementation(() => impl)
Expand Down
2 changes: 2 additions & 0 deletions src/Infrastructure/IfcElementsStyleManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import IfcCustomViewSettings from './IfcCustomViewSettings'


/* eslint-disable jsdoc/no-undefined-types */
/**
* Overrides the default render functionality in the viewer
* and adds a postprocessing effect (outlining selected elements)
Expand Down Expand Up @@ -28,6 +29,7 @@ export default class IfcElementsStyleManager {
}
}


/* eslint-disable no-invalid-this */
/**
* Returns a new stream mesh function that uses
Expand Down
19 changes: 10 additions & 9 deletions src/Infrastructure/IfcViewerAPIExtended.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import IfcViewsManager from './IfcElementsStyleManager'
import IfcCustomViewSettings from './IfcCustomViewSettings'


/* eslint-disable jsdoc/no-undefined-types */
/**
* Extending the original IFCViewerFunctionality
*/
Expand All @@ -20,15 +21,15 @@ export class IfcViewerAPIExtended extends IfcViewerAPI {


/**
* Loads the given IFC in the current scene.
*
* @param {string} url IFC as URL.
* @param {boolean} fitToFrame (optional) if true, brings the perspectiveCamera to the loaded IFC.
* @param {(event: ProgressEvent) => void} onProgress (optional) a callback function to report on downloading progress
* @param {(err: any) => any} onError (optional) a callback function to report on loading errors
* @param {IfcCustomViewSettings} customViewSettings (optional) override the ifc elements file colors
* @returns {IfcModel} ifcModel object
*/
* Loads the given IFC in the current scene.
*
* @param {string} url IFC as URL.
* @param {boolean} fitToFrame (optional) if true, brings the perspectiveCamera to the loaded IFC.
* @param {Function(event)} onProgress (optional) a callback function to report on downloading progress
* @param {Function} onError (optional) a callback function to report on loading errors
* @param {IfcCustomViewSettings} customViewSettings (optional) override the ifc elements file colors
* @return {IfcModel} ifcModel object
*/
async loadIfcUrl(url, fitToFrame, onProgress, onError, customViewSettings) {
this.viewsManager.setViewSettings(customViewSettings)
return await this.IFC.loadIfcUrl(url, fitToFrame, onProgress, onError)
Expand Down

0 comments on commit ae683d7

Please sign in to comment.