import { createComboBox } from "@itwin/frontend-devtools" ; import { SnapMode } from "@itwin/core-frontend" ; import { DisplayTestApp } from "./App" ; const multiSnapModes = [ SnapMode . NearestKeypoint , SnapMode . Nearest , SnapMode . Intersection , SnapMode . MidPoint , SnapMode . Origin , SnapMode . Center , SnapMode . Bisector , ] ; const multiSnapMode = - 1 ; function changeSnapModes ( value ) { if ( multiSnapMode !== ( value as number ) ) { DisplayTestApp . setActiveSnapMode ( value ) ; } else { DisplayTestApp . setActiveSnapModes ( multiSnapModes ) ; } } export function addSnapModes ( container ) { const cb = createComboBox ( { name : "Snap Mode: " , id : "snapModes" , parent : container , value : SnapMode . NearestKeypoint , handler : ( select ) => changeSnapModes ( Number . parseInt ( select . value , 10 ) ) , entries : [ { name : "Keypoint" , value : SnapMode . NearestKeypoint } , { name : "Nearest" , value : SnapMode . Nearest } , { name : "Center" , value : SnapMode . Center } , { name : "Origin" , value : SnapMode . Origin } , { name : "Intersection" , value : SnapMode . Intersection } , { name : "Multi-snap" , value : multiSnapMode } , ] , } ) ; return cb . div ; }