4
4
*--------------------------------------------------------------------------------------------*/
5
5
import { assert , compareStringsOrUndefined , Id64 , Id64Arg } from "@itwin/core-bentley" ;
6
6
import { GeometricModel3dProps , QueryBinder , QueryRowFormat } from "@itwin/core-common" ;
7
- import { GeometricModel3dState , ScreenViewport , SpatialViewState , ViewManip } from "@itwin/core-frontend" ;
7
+ import { GeometricModel3dState , IModelApp , ScreenViewport , SpatialViewState , ViewManip } from "@itwin/core-frontend" ;
8
8
import { CheckBox , ComboBoxEntry , createButton , createCheckBox , createComboBox , createTextBox } from "@itwin/frontend-devtools" ;
9
9
import { ToolBarDropDown } from "./ToolBar" ;
10
10
@@ -18,6 +18,7 @@ export abstract class IdPicker extends ToolBarDropDown {
18
18
protected readonly _availableIds = new Set < string > ( ) ;
19
19
20
20
protected abstract get _elementType ( ) : "Model" | "Category" ;
21
+ protected get _settingsType ( ) : "model" | "category" { return this . _elementType . toLowerCase ( ) as "model" | "category" ; }
21
22
protected get _showIn2d ( ) : boolean { return true ; }
22
23
protected abstract get _enabledIds ( ) : Set < string > ;
23
24
protected abstract changeDisplay ( ids : Id64Arg , enabled : boolean ) : void ;
@@ -46,6 +47,8 @@ export abstract class IdPicker extends ToolBarDropDown {
46
47
{ name : "Hide Selected" , value : "Hide" } ,
47
48
{ name : "Hilite Enabled" , value : "Hilite" } ,
48
49
{ name : "Un-hilite Enabled" , value : "Dehilite" } ,
50
+ // Set ToolAdmin.activeSettings.model/category to first enabled entry.
51
+ { name : "Set First Active" , value : "SetFirstActive" } ,
49
52
] ;
50
53
}
51
54
@@ -157,6 +160,10 @@ export abstract class IdPicker extends ToolBarDropDown {
157
160
case "Dehilite" :
158
161
this . hiliteEnabled ( "Hilite" === which ) ;
159
162
return ;
163
+ case "SetFirstActive" :
164
+ const first = Array . from ( this . _enabledIds ) [ 0 ] ;
165
+ IModelApp . toolAdmin . activeSettings [ this . _settingsType ] = first ;
166
+ return ;
160
167
case "" :
161
168
return ;
162
169
}
0 commit comments