File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
apps/test-viewer/src/components Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -93,8 +93,14 @@ function onIModelConnected(imodel: IModelConnection) {
93
93
94
94
imodel . schemaContext . getSchema ( new SchemaKey ( "AecUnits" , SchemaMatchType . Latest ) ) . then ( ( schema ) => {
95
95
if ( schema ) {
96
- IModelApp . formatsProvider = new SchemaFormatsProvider ( imodel . schemaContext , IModelApp . quantityFormatter . activeUnitSystem ) ;
96
+ const schemaFormatsProvider = new SchemaFormatsProvider ( imodel . schemaContext , IModelApp . quantityFormatter . activeUnitSystem ) ;
97
+ const removeListener = IModelApp . quantityFormatter . onActiveFormattingUnitSystemChanged . addListener ( ( args ) => {
98
+ schemaFormatsProvider . unitSystem = args . system ;
99
+ } ) ;
100
+ IModelApp . formatsProvider = schemaFormatsProvider ;
97
101
console . log ( "Registered SchemaFormatsProvider" ) ;
102
+
103
+ IModelConnection . onClose . addOnce ( removeListener )
98
104
}
99
105
} ) . catch ( ( _ ) => {
100
106
console . error ( "No common AecUnits schema found in iModel, not registering a SchemaFormatsProvider" ) ;
You can’t perform that action at this time.
0 commit comments