import { IModelApp , Viewport } from "@itwin/core-frontend" ; import { createToolButton , ToolBarDropDown } from "./ToolBar" ; const entries = [ "\ue916" , "\ue910" , "\ue914" , "\ue915" , "\ue911" , "\ue90f" , "\ue912" , "\ue913" , ] ; export class StandardRotations extends ToolBarDropDown { private readonly _element : HTMLElement ; private readonly _parent : HTMLElement ; private readonly _vp : Viewport ; public constructor ( parent , vp ) { super ( ) ; this . _parent = parent ; this . _vp = vp ; this . _element = document . createElement ( "div" ) ; this . _element . className = "toolMenu" ; this . _element . style . display = "block" ; let div = document . createElement ( "div" ) ; div . style . display = "flex" ; this . _element . appendChild ( div ) ; for ( let i = 0 ; i < entries . length ; i ++ ) { if ( 4 === i ) { div = document . createElement ( "div" ) ; div . style . display = "flex" ; this . _element . appendChild ( div ) ; } div . appendChild ( createToolButton ( { iconUnicode : entries [ i ] , click : async ( ) => IModelApp . tools . run ( "View.Standard" , IModelApp . viewManager . selectedView , i ) , } ) ) ; } parent . appendChild ( this . _element ) ; } public get isOpen ( ) { return "none" !== this . _element . style . display ; } protected _open ( ) { this . _element . style . display = "block" ; } protected _close ( ) { this . _element . style . display = "none" ; } public override get onViewChanged ( ) : Promise < void > { this . _parent . style . display = this . _vp . view . allow3dManipulations ( ) ? "block" : "none" ; return Promise . resolve ( ) ; } }