-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Matrix api load model with custom colors (#795)
* customViewSettings support for global element Ids * store view, handle api event * Update CadView.jsx * Fixup useModelStore refs from merge. Fix a div/p bug in About. --------- Signed-off-by: Pablo Mayrgundter <pablo.mayrgundter@gmail.com> Co-authored-by: aozien <a.osamamail@gmail.com>
- Loading branch information
1 parent
66d9151
commit 0b2192d
Showing
11 changed files
with
122 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/WidgetApi/event-handlers/ChangeViewSettingsEventHandler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import IfcCustomViewSettings from '../../Infrastructure/IfcCustomViewSettings' | ||
import useStore from '../../store/useStore' | ||
import ApiEventHandler from './ApiEventHandler' | ||
|
||
/** | ||
* Select Elements API event handler | ||
*/ | ||
class ChangeViewSettingsEventHandler extends ApiEventHandler { | ||
apiConnection = null | ||
name = 'ai.bldrs-share.ChangeViewSettings' | ||
|
||
/** | ||
* constructor | ||
* | ||
* @param {object} apiConnection AbstractApiConnection | ||
*/ | ||
constructor(apiConnection, navigation) { | ||
super() | ||
this.apiConnection = apiConnection | ||
} | ||
|
||
/** | ||
* The handler for this event | ||
* | ||
* @param {object} data the event associated data | ||
* @return {object} the response of the API call | ||
*/ | ||
handler(data) { | ||
if (!('customViewSettings' in data)) { | ||
return this.apiConnection.missingArgumentResponse('customViewSettings') | ||
} | ||
const customViewSettings = data.customViewSettings | ||
const customViewSettingsObject = new IfcCustomViewSettings( | ||
customViewSettings.defaultColor, | ||
customViewSettings.expressIdsToColorMap, | ||
customViewSettings.globalIdsToColorMap, | ||
) | ||
useStore.setState({customViewSettings: customViewSettingsObject}) | ||
return this.apiConnection.successfulResponse({}) | ||
} | ||
} | ||
|
||
export default ChangeViewSettingsEventHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters