babylon.gui.d.ts 186 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551
  1. declare module BABYLON.GUI {
  2. /**
  3. * Interface used to define a control that can receive focus
  4. */
  5. export interface IFocusableControl {
  6. /**
  7. * Function called when the control receives the focus
  8. */
  9. onFocus(): void;
  10. /**
  11. * Function called when the control loses the focus
  12. */
  13. onBlur(): void;
  14. /**
  15. * Function called to let the control handle keyboard events
  16. * @param evt defines the current keyboard event
  17. */
  18. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  19. /**
  20. * Function called to get the list of controls that should not steal the focus from this control
  21. * @returns an array of controls
  22. */
  23. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  24. /**
  25. * Function to focus the control programmatically
  26. */
  27. focus(): void;
  28. /**
  29. * Function to unfocus the control programmatically
  30. */
  31. blur(): void;
  32. }
  33. }
  34. declare module BABYLON.GUI {
  35. /**
  36. * Class used to specific a value and its associated unit
  37. */
  38. export class ValueAndUnit {
  39. /** defines the unit to store */
  40. unit: number;
  41. /** defines a boolean indicating if the value can be negative */
  42. negativeValueAllowed: boolean;
  43. private _value;
  44. private _originalUnit;
  45. /**
  46. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  47. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  48. */
  49. ignoreAdaptiveScaling: boolean;
  50. /**
  51. * Creates a new ValueAndUnit
  52. * @param value defines the value to store
  53. * @param unit defines the unit to store
  54. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  55. */
  56. constructor(value: number,
  57. /** defines the unit to store */
  58. unit?: number,
  59. /** defines a boolean indicating if the value can be negative */
  60. negativeValueAllowed?: boolean);
  61. /** Gets a boolean indicating if the value is a percentage */
  62. get isPercentage(): boolean;
  63. /** Gets a boolean indicating if the value is store as pixel */
  64. get isPixel(): boolean;
  65. /** Gets direct internal value */
  66. get internalValue(): number;
  67. /**
  68. * Gets value as pixel
  69. * @param host defines the root host
  70. * @param refValue defines the reference value for percentages
  71. * @returns the value as pixel
  72. */
  73. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  74. /**
  75. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  76. * @param value defines the value to store
  77. * @param unit defines the unit to store
  78. * @returns the current ValueAndUnit
  79. */
  80. updateInPlace(value: number, unit?: number): ValueAndUnit;
  81. /**
  82. * Gets the value accordingly to its unit
  83. * @param host defines the root host
  84. * @returns the value
  85. */
  86. getValue(host: AdvancedDynamicTexture): number;
  87. /**
  88. * Gets a string representation of the value
  89. * @param host defines the root host
  90. * @param decimals defines an optional number of decimals to display
  91. * @returns a string
  92. */
  93. toString(host: AdvancedDynamicTexture, decimals?: number): string;
  94. /**
  95. * Store a value parsed from a string
  96. * @param source defines the source string
  97. * @returns true if the value was successfully parsed
  98. */
  99. fromString(source: string | number): boolean;
  100. private static _Regex;
  101. private static _UNITMODE_PERCENTAGE;
  102. private static _UNITMODE_PIXEL;
  103. /** UNITMODE_PERCENTAGE */
  104. static get UNITMODE_PERCENTAGE(): number;
  105. /** UNITMODE_PIXEL */
  106. static get UNITMODE_PIXEL(): number;
  107. }
  108. }
  109. declare module BABYLON.GUI {
  110. /**
  111. * Define a style used by control to automatically setup properties based on a template.
  112. * Only support font related properties so far
  113. */
  114. export class Style implements BABYLON.IDisposable {
  115. private _fontFamily;
  116. private _fontStyle;
  117. private _fontWeight;
  118. /** @hidden */
  119. _host: AdvancedDynamicTexture;
  120. /** @hidden */
  121. _fontSize: ValueAndUnit;
  122. /**
  123. * BABYLON.Observable raised when the style values are changed
  124. */
  125. onChangedObservable: BABYLON.Observable<Style>;
  126. /**
  127. * Creates a new style object
  128. * @param host defines the AdvancedDynamicTexture which hosts this style
  129. */
  130. constructor(host: AdvancedDynamicTexture);
  131. /**
  132. * Gets or sets the font size
  133. */
  134. get fontSize(): string | number;
  135. set fontSize(value: string | number);
  136. /**
  137. * Gets or sets the font family
  138. */
  139. get fontFamily(): string;
  140. set fontFamily(value: string);
  141. /**
  142. * Gets or sets the font style
  143. */
  144. get fontStyle(): string;
  145. set fontStyle(value: string);
  146. /** Gets or sets font weight */
  147. get fontWeight(): string;
  148. set fontWeight(value: string);
  149. /** Dispose all associated resources */
  150. dispose(): void;
  151. }
  152. }
  153. declare module BABYLON.GUI {
  154. /**
  155. * Class used to transport BABYLON.Vector2 information for pointer events
  156. */
  157. export class Vector2WithInfo extends BABYLON.Vector2 {
  158. /** defines the current mouse button index */
  159. buttonIndex: number;
  160. /**
  161. * Creates a new Vector2WithInfo
  162. * @param source defines the vector2 data to transport
  163. * @param buttonIndex defines the current mouse button index
  164. */
  165. constructor(source: BABYLON.Vector2,
  166. /** defines the current mouse button index */
  167. buttonIndex?: number);
  168. }
  169. /** Class used to provide 2D matrix features */
  170. export class Matrix2D {
  171. /** Gets the internal array of 6 floats used to store matrix data */
  172. m: Float32Array;
  173. /**
  174. * Creates a new matrix
  175. * @param m00 defines value for (0, 0)
  176. * @param m01 defines value for (0, 1)
  177. * @param m10 defines value for (1, 0)
  178. * @param m11 defines value for (1, 1)
  179. * @param m20 defines value for (2, 0)
  180. * @param m21 defines value for (2, 1)
  181. */
  182. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  183. /**
  184. * Fills the matrix from direct values
  185. * @param m00 defines value for (0, 0)
  186. * @param m01 defines value for (0, 1)
  187. * @param m10 defines value for (1, 0)
  188. * @param m11 defines value for (1, 1)
  189. * @param m20 defines value for (2, 0)
  190. * @param m21 defines value for (2, 1)
  191. * @returns the current modified matrix
  192. */
  193. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  194. /**
  195. * Gets matrix determinant
  196. * @returns the determinant
  197. */
  198. determinant(): number;
  199. /**
  200. * Inverses the matrix and stores it in a target matrix
  201. * @param result defines the target matrix
  202. * @returns the current matrix
  203. */
  204. invertToRef(result: Matrix2D): Matrix2D;
  205. /**
  206. * Multiplies the current matrix with another one
  207. * @param other defines the second operand
  208. * @param result defines the target matrix
  209. * @returns the current matrix
  210. */
  211. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  212. /**
  213. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  214. * @param x defines the x coordinate to transform
  215. * @param y defines the x coordinate to transform
  216. * @param result defines the target vector2
  217. * @returns the current matrix
  218. */
  219. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  220. /**
  221. * Creates an identity matrix
  222. * @returns a new matrix
  223. */
  224. static Identity(): Matrix2D;
  225. /**
  226. * Creates a translation matrix and stores it in a target matrix
  227. * @param x defines the x coordinate of the translation
  228. * @param y defines the y coordinate of the translation
  229. * @param result defines the target matrix
  230. */
  231. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  232. /**
  233. * Creates a scaling matrix and stores it in a target matrix
  234. * @param x defines the x coordinate of the scaling
  235. * @param y defines the y coordinate of the scaling
  236. * @param result defines the target matrix
  237. */
  238. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  239. /**
  240. * Creates a rotation matrix and stores it in a target matrix
  241. * @param angle defines the rotation angle
  242. * @param result defines the target matrix
  243. */
  244. static RotationToRef(angle: number, result: Matrix2D): void;
  245. private static _TempPreTranslationMatrix;
  246. private static _TempPostTranslationMatrix;
  247. private static _TempRotationMatrix;
  248. private static _TempScalingMatrix;
  249. private static _TempCompose0;
  250. private static _TempCompose1;
  251. private static _TempCompose2;
  252. /**
  253. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  254. * @param tx defines the x coordinate of the translation
  255. * @param ty defines the y coordinate of the translation
  256. * @param angle defines the rotation angle
  257. * @param scaleX defines the x coordinate of the scaling
  258. * @param scaleY defines the y coordinate of the scaling
  259. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  260. * @param result defines the target matrix
  261. */
  262. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  263. }
  264. }
  265. declare module BABYLON.GUI {
  266. /**
  267. * Class used to store 2D control sizes
  268. */
  269. export class Measure {
  270. /** defines left coordinate */
  271. left: number;
  272. /** defines top coordinate */
  273. top: number;
  274. /** defines width dimension */
  275. width: number;
  276. /** defines height dimension */
  277. height: number;
  278. /**
  279. * Creates a new measure
  280. * @param left defines left coordinate
  281. * @param top defines top coordinate
  282. * @param width defines width dimension
  283. * @param height defines height dimension
  284. */
  285. constructor(
  286. /** defines left coordinate */
  287. left: number,
  288. /** defines top coordinate */
  289. top: number,
  290. /** defines width dimension */
  291. width: number,
  292. /** defines height dimension */
  293. height: number);
  294. /**
  295. * Copy from another measure
  296. * @param other defines the other measure to copy from
  297. */
  298. copyFrom(other: Measure): void;
  299. /**
  300. * Copy from a group of 4 floats
  301. * @param left defines left coordinate
  302. * @param top defines top coordinate
  303. * @param width defines width dimension
  304. * @param height defines height dimension
  305. */
  306. copyFromFloats(left: number, top: number, width: number, height: number): void;
  307. /**
  308. * Computes the axis aligned bounding box measure for two given measures
  309. * @param a Input measure
  310. * @param b Input measure
  311. * @param result the resulting bounding measure
  312. */
  313. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  314. /**
  315. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  316. * @param transform the matrix to transform the measure before computing the AABB
  317. * @param addX number to add to left
  318. * @param addY number to add to top
  319. * @param addWidth number to add to width
  320. * @param addHeight number to add to height
  321. * @param result the resulting AABB
  322. */
  323. addAndTransformToRef(transform: Matrix2D, addX: number, addY: number, addWidth: number, addHeight: number, result: Measure): void;
  324. /**
  325. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  326. * @param transform the matrix to transform the measure before computing the AABB
  327. * @param result the resulting AABB
  328. */
  329. transformToRef(transform: Matrix2D, result: Measure): void;
  330. /**
  331. * Check equality between this measure and another one
  332. * @param other defines the other measures
  333. * @returns true if both measures are equals
  334. */
  335. isEqualsTo(other: Measure): boolean;
  336. /**
  337. * Creates an empty measure
  338. * @returns a new measure
  339. */
  340. static Empty(): Measure;
  341. }
  342. }
  343. declare module BABYLON.GUI {
  344. /**
  345. * Class used to create texture to support 2D GUI elements
  346. * @see https://doc.babylonjs.com/how_to/gui
  347. */
  348. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  349. /** Define the Uurl to load snippets */
  350. static SnippetUrl: string;
  351. /** Snippet ID if the content was created from the snippet server */
  352. snippetId: string;
  353. private _isDirty;
  354. private _renderObserver;
  355. private _resizeObserver;
  356. private _preKeyboardObserver;
  357. private _pointerMoveObserver;
  358. private _pointerObserver;
  359. private _canvasPointerOutObserver;
  360. private _canvasBlurObserver;
  361. private _background;
  362. /** @hidden */
  363. _rootContainer: Container;
  364. /** @hidden */
  365. _lastPickedControl: Control;
  366. /** @hidden */
  367. _lastControlOver: {
  368. [pointerId: number]: Control;
  369. };
  370. /** @hidden */
  371. _lastControlDown: {
  372. [pointerId: number]: Control;
  373. };
  374. /** @hidden */
  375. _capturingControl: {
  376. [pointerId: number]: Control;
  377. };
  378. /** @hidden */
  379. _shouldBlockPointer: boolean;
  380. /** @hidden */
  381. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  382. /** @hidden */
  383. _linkedControls: Control[];
  384. private _isFullscreen;
  385. private _fullscreenViewport;
  386. private _idealWidth;
  387. private _idealHeight;
  388. private _useSmallestIdeal;
  389. private _renderAtIdealSize;
  390. private _focusedControl;
  391. private _blockNextFocusCheck;
  392. private _renderScale;
  393. private _rootElement;
  394. private _cursorChanged;
  395. private _defaultMousePointerId;
  396. /** @hidden */
  397. _numLayoutCalls: number;
  398. /** Gets the number of layout calls made the last time the ADT has been rendered */
  399. get numLayoutCalls(): number;
  400. /** @hidden */
  401. _numRenderCalls: number;
  402. /** Gets the number of render calls made the last time the ADT has been rendered */
  403. get numRenderCalls(): number;
  404. /**
  405. * Define type to string to ensure compatibility across browsers
  406. * Safari doesn't support DataTransfer constructor
  407. */
  408. private _clipboardData;
  409. /**
  410. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  411. */
  412. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  413. /**
  414. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  415. */
  416. onControlPickedObservable: BABYLON.Observable<Control>;
  417. /**
  418. * BABYLON.Observable event triggered before layout is evaluated
  419. */
  420. onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  421. /**
  422. * BABYLON.Observable event triggered after the layout was evaluated
  423. */
  424. onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  425. /**
  426. * BABYLON.Observable event triggered before the texture is rendered
  427. */
  428. onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  429. /**
  430. * BABYLON.Observable event triggered after the texture was rendered
  431. */
  432. onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  433. /**
  434. * Gets or sets a boolean defining if alpha is stored as premultiplied
  435. */
  436. premulAlpha: boolean;
  437. /**
  438. * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
  439. */
  440. applyYInversionOnUpdate: boolean;
  441. /**
  442. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  443. * Useful when you want more antialiasing
  444. */
  445. get renderScale(): number;
  446. set renderScale(value: number);
  447. /** Gets or sets the background color */
  448. get background(): string;
  449. set background(value: string);
  450. /**
  451. * Gets or sets the ideal width used to design controls.
  452. * The GUI will then rescale everything accordingly
  453. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  454. */
  455. get idealWidth(): number;
  456. set idealWidth(value: number);
  457. /**
  458. * Gets or sets the ideal height used to design controls.
  459. * The GUI will then rescale everything accordingly
  460. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  461. */
  462. get idealHeight(): number;
  463. set idealHeight(value: number);
  464. /**
  465. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  466. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  467. */
  468. get useSmallestIdeal(): boolean;
  469. set useSmallestIdeal(value: boolean);
  470. /**
  471. * Gets or sets a boolean indicating if adaptive scaling must be used
  472. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  473. */
  474. get renderAtIdealSize(): boolean;
  475. set renderAtIdealSize(value: boolean);
  476. /**
  477. * Gets the ratio used when in "ideal mode"
  478. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  479. * */
  480. get idealRatio(): number;
  481. /**
  482. * Gets the underlying layer used to render the texture when in fullscreen mode
  483. */
  484. get layer(): BABYLON.Nullable<BABYLON.Layer>;
  485. /**
  486. * Gets the root container control
  487. */
  488. get rootContainer(): Container;
  489. /**
  490. * Returns an array containing the root container.
  491. * This is mostly used to let the Inspector introspects the ADT
  492. * @returns an array containing the rootContainer
  493. */
  494. getChildren(): Array<Container>;
  495. /**
  496. * Will return all controls that are inside this texture
  497. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  498. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  499. * @return all child controls
  500. */
  501. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  502. /**
  503. * Gets or sets the current focused control
  504. */
  505. get focusedControl(): BABYLON.Nullable<IFocusableControl>;
  506. set focusedControl(control: BABYLON.Nullable<IFocusableControl>);
  507. /**
  508. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  509. */
  510. get isForeground(): boolean;
  511. set isForeground(value: boolean);
  512. /**
  513. * Gets or set information about clipboardData
  514. */
  515. get clipboardData(): string;
  516. set clipboardData(value: string);
  517. /**
  518. * Creates a new AdvancedDynamicTexture
  519. * @param name defines the name of the texture
  520. * @param width defines the width of the texture
  521. * @param height defines the height of the texture
  522. * @param scene defines the hosting scene
  523. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  524. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  525. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  526. */
  527. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
  528. /**
  529. * Get the current class name of the texture useful for serialization or dynamic coding.
  530. * @returns "AdvancedDynamicTexture"
  531. */
  532. getClassName(): string;
  533. /**
  534. * Function used to execute a function on all controls
  535. * @param func defines the function to execute
  536. * @param container defines the container where controls belong. If null the root container will be used
  537. */
  538. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  539. private _useInvalidateRectOptimization;
  540. /**
  541. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  542. */
  543. get useInvalidateRectOptimization(): boolean;
  544. set useInvalidateRectOptimization(value: boolean);
  545. private _invalidatedRectangle;
  546. /**
  547. * Invalidates a rectangle area on the gui texture
  548. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  549. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  550. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  551. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  552. */
  553. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  554. /**
  555. * Marks the texture as dirty forcing a complete update
  556. */
  557. markAsDirty(): void;
  558. /**
  559. * Helper function used to create a new style
  560. * @returns a new style
  561. * @see https://doc.babylonjs.com/how_to/gui#styles
  562. */
  563. createStyle(): Style;
  564. /**
  565. * Adds a new control to the root container
  566. * @param control defines the control to add
  567. * @returns the current texture
  568. */
  569. addControl(control: Control): AdvancedDynamicTexture;
  570. /**
  571. * Removes a control from the root container
  572. * @param control defines the control to remove
  573. * @returns the current texture
  574. */
  575. removeControl(control: Control): AdvancedDynamicTexture;
  576. /**
  577. * Release all resources
  578. */
  579. dispose(): void;
  580. private _onResize;
  581. /** @hidden */
  582. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  583. /**
  584. * Get screen coordinates for a vector3
  585. * @param position defines the position to project
  586. * @param worldMatrix defines the world matrix to use
  587. * @returns the projected position
  588. */
  589. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  590. /**
  591. * Get screen coordinates for a vector3
  592. * @param position defines the position to project
  593. * @param worldMatrix defines the world matrix to use
  594. * @returns the projected position with Z
  595. */
  596. getProjectedPositionWithZ(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector3;
  597. private _checkUpdate;
  598. private _clearMeasure;
  599. private _render;
  600. /** @hidden */
  601. _changeCursor(cursor: string): void;
  602. /** @hidden */
  603. _registerLastControlDown(control: Control, pointerId: number): void;
  604. private _doPicking;
  605. /** @hidden */
  606. _cleanControlAfterRemovalFromList(list: {
  607. [pointerId: number]: Control;
  608. }, control: Control): void;
  609. /** @hidden */
  610. _cleanControlAfterRemoval(control: Control): void;
  611. /** Attach to all scene events required to support pointer events */
  612. attach(): void;
  613. /** @hidden */
  614. private onClipboardCopy;
  615. /** @hidden */
  616. private onClipboardCut;
  617. /** @hidden */
  618. private onClipboardPaste;
  619. /**
  620. * Register the clipboard Events onto the canvas
  621. */
  622. registerClipboardEvents(): void;
  623. /**
  624. * Unregister the clipboard Events from the canvas
  625. */
  626. unRegisterClipboardEvents(): void;
  627. /**
  628. * Connect the texture to a hosting mesh to enable interactions
  629. * @param mesh defines the mesh to attach to
  630. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  631. */
  632. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  633. /**
  634. * Move the focus to a specific control
  635. * @param control defines the control which will receive the focus
  636. */
  637. moveFocusToControl(control: IFocusableControl): void;
  638. private _manageFocus;
  639. private _attachToOnPointerOut;
  640. private _attachToOnBlur;
  641. /**
  642. * Serializes the entire GUI system
  643. * @returns an object with the JSON serialized data
  644. */
  645. serializeContent(): any;
  646. /**
  647. * Recreate the content of the ADT from a JSON object
  648. * @param serializedObject define the JSON serialized object to restore from
  649. */
  650. parseContent(serializedObject: any): void;
  651. /**
  652. * Recreate the content of the ADT from a snippet saved by the GUI editor
  653. * @param snippetId defines the snippet to load
  654. * @returns a promise that will resolve on success
  655. */
  656. parseFromSnippetAsync(snippetId: string): Promise<void>;
  657. /**
  658. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  659. * @param mesh defines the mesh which will receive the texture
  660. * @param width defines the texture width (1024 by default)
  661. * @param height defines the texture height (1024 by default)
  662. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  663. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  664. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  665. * @returns a new AdvancedDynamicTexture
  666. */
  667. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  668. /**
  669. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture
  670. * @param mesh defines the mesh which will receive the texture
  671. * @param width defines the texture width (1024 by default)
  672. * @param height defines the texture height (1024 by default)
  673. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  674. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  675. * @returns a new AdvancedDynamicTexture
  676. */
  677. static CreateForMeshTexture(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  678. /**
  679. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  680. * In this mode the texture will rely on a layer for its rendering.
  681. * This allows it to be treated like any other layer.
  682. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  683. * LayerMask is set through advancedTexture.layer.layerMask
  684. * @param name defines name for the texture
  685. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  686. * @param scene defines the hsoting scene
  687. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  688. * @returns a new AdvancedDynamicTexture
  689. */
  690. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  691. }
  692. }
  693. declare module BABYLON.GUI {
  694. /**
  695. * Root class used for all 2D controls
  696. * @see https://doc.babylonjs.com/how_to/gui#controls
  697. */
  698. export class Control {
  699. /** defines the name of the control */
  700. name?: string | undefined;
  701. /**
  702. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  703. */
  704. static AllowAlphaInheritance: boolean;
  705. private _alpha;
  706. private _alphaSet;
  707. private _zIndex;
  708. /** @hidden */
  709. _host: AdvancedDynamicTexture;
  710. /** Gets or sets the control parent */
  711. parent: BABYLON.Nullable<Container>;
  712. /** @hidden */
  713. _currentMeasure: Measure;
  714. private _fontFamily;
  715. private _fontStyle;
  716. private _fontWeight;
  717. private _fontSize;
  718. private _font;
  719. /** @hidden */
  720. _width: ValueAndUnit;
  721. /** @hidden */
  722. _height: ValueAndUnit;
  723. /** @hidden */
  724. protected _fontOffset: {
  725. ascent: number;
  726. height: number;
  727. descent: number;
  728. };
  729. private _color;
  730. private _style;
  731. private _styleObserver;
  732. /** @hidden */
  733. protected _horizontalAlignment: number;
  734. /** @hidden */
  735. protected _verticalAlignment: number;
  736. /** @hidden */
  737. protected _isDirty: boolean;
  738. /** @hidden */
  739. protected _wasDirty: boolean;
  740. /** @hidden */
  741. _tempParentMeasure: Measure;
  742. /** @hidden */
  743. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  744. /** @hidden */
  745. protected _cachedParentMeasure: Measure;
  746. private _paddingLeft;
  747. private _paddingRight;
  748. private _paddingTop;
  749. private _paddingBottom;
  750. /** @hidden */
  751. _left: ValueAndUnit;
  752. /** @hidden */
  753. _top: ValueAndUnit;
  754. private _scaleX;
  755. private _scaleY;
  756. private _rotation;
  757. private _transformCenterX;
  758. private _transformCenterY;
  759. /** @hidden */
  760. _transformMatrix: Matrix2D;
  761. /** @hidden */
  762. protected _invertTransformMatrix: Matrix2D;
  763. /** @hidden */
  764. protected _transformedPosition: BABYLON.Vector2;
  765. private _isMatrixDirty;
  766. private _cachedOffsetX;
  767. private _cachedOffsetY;
  768. private _isVisible;
  769. private _isHighlighted;
  770. /** @hidden */
  771. _linkedMesh: BABYLON.Nullable<BABYLON.TransformNode>;
  772. private _fontSet;
  773. private _dummyVector2;
  774. private _downCount;
  775. private _enterCount;
  776. private _doNotRender;
  777. private _downPointerIds;
  778. protected _isEnabled: boolean;
  779. protected _disabledColor: string;
  780. protected _disabledColorItem: string;
  781. /** @hidden */
  782. protected _rebuildLayout: boolean;
  783. /** @hidden */
  784. _customData: any;
  785. /** @hidden */
  786. _isClipped: boolean;
  787. /** @hidden */
  788. _automaticSize: boolean;
  789. /** @hidden */
  790. _tag: any;
  791. /**
  792. * Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
  793. */
  794. uniqueId: number;
  795. /**
  796. * Gets or sets an object used to store user defined information for the node
  797. */
  798. metadata: any;
  799. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  800. isHitTestVisible: boolean;
  801. /** Gets or sets a boolean indicating if the control can block pointer events */
  802. isPointerBlocker: boolean;
  803. /** Gets or sets a boolean indicating if the control can be focusable */
  804. isFocusInvisible: boolean;
  805. /**
  806. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  807. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  808. */
  809. clipChildren: boolean;
  810. /**
  811. * Gets or sets a boolean indicating that control content must be clipped
  812. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  813. */
  814. clipContent: boolean;
  815. /**
  816. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  817. */
  818. useBitmapCache: boolean;
  819. private _cacheData;
  820. private _shadowOffsetX;
  821. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  822. get shadowOffsetX(): number;
  823. set shadowOffsetX(value: number);
  824. private _shadowOffsetY;
  825. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  826. get shadowOffsetY(): number;
  827. set shadowOffsetY(value: number);
  828. private _shadowBlur;
  829. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  830. get shadowBlur(): number;
  831. set shadowBlur(value: number);
  832. private _shadowColor;
  833. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  834. get shadowColor(): string;
  835. set shadowColor(value: string);
  836. /** Gets or sets the cursor to use when the control is hovered */
  837. hoverCursor: string;
  838. /** @hidden */
  839. protected _linkOffsetX: ValueAndUnit;
  840. /** @hidden */
  841. protected _linkOffsetY: ValueAndUnit;
  842. /** Gets the control type name */
  843. get typeName(): string;
  844. /**
  845. * Get the current class name of the control.
  846. * @returns current class name
  847. */
  848. getClassName(): string;
  849. /**
  850. * An event triggered when pointer wheel is scrolled
  851. */
  852. onWheelObservable: BABYLON.Observable<BABYLON.Vector2>;
  853. /**
  854. * An event triggered when the pointer move over the control.
  855. */
  856. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  857. /**
  858. * An event triggered when the pointer move out of the control.
  859. */
  860. onPointerOutObservable: BABYLON.Observable<Control>;
  861. /**
  862. * An event triggered when the pointer taps the control
  863. */
  864. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  865. /**
  866. * An event triggered when pointer up
  867. */
  868. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  869. /**
  870. * An event triggered when a control is clicked on
  871. */
  872. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  873. /**
  874. * An event triggered when pointer enters the control
  875. */
  876. onPointerEnterObservable: BABYLON.Observable<Control>;
  877. /**
  878. * An event triggered when the control is marked as dirty
  879. */
  880. onDirtyObservable: BABYLON.Observable<Control>;
  881. /**
  882. * An event triggered before drawing the control
  883. */
  884. onBeforeDrawObservable: BABYLON.Observable<Control>;
  885. /**
  886. * An event triggered after the control was drawn
  887. */
  888. onAfterDrawObservable: BABYLON.Observable<Control>;
  889. /**
  890. * An event triggered when the control has been disposed
  891. */
  892. onDisposeObservable: BABYLON.Observable<Control>;
  893. /**
  894. * Get the hosting AdvancedDynamicTexture
  895. */
  896. get host(): AdvancedDynamicTexture;
  897. /** Gets or set information about font offsets (used to render and align text) */
  898. get fontOffset(): {
  899. ascent: number;
  900. height: number;
  901. descent: number;
  902. };
  903. set fontOffset(offset: {
  904. ascent: number;
  905. height: number;
  906. descent: number;
  907. });
  908. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  909. get alpha(): number;
  910. set alpha(value: number);
  911. /**
  912. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  913. */
  914. get isHighlighted(): boolean;
  915. set isHighlighted(value: boolean);
  916. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  917. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  918. */
  919. get scaleX(): number;
  920. set scaleX(value: number);
  921. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  922. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  923. */
  924. get scaleY(): number;
  925. set scaleY(value: number);
  926. /** Gets or sets the rotation angle (0 by default)
  927. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  928. */
  929. get rotation(): number;
  930. set rotation(value: number);
  931. /** Gets or sets the transformation center on Y axis (0 by default)
  932. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  933. */
  934. get transformCenterY(): number;
  935. set transformCenterY(value: number);
  936. /** Gets or sets the transformation center on X axis (0 by default)
  937. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  938. */
  939. get transformCenterX(): number;
  940. set transformCenterX(value: number);
  941. /**
  942. * Gets or sets the horizontal alignment
  943. * @see https://doc.babylonjs.com/how_to/gui#alignments
  944. */
  945. get horizontalAlignment(): number;
  946. set horizontalAlignment(value: number);
  947. /**
  948. * Gets or sets the vertical alignment
  949. * @see https://doc.babylonjs.com/how_to/gui#alignments
  950. */
  951. get verticalAlignment(): number;
  952. set verticalAlignment(value: number);
  953. /**
  954. * Gets or sets a fixed ratio for this control.
  955. * When different from 0, the ratio is used to compute the "second" dimension.
  956. * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
  957. * second dimension is computed as first dimension * fixedRatio
  958. */
  959. fixedRatio: number;
  960. private _fixedRatioMasterIsWidth;
  961. /**
  962. * Gets or sets control width
  963. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  964. */
  965. get width(): string | number;
  966. set width(value: string | number);
  967. /**
  968. * Gets or sets the control width in pixel
  969. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  970. */
  971. get widthInPixels(): number;
  972. set widthInPixels(value: number);
  973. /**
  974. * Gets or sets control height
  975. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  976. */
  977. get height(): string | number;
  978. set height(value: string | number);
  979. /**
  980. * Gets or sets control height in pixel
  981. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  982. */
  983. get heightInPixels(): number;
  984. set heightInPixels(value: number);
  985. /** Gets or set font family */
  986. get fontFamily(): string;
  987. set fontFamily(value: string);
  988. /** Gets or sets font style */
  989. get fontStyle(): string;
  990. set fontStyle(value: string);
  991. /** Gets or sets font weight */
  992. get fontWeight(): string;
  993. set fontWeight(value: string);
  994. /**
  995. * Gets or sets style
  996. * @see https://doc.babylonjs.com/how_to/gui#styles
  997. */
  998. get style(): BABYLON.Nullable<Style>;
  999. set style(value: BABYLON.Nullable<Style>);
  1000. /** @hidden */
  1001. get _isFontSizeInPercentage(): boolean;
  1002. /** Gets or sets font size in pixels */
  1003. get fontSizeInPixels(): number;
  1004. set fontSizeInPixels(value: number);
  1005. /** Gets or sets font size */
  1006. get fontSize(): string | number;
  1007. set fontSize(value: string | number);
  1008. /** Gets or sets foreground color */
  1009. get color(): string;
  1010. set color(value: string);
  1011. /** Gets or sets z index which is used to reorder controls on the z axis */
  1012. get zIndex(): number;
  1013. set zIndex(value: number);
  1014. /** Gets or sets a boolean indicating if the control can be rendered */
  1015. get notRenderable(): boolean;
  1016. set notRenderable(value: boolean);
  1017. /** Gets or sets a boolean indicating if the control is visible */
  1018. get isVisible(): boolean;
  1019. set isVisible(value: boolean);
  1020. /** Gets a boolean indicating that the control needs to update its rendering */
  1021. get isDirty(): boolean;
  1022. /**
  1023. * Gets the current linked mesh (or null if none)
  1024. */
  1025. get linkedMesh(): BABYLON.Nullable<BABYLON.TransformNode>;
  1026. /**
  1027. * Gets or sets a value indicating the padding to use on the left of the control
  1028. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1029. */
  1030. get paddingLeft(): string | number;
  1031. set paddingLeft(value: string | number);
  1032. /**
  1033. * Gets or sets a value indicating the padding in pixels to use on the left of the control
  1034. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1035. */
  1036. get paddingLeftInPixels(): number;
  1037. set paddingLeftInPixels(value: number);
  1038. /**
  1039. * Gets or sets a value indicating the padding to use on the right of the control
  1040. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1041. */
  1042. get paddingRight(): string | number;
  1043. set paddingRight(value: string | number);
  1044. /**
  1045. * Gets or sets a value indicating the padding in pixels to use on the right of the control
  1046. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1047. */
  1048. get paddingRightInPixels(): number;
  1049. set paddingRightInPixels(value: number);
  1050. /**
  1051. * Gets or sets a value indicating the padding to use on the top of the control
  1052. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1053. */
  1054. get paddingTop(): string | number;
  1055. set paddingTop(value: string | number);
  1056. /**
  1057. * Gets or sets a value indicating the padding in pixels to use on the top of the control
  1058. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1059. */
  1060. get paddingTopInPixels(): number;
  1061. set paddingTopInPixels(value: number);
  1062. /**
  1063. * Gets or sets a value indicating the padding to use on the bottom of the control
  1064. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1065. */
  1066. get paddingBottom(): string | number;
  1067. set paddingBottom(value: string | number);
  1068. /**
  1069. * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
  1070. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1071. */
  1072. get paddingBottomInPixels(): number;
  1073. set paddingBottomInPixels(value: number);
  1074. /**
  1075. * Gets or sets a value indicating the left coordinate of the control
  1076. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1077. */
  1078. get left(): string | number;
  1079. set left(value: string | number);
  1080. /**
  1081. * Gets or sets a value indicating the left coordinate in pixels of the control
  1082. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1083. */
  1084. get leftInPixels(): number;
  1085. set leftInPixels(value: number);
  1086. /**
  1087. * Gets or sets a value indicating the top coordinate of the control
  1088. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1089. */
  1090. get top(): string | number;
  1091. set top(value: string | number);
  1092. /**
  1093. * Gets or sets a value indicating the top coordinate in pixels of the control
  1094. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1095. */
  1096. get topInPixels(): number;
  1097. set topInPixels(value: number);
  1098. /**
  1099. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1100. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1101. */
  1102. get linkOffsetX(): string | number;
  1103. set linkOffsetX(value: string | number);
  1104. /**
  1105. * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
  1106. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1107. */
  1108. get linkOffsetXInPixels(): number;
  1109. set linkOffsetXInPixels(value: number);
  1110. /**
  1111. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1112. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1113. */
  1114. get linkOffsetY(): string | number;
  1115. set linkOffsetY(value: string | number);
  1116. /**
  1117. * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
  1118. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1119. */
  1120. get linkOffsetYInPixels(): number;
  1121. set linkOffsetYInPixels(value: number);
  1122. /** Gets the center coordinate on X axis */
  1123. get centerX(): number;
  1124. /** Gets the center coordinate on Y axis */
  1125. get centerY(): number;
  1126. /** Gets or sets if control is Enabled */
  1127. get isEnabled(): boolean;
  1128. set isEnabled(value: boolean);
  1129. /** Gets or sets background color of control if it's disabled */
  1130. get disabledColor(): string;
  1131. set disabledColor(value: string);
  1132. /** Gets or sets front color of control if it's disabled */
  1133. get disabledColorItem(): string;
  1134. set disabledColorItem(value: string);
  1135. /**
  1136. * Creates a new control
  1137. * @param name defines the name of the control
  1138. */
  1139. constructor(
  1140. /** defines the name of the control */
  1141. name?: string | undefined);
  1142. /** @hidden */
  1143. protected _getTypeName(): string;
  1144. /**
  1145. * Gets the first ascendant in the hierarchy of the given type
  1146. * @param className defines the required type
  1147. * @returns the ascendant or null if not found
  1148. */
  1149. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  1150. /** @hidden */
  1151. _resetFontCache(): void;
  1152. /**
  1153. * Determines if a container is an ascendant of the current control
  1154. * @param container defines the container to look for
  1155. * @returns true if the container is one of the ascendant of the control
  1156. */
  1157. isAscendant(container: Control): boolean;
  1158. /**
  1159. * Gets coordinates in local control space
  1160. * @param globalCoordinates defines the coordinates to transform
  1161. * @returns the new coordinates in local space
  1162. */
  1163. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1164. /**
  1165. * Gets coordinates in local control space
  1166. * @param globalCoordinates defines the coordinates to transform
  1167. * @param result defines the target vector2 where to store the result
  1168. * @returns the current control
  1169. */
  1170. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  1171. /**
  1172. * Gets coordinates in parent local control space
  1173. * @param globalCoordinates defines the coordinates to transform
  1174. * @returns the new coordinates in parent local space
  1175. */
  1176. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1177. /**
  1178. * Move the current control to a vector3 position projected onto the screen.
  1179. * @param position defines the target position
  1180. * @param scene defines the hosting scene
  1181. */
  1182. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  1183. /**
  1184. * Will store all controls that have this control as ascendant in a given array
  1185. * @param results defines the array where to store the descendants
  1186. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1187. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1188. */
  1189. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1190. /**
  1191. * Will return all controls that have this control as ascendant
  1192. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1193. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1194. * @return all child controls
  1195. */
  1196. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1197. /**
  1198. * Link current control with a target mesh
  1199. * @param mesh defines the mesh to link with
  1200. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1201. */
  1202. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.TransformNode>): void;
  1203. /**
  1204. * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
  1205. * @param { string | number} paddingTop - The value of the top padding.
  1206. * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
  1207. * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
  1208. * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
  1209. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1210. */
  1211. setPadding(paddingTop: string | number, paddingRight?: string | number, paddingBottom?: string | number, paddingLeft?: string | number): void;
  1212. /**
  1213. * Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
  1214. * @param { number} paddingTop - The value in pixels of the top padding.
  1215. * @param { number} paddingRight - The value in pixels of the right padding. If omitted, top is used.
  1216. * @param { number} paddingBottom - The value in pixels of the bottom padding. If omitted, top is used.
  1217. * @param { number} paddingLeft - The value in pixels of the left padding. If omitted, right is used.
  1218. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1219. */
  1220. setPaddingInPixels(paddingTop: number, paddingRight?: number, paddingBottom?: number, paddingLeft?: number): void;
  1221. /** @hidden */
  1222. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  1223. /** @hidden */
  1224. _offsetLeft(offset: number): void;
  1225. /** @hidden */
  1226. _offsetTop(offset: number): void;
  1227. /** @hidden */
  1228. _markMatrixAsDirty(): void;
  1229. /** @hidden */
  1230. _flagDescendantsAsMatrixDirty(): void;
  1231. /** @hidden */
  1232. _intersectsRect(rect: Measure): boolean;
  1233. /** @hidden */
  1234. protected invalidateRect(): void;
  1235. /** @hidden */
  1236. _markAsDirty(force?: boolean): void;
  1237. /** @hidden */
  1238. _markAllAsDirty(): void;
  1239. /** @hidden */
  1240. _link(host: AdvancedDynamicTexture): void;
  1241. /** @hidden */
  1242. protected _transform(context?: CanvasRenderingContext2D): void;
  1243. /** @hidden */
  1244. _renderHighlight(context: CanvasRenderingContext2D): void;
  1245. /** @hidden */
  1246. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1247. /** @hidden */
  1248. protected _applyStates(context: CanvasRenderingContext2D): void;
  1249. /** @hidden */
  1250. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1251. /** @hidden */
  1252. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1253. protected _evaluateClippingState(parentMeasure: Measure): void;
  1254. /** @hidden */
  1255. _measure(): void;
  1256. /** @hidden */
  1257. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1258. /** @hidden */
  1259. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1260. /** @hidden */
  1261. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1262. /** @hidden */
  1263. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1264. private static _ClipMeasure;
  1265. private _tmpMeasureA;
  1266. private _clip;
  1267. /** @hidden */
  1268. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): boolean;
  1269. /** @hidden */
  1270. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  1271. /**
  1272. * Tests if a given coordinates belong to the current control
  1273. * @param x defines x coordinate to test
  1274. * @param y defines y coordinate to test
  1275. * @returns true if the coordinates are inside the control
  1276. */
  1277. contains(x: number, y: number): boolean;
  1278. /** @hidden */
  1279. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1280. /** @hidden */
  1281. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  1282. /** @hidden */
  1283. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  1284. /** @hidden */
  1285. _onPointerOut(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, force?: boolean): void;
  1286. /** @hidden */
  1287. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  1288. /** @hidden */
  1289. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: BABYLON.PointerInfoBase): void;
  1290. /** @hidden */
  1291. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  1292. /** @hidden */
  1293. _onWheelScroll(deltaX?: number, deltaY?: number): void;
  1294. /** @hidden */
  1295. _onCanvasBlur(): void;
  1296. /** @hidden */
  1297. _processObservables(type: number, x: number, y: number, pi: BABYLON.PointerInfoBase, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1298. private _prepareFont;
  1299. /**
  1300. * Serializes the current control
  1301. * @param serializationObject defined the JSON serialized object
  1302. */
  1303. serialize(serializationObject: any): void;
  1304. /** @hidden */
  1305. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1306. /** Releases associated resources */
  1307. dispose(): void;
  1308. private static _HORIZONTAL_ALIGNMENT_LEFT;
  1309. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  1310. private static _HORIZONTAL_ALIGNMENT_CENTER;
  1311. private static _VERTICAL_ALIGNMENT_TOP;
  1312. private static _VERTICAL_ALIGNMENT_BOTTOM;
  1313. private static _VERTICAL_ALIGNMENT_CENTER;
  1314. /** HORIZONTAL_ALIGNMENT_LEFT */
  1315. static get HORIZONTAL_ALIGNMENT_LEFT(): number;
  1316. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1317. static get HORIZONTAL_ALIGNMENT_RIGHT(): number;
  1318. /** HORIZONTAL_ALIGNMENT_CENTER */
  1319. static get HORIZONTAL_ALIGNMENT_CENTER(): number;
  1320. /** VERTICAL_ALIGNMENT_TOP */
  1321. static get VERTICAL_ALIGNMENT_TOP(): number;
  1322. /** VERTICAL_ALIGNMENT_BOTTOM */
  1323. static get VERTICAL_ALIGNMENT_BOTTOM(): number;
  1324. /** VERTICAL_ALIGNMENT_CENTER */
  1325. static get VERTICAL_ALIGNMENT_CENTER(): number;
  1326. private static _FontHeightSizes;
  1327. /** @hidden */
  1328. static _GetFontOffset(font: string): {
  1329. ascent: number;
  1330. height: number;
  1331. descent: number;
  1332. };
  1333. /**
  1334. * Creates a Control from parsed data
  1335. * @param serializedObject defines parsed data
  1336. * @param host defines the hosting AdvancedDynamicTexture
  1337. * @returns a new Control
  1338. */
  1339. static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control;
  1340. /**
  1341. * Creates a stack panel that can be used to render headers
  1342. * @param control defines the control to associate with the header
  1343. * @param text defines the text of the header
  1344. * @param size defines the size of the header
  1345. * @param options defines options used to configure the header
  1346. * @returns a new StackPanel
  1347. * @ignore
  1348. * @hidden
  1349. */
  1350. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1351. isHorizontal: boolean;
  1352. controlFirst: boolean;
  1353. }) => any;
  1354. /** @hidden */
  1355. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1356. }
  1357. }
  1358. declare module BABYLON.GUI {
  1359. /**
  1360. * Root class for 2D containers
  1361. * @see https://doc.babylonjs.com/how_to/gui#containers
  1362. */
  1363. export class Container extends Control {
  1364. name?: string | undefined;
  1365. /** @hidden */
  1366. _children: Control[];
  1367. /** @hidden */
  1368. protected _measureForChildren: Measure;
  1369. /** @hidden */
  1370. protected _background: string;
  1371. /** @hidden */
  1372. protected _adaptWidthToChildren: boolean;
  1373. /** @hidden */
  1374. protected _adaptHeightToChildren: boolean;
  1375. /**
  1376. * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
  1377. */
  1378. logLayoutCycleErrors: boolean;
  1379. /**
  1380. * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
  1381. */
  1382. maxLayoutCycle: number;
  1383. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  1384. get adaptHeightToChildren(): boolean;
  1385. set adaptHeightToChildren(value: boolean);
  1386. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  1387. get adaptWidthToChildren(): boolean;
  1388. set adaptWidthToChildren(value: boolean);
  1389. /** Gets or sets background color */
  1390. get background(): string;
  1391. set background(value: string);
  1392. /** Gets the list of children */
  1393. get children(): Control[];
  1394. /**
  1395. * Creates a new Container
  1396. * @param name defines the name of the container
  1397. */
  1398. constructor(name?: string | undefined);
  1399. protected _getTypeName(): string;
  1400. _flagDescendantsAsMatrixDirty(): void;
  1401. /**
  1402. * Gets a child using its name
  1403. * @param name defines the child name to look for
  1404. * @returns the child control if found
  1405. */
  1406. getChildByName(name: string): BABYLON.Nullable<Control>;
  1407. /**
  1408. * Gets a child using its type and its name
  1409. * @param name defines the child name to look for
  1410. * @param type defines the child type to look for
  1411. * @returns the child control if found
  1412. */
  1413. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  1414. /**
  1415. * Search for a specific control in children
  1416. * @param control defines the control to look for
  1417. * @returns true if the control is in child list
  1418. */
  1419. containsControl(control: Control): boolean;
  1420. /**
  1421. * Adds a new control to the current container
  1422. * @param control defines the control to add
  1423. * @returns the current container
  1424. */
  1425. addControl(control: BABYLON.Nullable<Control>): Container;
  1426. /**
  1427. * Removes all controls from the current container
  1428. * @returns the current container
  1429. */
  1430. clearControls(): Container;
  1431. /**
  1432. * Removes a control from the current container
  1433. * @param control defines the control to remove
  1434. * @returns the current container
  1435. */
  1436. removeControl(control: Control): Container;
  1437. /** @hidden */
  1438. _reOrderControl(control: Control): void;
  1439. /** @hidden */
  1440. _offsetLeft(offset: number): void;
  1441. /** @hidden */
  1442. _offsetTop(offset: number): void;
  1443. /** @hidden */
  1444. _markAllAsDirty(): void;
  1445. /** @hidden */
  1446. protected _localDraw(context: CanvasRenderingContext2D): void;
  1447. /** @hidden */
  1448. _link(host: AdvancedDynamicTexture): void;
  1449. /** @hidden */
  1450. protected _beforeLayout(): void;
  1451. /** @hidden */
  1452. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1453. /** @hidden */
  1454. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1455. protected _postMeasure(): void;
  1456. /** @hidden */
  1457. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  1458. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1459. /** @hidden */
  1460. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1461. /** @hidden */
  1462. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1463. /**
  1464. * Serializes the current control
  1465. * @param serializationObject defined the JSON serialized object
  1466. */
  1467. serialize(serializationObject: any): void;
  1468. /** Releases associated resources */
  1469. dispose(): void;
  1470. /** @hidden */
  1471. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1472. }
  1473. }
  1474. declare module BABYLON.GUI {
  1475. /** Class used to create rectangle container */
  1476. export class Rectangle extends Container {
  1477. name?: string | undefined;
  1478. private _thickness;
  1479. private _cornerRadius;
  1480. /** Gets or sets border thickness */
  1481. get thickness(): number;
  1482. set thickness(value: number);
  1483. /** Gets or sets the corner radius angle */
  1484. get cornerRadius(): number;
  1485. set cornerRadius(value: number);
  1486. /**
  1487. * Creates a new Rectangle
  1488. * @param name defines the control name
  1489. */
  1490. constructor(name?: string | undefined);
  1491. protected _getTypeName(): string;
  1492. protected _localDraw(context: CanvasRenderingContext2D): void;
  1493. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1494. private _drawRoundedRect;
  1495. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1496. }
  1497. }
  1498. declare module BABYLON.GUI {
  1499. /**
  1500. * Enum that determines the text-wrapping mode to use.
  1501. */
  1502. export enum TextWrapping {
  1503. /**
  1504. * Clip the text when it's larger than Control.width; this is the default mode.
  1505. */
  1506. Clip = 0,
  1507. /**
  1508. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1509. */
  1510. WordWrap = 1,
  1511. /**
  1512. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1513. */
  1514. Ellipsis = 2
  1515. }
  1516. /**
  1517. * Class used to create text block control
  1518. */
  1519. export class TextBlock extends Control {
  1520. /**
  1521. * Defines the name of the control
  1522. */
  1523. name?: string | undefined;
  1524. private _text;
  1525. private _textWrapping;
  1526. private _textHorizontalAlignment;
  1527. private _textVerticalAlignment;
  1528. private _lines;
  1529. private _resizeToFit;
  1530. private _lineSpacing;
  1531. private _outlineWidth;
  1532. private _outlineColor;
  1533. private _underline;
  1534. private _lineThrough;
  1535. /**
  1536. * An event triggered after the text is changed
  1537. */
  1538. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  1539. /**
  1540. * An event triggered after the text was broken up into lines
  1541. */
  1542. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  1543. /**
  1544. * Function used to split a string into words. By default, a string is split at each space character found
  1545. */
  1546. wordSplittingFunction: BABYLON.Nullable<(line: string) => string[]>;
  1547. /**
  1548. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1549. */
  1550. get lines(): any[];
  1551. /**
  1552. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1553. */
  1554. get resizeToFit(): boolean;
  1555. /**
  1556. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1557. */
  1558. set resizeToFit(value: boolean);
  1559. /**
  1560. * Gets or sets a boolean indicating if text must be wrapped
  1561. */
  1562. get textWrapping(): TextWrapping | boolean;
  1563. /**
  1564. * Gets or sets a boolean indicating if text must be wrapped
  1565. */
  1566. set textWrapping(value: TextWrapping | boolean);
  1567. /**
  1568. * Gets or sets text to display
  1569. */
  1570. get text(): string;
  1571. /**
  1572. * Gets or sets text to display
  1573. */
  1574. set text(value: string);
  1575. /**
  1576. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1577. */
  1578. get textHorizontalAlignment(): number;
  1579. /**
  1580. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1581. */
  1582. set textHorizontalAlignment(value: number);
  1583. /**
  1584. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1585. */
  1586. get textVerticalAlignment(): number;
  1587. /**
  1588. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1589. */
  1590. set textVerticalAlignment(value: number);
  1591. /**
  1592. * Gets or sets line spacing value
  1593. */
  1594. set lineSpacing(value: string | number);
  1595. /**
  1596. * Gets or sets line spacing value
  1597. */
  1598. get lineSpacing(): string | number;
  1599. /**
  1600. * Gets or sets outlineWidth of the text to display
  1601. */
  1602. get outlineWidth(): number;
  1603. /**
  1604. * Gets or sets outlineWidth of the text to display
  1605. */
  1606. set outlineWidth(value: number);
  1607. /**
  1608. * Gets or sets a boolean indicating that text must have underline
  1609. */
  1610. get underline(): boolean;
  1611. /**
  1612. * Gets or sets a boolean indicating that text must have underline
  1613. */
  1614. set underline(value: boolean);
  1615. /**
  1616. * Gets or sets an boolean indicating that text must be crossed out
  1617. */
  1618. get lineThrough(): boolean;
  1619. /**
  1620. * Gets or sets an boolean indicating that text must be crossed out
  1621. */
  1622. set lineThrough(value: boolean);
  1623. /**
  1624. * Gets or sets outlineColor of the text to display
  1625. */
  1626. get outlineColor(): string;
  1627. /**
  1628. * Gets or sets outlineColor of the text to display
  1629. */
  1630. set outlineColor(value: string);
  1631. /**
  1632. * Creates a new TextBlock object
  1633. * @param name defines the name of the control
  1634. * @param text defines the text to display (emptry string by default)
  1635. */
  1636. constructor(
  1637. /**
  1638. * Defines the name of the control
  1639. */
  1640. name?: string | undefined, text?: string);
  1641. protected _getTypeName(): string;
  1642. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1643. private _drawText;
  1644. /** @hidden */
  1645. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  1646. protected _applyStates(context: CanvasRenderingContext2D): void;
  1647. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1648. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1649. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1650. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1651. protected _renderLines(context: CanvasRenderingContext2D): void;
  1652. /**
  1653. * Given a width constraint applied on the text block, find the expected height
  1654. * @returns expected height
  1655. */
  1656. computeExpectedHeight(): number;
  1657. dispose(): void;
  1658. }
  1659. }
  1660. declare module BABYLON.GUI {
  1661. /**
  1662. * Class used to create 2D images
  1663. */
  1664. export class Image extends Control {
  1665. name?: string | undefined;
  1666. private _workingCanvas;
  1667. private _domImage;
  1668. private _imageWidth;
  1669. private _imageHeight;
  1670. private _loaded;
  1671. private _stretch;
  1672. private _source;
  1673. private _autoScale;
  1674. private _sourceLeft;
  1675. private _sourceTop;
  1676. private _sourceWidth;
  1677. private _sourceHeight;
  1678. private _svgAttributesComputationCompleted;
  1679. private _isSVG;
  1680. private _cellWidth;
  1681. private _cellHeight;
  1682. private _cellId;
  1683. private _populateNinePatchSlicesFromImage;
  1684. private _sliceLeft;
  1685. private _sliceRight;
  1686. private _sliceTop;
  1687. private _sliceBottom;
  1688. private _detectPointerOnOpaqueOnly;
  1689. private _imageDataCache;
  1690. /**
  1691. * BABYLON.Observable notified when the content is loaded
  1692. */
  1693. onImageLoadedObservable: BABYLON.Observable<Image>;
  1694. /**
  1695. * BABYLON.Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed
  1696. */
  1697. onSVGAttributesComputedObservable: BABYLON.Observable<Image>;
  1698. /**
  1699. * Gets a boolean indicating that the content is loaded
  1700. */
  1701. get isLoaded(): boolean;
  1702. /**
  1703. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  1704. */
  1705. get populateNinePatchSlicesFromImage(): boolean;
  1706. set populateNinePatchSlicesFromImage(value: boolean);
  1707. /**
  1708. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  1709. * Beware using this as this will comsume more memory as the image has to be stored twice
  1710. */
  1711. get detectPointerOnOpaqueOnly(): boolean;
  1712. set detectPointerOnOpaqueOnly(value: boolean);
  1713. /**
  1714. * Gets or sets the left value for slicing (9-patch)
  1715. */
  1716. get sliceLeft(): number;
  1717. set sliceLeft(value: number);
  1718. /**
  1719. * Gets or sets the right value for slicing (9-patch)
  1720. */
  1721. get sliceRight(): number;
  1722. set sliceRight(value: number);
  1723. /**
  1724. * Gets or sets the top value for slicing (9-patch)
  1725. */
  1726. get sliceTop(): number;
  1727. set sliceTop(value: number);
  1728. /**
  1729. * Gets or sets the bottom value for slicing (9-patch)
  1730. */
  1731. get sliceBottom(): number;
  1732. set sliceBottom(value: number);
  1733. /**
  1734. * Gets or sets the left coordinate in the source image
  1735. */
  1736. get sourceLeft(): number;
  1737. set sourceLeft(value: number);
  1738. /**
  1739. * Gets or sets the top coordinate in the source image
  1740. */
  1741. get sourceTop(): number;
  1742. set sourceTop(value: number);
  1743. /**
  1744. * Gets or sets the width to capture in the source image
  1745. */
  1746. get sourceWidth(): number;
  1747. set sourceWidth(value: number);
  1748. /**
  1749. * Gets or sets the height to capture in the source image
  1750. */
  1751. get sourceHeight(): number;
  1752. set sourceHeight(value: number);
  1753. /** Indicates if the format of the image is SVG */
  1754. get isSVG(): boolean;
  1755. /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */
  1756. get svgAttributesComputationCompleted(): boolean;
  1757. /**
  1758. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1759. * @see https://doc.babylonjs.com/how_to/gui#image
  1760. */
  1761. get autoScale(): boolean;
  1762. set autoScale(value: boolean);
  1763. /** Gets or sets the streching mode used by the image */
  1764. get stretch(): number;
  1765. set stretch(value: number);
  1766. /** @hidden */
  1767. _rotate90(n: number, preserveProperties?: boolean): Image;
  1768. private _handleRotationForSVGImage;
  1769. private _rotate90SourceProperties;
  1770. /**
  1771. * Gets or sets the internal DOM image used to render the control
  1772. */
  1773. set domImage(value: HTMLImageElement);
  1774. get domImage(): HTMLImageElement;
  1775. private _onImageLoaded;
  1776. private _extractNinePatchSliceDataFromImage;
  1777. /**
  1778. * Gets the image source url
  1779. */
  1780. get source(): BABYLON.Nullable<string>;
  1781. /**
  1782. * Gets or sets image source url
  1783. */
  1784. set source(value: BABYLON.Nullable<string>);
  1785. /**
  1786. * Checks for svg document with icon id present
  1787. */
  1788. private _svgCheck;
  1789. /**
  1790. * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically
  1791. * given external svg file and icon id
  1792. */
  1793. private _getSVGAttribs;
  1794. /**
  1795. * Gets or sets the cell width to use when animation sheet is enabled
  1796. * @see https://doc.babylonjs.com/how_to/gui#image
  1797. */
  1798. get cellWidth(): number;
  1799. set cellWidth(value: number);
  1800. /**
  1801. * Gets or sets the cell height to use when animation sheet is enabled
  1802. * @see https://doc.babylonjs.com/how_to/gui#image
  1803. */
  1804. get cellHeight(): number;
  1805. set cellHeight(value: number);
  1806. /**
  1807. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1808. * @see https://doc.babylonjs.com/how_to/gui#image
  1809. */
  1810. get cellId(): number;
  1811. set cellId(value: number);
  1812. /**
  1813. * Creates a new Image
  1814. * @param name defines the control name
  1815. * @param url defines the image url
  1816. */
  1817. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  1818. /**
  1819. * Tests if a given coordinates belong to the current control
  1820. * @param x defines x coordinate to test
  1821. * @param y defines y coordinate to test
  1822. * @returns true if the coordinates are inside the control
  1823. */
  1824. contains(x: number, y: number): boolean;
  1825. protected _getTypeName(): string;
  1826. /** Force the control to synchronize with its content */
  1827. synchronizeSizeWithContent(): void;
  1828. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1829. private _prepareWorkingCanvasForOpaqueDetection;
  1830. private _drawImage;
  1831. _draw(context: CanvasRenderingContext2D): void;
  1832. private _renderCornerPatch;
  1833. private _renderNinePatch;
  1834. dispose(): void;
  1835. /** STRETCH_NONE */
  1836. static readonly STRETCH_NONE: number;
  1837. /** STRETCH_FILL */
  1838. static readonly STRETCH_FILL: number;
  1839. /** STRETCH_UNIFORM */
  1840. static readonly STRETCH_UNIFORM: number;
  1841. /** STRETCH_EXTEND */
  1842. static readonly STRETCH_EXTEND: number;
  1843. /** NINE_PATCH */
  1844. static readonly STRETCH_NINE_PATCH: number;
  1845. }
  1846. }
  1847. declare module BABYLON.GUI {
  1848. /**
  1849. * Class used to create 2D buttons
  1850. */
  1851. export class Button extends Rectangle {
  1852. name?: string | undefined;
  1853. /**
  1854. * Function called to generate a pointer enter animation
  1855. */
  1856. pointerEnterAnimation: () => void;
  1857. /**
  1858. * Function called to generate a pointer out animation
  1859. */
  1860. pointerOutAnimation: () => void;
  1861. /**
  1862. * Function called to generate a pointer down animation
  1863. */
  1864. pointerDownAnimation: () => void;
  1865. /**
  1866. * Function called to generate a pointer up animation
  1867. */
  1868. pointerUpAnimation: () => void;
  1869. /**
  1870. * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
  1871. */
  1872. delegatePickingToChildren: boolean;
  1873. private _image;
  1874. /**
  1875. * Returns the image part of the button (if any)
  1876. */
  1877. get image(): BABYLON.Nullable<Image>;
  1878. private _textBlock;
  1879. /**
  1880. * Returns the image part of the button (if any)
  1881. */
  1882. get textBlock(): BABYLON.Nullable<TextBlock>;
  1883. /**
  1884. * Creates a new Button
  1885. * @param name defines the name of the button
  1886. */
  1887. constructor(name?: string | undefined);
  1888. protected _getTypeName(): string;
  1889. /** @hidden */
  1890. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1891. /** @hidden */
  1892. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  1893. /** @hidden */
  1894. _onPointerOut(target: Control, pi: BABYLON.PointerInfoBase, force?: boolean): void;
  1895. /** @hidden */
  1896. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  1897. /** @hidden */
  1898. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  1899. /**
  1900. * Creates a new button made with an image and a text
  1901. * @param name defines the name of the button
  1902. * @param text defines the text of the button
  1903. * @param imageUrl defines the url of the image
  1904. * @returns a new Button
  1905. */
  1906. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  1907. /**
  1908. * Creates a new button made with an image
  1909. * @param name defines the name of the button
  1910. * @param imageUrl defines the url of the image
  1911. * @returns a new Button
  1912. */
  1913. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  1914. /**
  1915. * Creates a new button made with a text
  1916. * @param name defines the name of the button
  1917. * @param text defines the text of the button
  1918. * @returns a new Button
  1919. */
  1920. static CreateSimpleButton(name: string, text: string): Button;
  1921. /**
  1922. * Creates a new button made with an image and a centered text
  1923. * @param name defines the name of the button
  1924. * @param text defines the text of the button
  1925. * @param imageUrl defines the url of the image
  1926. * @returns a new Button
  1927. */
  1928. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  1929. }
  1930. }
  1931. declare module BABYLON.GUI {
  1932. /**
  1933. * Class used to create a 2D stack panel container
  1934. */
  1935. export class StackPanel extends Container {
  1936. name?: string | undefined;
  1937. private _isVertical;
  1938. private _manualWidth;
  1939. private _manualHeight;
  1940. private _doNotTrackManualChanges;
  1941. /**
  1942. * Gets or sets a boolean indicating that layou warnings should be ignored
  1943. */
  1944. ignoreLayoutWarnings: boolean;
  1945. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1946. get isVertical(): boolean;
  1947. set isVertical(value: boolean);
  1948. /**
  1949. * Gets or sets panel width.
  1950. * This value should not be set when in horizontal mode as it will be computed automatically
  1951. */
  1952. set width(value: string | number);
  1953. get width(): string | number;
  1954. /**
  1955. * Gets or sets panel height.
  1956. * This value should not be set when in vertical mode as it will be computed automatically
  1957. */
  1958. set height(value: string | number);
  1959. get height(): string | number;
  1960. /**
  1961. * Creates a new StackPanel
  1962. * @param name defines control name
  1963. */
  1964. constructor(name?: string | undefined);
  1965. protected _getTypeName(): string;
  1966. /** @hidden */
  1967. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1968. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1969. protected _postMeasure(): void;
  1970. /**
  1971. * Serializes the current control
  1972. * @param serializationObject defined the JSON serialized object
  1973. */
  1974. serialize(serializationObject: any): void;
  1975. /** @hidden */
  1976. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1977. }
  1978. }
  1979. declare module BABYLON.GUI {
  1980. /**
  1981. * Class used to represent a 2D checkbox
  1982. */
  1983. export class Checkbox extends Control {
  1984. name?: string | undefined;
  1985. private _isChecked;
  1986. private _background;
  1987. private _checkSizeRatio;
  1988. private _thickness;
  1989. /** Gets or sets border thickness */
  1990. get thickness(): number;
  1991. set thickness(value: number);
  1992. /**
  1993. * BABYLON.Observable raised when isChecked property changes
  1994. */
  1995. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  1996. /** Gets or sets a value indicating the ratio between overall size and check size */
  1997. get checkSizeRatio(): number;
  1998. set checkSizeRatio(value: number);
  1999. /** Gets or sets background color */
  2000. get background(): string;
  2001. set background(value: string);
  2002. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2003. get isChecked(): boolean;
  2004. set isChecked(value: boolean);
  2005. /**
  2006. * Creates a new CheckBox
  2007. * @param name defines the control name
  2008. */
  2009. constructor(name?: string | undefined);
  2010. protected _getTypeName(): string;
  2011. /** @hidden */
  2012. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2013. /** @hidden */
  2014. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2015. /**
  2016. * Utility function to easily create a checkbox with a header
  2017. * @param title defines the label to use for the header
  2018. * @param onValueChanged defines the callback to call when value changes
  2019. * @returns a StackPanel containing the checkbox and a textBlock
  2020. */
  2021. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  2022. }
  2023. }
  2024. declare module BABYLON.GUI {
  2025. /**
  2026. * Class used to store key control properties
  2027. */
  2028. export class KeyPropertySet {
  2029. /** Width */
  2030. width?: string;
  2031. /** Height */
  2032. height?: string;
  2033. /** Left padding */
  2034. paddingLeft?: string;
  2035. /** Right padding */
  2036. paddingRight?: string;
  2037. /** Top padding */
  2038. paddingTop?: string;
  2039. /** Bottom padding */
  2040. paddingBottom?: string;
  2041. /** Foreground color */
  2042. color?: string;
  2043. /** Background color */
  2044. background?: string;
  2045. }
  2046. /**
  2047. * Class used to create virtual keyboard
  2048. */
  2049. export class VirtualKeyboard extends StackPanel {
  2050. /** BABYLON.Observable raised when a key is pressed */
  2051. onKeyPressObservable: BABYLON.Observable<string>;
  2052. /** Gets or sets default key button width */
  2053. defaultButtonWidth: string;
  2054. /** Gets or sets default key button height */
  2055. defaultButtonHeight: string;
  2056. /** Gets or sets default key button left padding */
  2057. defaultButtonPaddingLeft: string;
  2058. /** Gets or sets default key button right padding */
  2059. defaultButtonPaddingRight: string;
  2060. /** Gets or sets default key button top padding */
  2061. defaultButtonPaddingTop: string;
  2062. /** Gets or sets default key button bottom padding */
  2063. defaultButtonPaddingBottom: string;
  2064. /** Gets or sets default key button foreground color */
  2065. defaultButtonColor: string;
  2066. /** Gets or sets default key button background color */
  2067. defaultButtonBackground: string;
  2068. /** Gets or sets shift button foreground color */
  2069. shiftButtonColor: string;
  2070. /** Gets or sets shift button thickness*/
  2071. selectedShiftThickness: number;
  2072. /** Gets shift key state */
  2073. shiftState: number;
  2074. protected _getTypeName(): string;
  2075. private _createKey;
  2076. /**
  2077. * Adds a new row of keys
  2078. * @param keys defines the list of keys to add
  2079. * @param propertySets defines the associated property sets
  2080. */
  2081. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2082. /**
  2083. * Set the shift key to a specific state
  2084. * @param shiftState defines the new shift state
  2085. */
  2086. applyShiftState(shiftState: number): void;
  2087. private _currentlyConnectedInputText;
  2088. private _connectedInputTexts;
  2089. private _onKeyPressObserver;
  2090. /** Gets the input text control currently attached to the keyboard */
  2091. get connectedInputText(): BABYLON.Nullable<InputText>;
  2092. /**
  2093. * Connects the keyboard with an input text control
  2094. *
  2095. * @param input defines the target control
  2096. */
  2097. connect(input: InputText): void;
  2098. /**
  2099. * Disconnects the keyboard from connected InputText controls
  2100. *
  2101. * @param input optionally defines a target control, otherwise all are disconnected
  2102. */
  2103. disconnect(input?: InputText): void;
  2104. private _removeConnectedInputObservables;
  2105. /**
  2106. * Release all resources
  2107. */
  2108. dispose(): void;
  2109. /**
  2110. * Creates a new keyboard using a default layout
  2111. *
  2112. * @param name defines control name
  2113. * @returns a new VirtualKeyboard
  2114. */
  2115. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2116. }
  2117. }
  2118. declare module BABYLON.GUI {
  2119. /** @hidden */
  2120. export class TextWrapper {
  2121. private _text;
  2122. private _characters;
  2123. get text(): string;
  2124. set text(txt: string);
  2125. get length(): number;
  2126. removePart(idxStart: number, idxEnd: number, insertTxt?: string): void;
  2127. charAt(idx: number): string;
  2128. substr(from: number, length?: number): string;
  2129. substring(from: number, to?: number): string;
  2130. isWord(index: number): boolean;
  2131. }
  2132. }
  2133. declare module BABYLON.GUI {
  2134. /**
  2135. * Class used to create input text control
  2136. */
  2137. export class InputText extends Control implements IFocusableControl {
  2138. name?: string | undefined;
  2139. private _textWrapper;
  2140. private _placeholderText;
  2141. private _background;
  2142. private _focusedBackground;
  2143. private _focusedColor;
  2144. private _placeholderColor;
  2145. private _thickness;
  2146. private _margin;
  2147. private _autoStretchWidth;
  2148. private _maxWidth;
  2149. private _isFocused;
  2150. private _blinkTimeout;
  2151. private _blinkIsEven;
  2152. private _cursorOffset;
  2153. private _scrollLeft;
  2154. private _textWidth;
  2155. private _clickedCoordinate;
  2156. private _deadKey;
  2157. private _addKey;
  2158. private _currentKey;
  2159. private _isTextHighlightOn;
  2160. private _textHighlightColor;
  2161. private _highligherOpacity;
  2162. private _highlightedText;
  2163. private _startHighlightIndex;
  2164. private _endHighlightIndex;
  2165. private _cursorIndex;
  2166. private _onFocusSelectAll;
  2167. private _isPointerDown;
  2168. private _onClipboardObserver;
  2169. private _onPointerDblTapObserver;
  2170. /** @hidden */
  2171. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  2172. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  2173. promptMessage: string;
  2174. /** Force disable prompt on mobile device */
  2175. disableMobilePrompt: boolean;
  2176. /** BABYLON.Observable raised when the text changes */
  2177. onTextChangedObservable: BABYLON.Observable<InputText>;
  2178. /** BABYLON.Observable raised just before an entered character is to be added */
  2179. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  2180. /** BABYLON.Observable raised when the control gets the focus */
  2181. onFocusObservable: BABYLON.Observable<InputText>;
  2182. /** BABYLON.Observable raised when the control loses the focus */
  2183. onBlurObservable: BABYLON.Observable<InputText>;
  2184. /**Observable raised when the text is highlighted */
  2185. onTextHighlightObservable: BABYLON.Observable<InputText>;
  2186. /**Observable raised when copy event is triggered */
  2187. onTextCopyObservable: BABYLON.Observable<InputText>;
  2188. /** BABYLON.Observable raised when cut event is triggered */
  2189. onTextCutObservable: BABYLON.Observable<InputText>;
  2190. /** BABYLON.Observable raised when paste event is triggered */
  2191. onTextPasteObservable: BABYLON.Observable<InputText>;
  2192. /** BABYLON.Observable raised when a key event was processed */
  2193. onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
  2194. /** Gets or sets the maximum width allowed by the control */
  2195. get maxWidth(): string | number;
  2196. /** Gets the maximum width allowed by the control in pixels */
  2197. get maxWidthInPixels(): number;
  2198. set maxWidth(value: string | number);
  2199. /** Gets or sets the text highlighter transparency; default: 0.4 */
  2200. get highligherOpacity(): number;
  2201. set highligherOpacity(value: number);
  2202. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  2203. get onFocusSelectAll(): boolean;
  2204. set onFocusSelectAll(value: boolean);
  2205. /** Gets or sets the text hightlight color */
  2206. get textHighlightColor(): string;
  2207. set textHighlightColor(value: string);
  2208. /** Gets or sets control margin */
  2209. get margin(): string;
  2210. /** Gets control margin in pixels */
  2211. get marginInPixels(): number;
  2212. set margin(value: string);
  2213. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  2214. get autoStretchWidth(): boolean;
  2215. set autoStretchWidth(value: boolean);
  2216. /** Gets or sets border thickness */
  2217. get thickness(): number;
  2218. set thickness(value: number);
  2219. /** Gets or sets the background color when focused */
  2220. get focusedBackground(): string;
  2221. set focusedBackground(value: string);
  2222. /** Gets or sets the background color when focused */
  2223. get focusedColor(): string;
  2224. set focusedColor(value: string);
  2225. /** Gets or sets the background color */
  2226. get background(): string;
  2227. set background(value: string);
  2228. /** Gets or sets the placeholder color */
  2229. get placeholderColor(): string;
  2230. set placeholderColor(value: string);
  2231. /** Gets or sets the text displayed when the control is empty */
  2232. get placeholderText(): string;
  2233. set placeholderText(value: string);
  2234. /** Gets or sets the dead key flag */
  2235. get deadKey(): boolean;
  2236. set deadKey(flag: boolean);
  2237. /** Gets or sets the highlight text */
  2238. get highlightedText(): string;
  2239. set highlightedText(text: string);
  2240. /** Gets or sets if the current key should be added */
  2241. get addKey(): boolean;
  2242. set addKey(flag: boolean);
  2243. /** Gets or sets the value of the current key being entered */
  2244. get currentKey(): string;
  2245. set currentKey(key: string);
  2246. /** Gets or sets the text displayed in the control */
  2247. get text(): string;
  2248. set text(value: string);
  2249. private _textHasChanged;
  2250. /** Gets or sets control width */
  2251. get width(): string | number;
  2252. set width(value: string | number);
  2253. /**
  2254. * Creates a new InputText
  2255. * @param name defines the control name
  2256. * @param text defines the text of the control
  2257. */
  2258. constructor(name?: string | undefined, text?: string);
  2259. /** @hidden */
  2260. onBlur(): void;
  2261. /** @hidden */
  2262. onFocus(): void;
  2263. /**
  2264. * Function to focus an inputText programmatically
  2265. */
  2266. focus(): void;
  2267. /**
  2268. * Function to unfocus an inputText programmatically
  2269. */
  2270. blur(): void;
  2271. protected _getTypeName(): string;
  2272. /**
  2273. * Function called to get the list of controls that should not steal the focus from this control
  2274. * @returns an array of controls
  2275. */
  2276. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  2277. /** @hidden */
  2278. processKey(keyCode: number, key?: string, evt?: BABYLON.IKeyboardEvent): void;
  2279. /** @hidden */
  2280. private _updateValueFromCursorIndex;
  2281. /** @hidden */
  2282. private _processDblClick;
  2283. /** @hidden */
  2284. private _selectAllText;
  2285. /**
  2286. * Handles the keyboard event
  2287. * @param evt Defines the KeyboardEvent
  2288. */
  2289. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  2290. /** @hidden */
  2291. private _onCopyText;
  2292. /** @hidden */
  2293. private _onCutText;
  2294. /** @hidden */
  2295. private _onPasteText;
  2296. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2297. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2298. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  2299. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2300. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  2301. dispose(): void;
  2302. }
  2303. }
  2304. declare module BABYLON.GUI {
  2305. /**
  2306. * Class used to create a 2D grid container
  2307. */
  2308. export class Grid extends Container {
  2309. name?: string | undefined;
  2310. private _rowDefinitions;
  2311. private _columnDefinitions;
  2312. private _cells;
  2313. private _childControls;
  2314. /**
  2315. * Gets the number of columns
  2316. */
  2317. get columnCount(): number;
  2318. /**
  2319. * Gets the number of rows
  2320. */
  2321. get rowCount(): number;
  2322. /** Gets the list of children */
  2323. get children(): Control[];
  2324. /** Gets the list of cells (e.g. the containers) */
  2325. get cells(): {
  2326. [key: string]: Container;
  2327. };
  2328. /**
  2329. * Gets the definition of a specific row
  2330. * @param index defines the index of the row
  2331. * @returns the row definition
  2332. */
  2333. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  2334. /**
  2335. * Gets the definition of a specific column
  2336. * @param index defines the index of the column
  2337. * @returns the column definition
  2338. */
  2339. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  2340. /**
  2341. * Adds a new row to the grid
  2342. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2343. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  2344. * @returns the current grid
  2345. */
  2346. addRowDefinition(height: number, isPixel?: boolean): Grid;
  2347. /**
  2348. * Adds a new column to the grid
  2349. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2350. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2351. * @returns the current grid
  2352. */
  2353. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  2354. /**
  2355. * Update a row definition
  2356. * @param index defines the index of the row to update
  2357. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2358. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  2359. * @returns the current grid
  2360. */
  2361. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  2362. /**
  2363. * Update a column definition
  2364. * @param index defines the index of the column to update
  2365. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2366. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2367. * @returns the current grid
  2368. */
  2369. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  2370. /**
  2371. * Gets the list of children stored in a specific cell
  2372. * @param row defines the row to check
  2373. * @param column defines the column to check
  2374. * @returns the list of controls
  2375. */
  2376. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  2377. /**
  2378. * Gets a string representing the child cell info (row x column)
  2379. * @param child defines the control to get info from
  2380. * @returns a string containing the child cell info (row x column)
  2381. */
  2382. getChildCellInfo(child: Control): string;
  2383. private _removeCell;
  2384. private _offsetCell;
  2385. /**
  2386. * Remove a column definition at specified index
  2387. * @param index defines the index of the column to remove
  2388. * @returns the current grid
  2389. */
  2390. removeColumnDefinition(index: number): Grid;
  2391. /**
  2392. * Remove a row definition at specified index
  2393. * @param index defines the index of the row to remove
  2394. * @returns the current grid
  2395. */
  2396. removeRowDefinition(index: number): Grid;
  2397. /**
  2398. * Adds a new control to the current grid
  2399. * @param control defines the control to add
  2400. * @param row defines the row where to add the control (0 by default)
  2401. * @param column defines the column where to add the control (0 by default)
  2402. * @returns the current grid
  2403. */
  2404. addControl(control: Control, row?: number, column?: number): Grid;
  2405. /**
  2406. * Removes a control from the current container
  2407. * @param control defines the control to remove
  2408. * @returns the current container
  2409. */
  2410. removeControl(control: Control): Container;
  2411. /**
  2412. * Creates a new Grid
  2413. * @param name defines control name
  2414. */
  2415. constructor(name?: string | undefined);
  2416. protected _getTypeName(): string;
  2417. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  2418. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2419. _flagDescendantsAsMatrixDirty(): void;
  2420. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2421. /** Releases associated resources */
  2422. dispose(): void;
  2423. }
  2424. }
  2425. declare module BABYLON.GUI {
  2426. /** Class used to create color pickers */
  2427. export class ColorPicker extends Control {
  2428. name?: string | undefined;
  2429. private static _Epsilon;
  2430. private _colorWheelCanvas;
  2431. private _value;
  2432. private _tmpColor;
  2433. private _pointerStartedOnSquare;
  2434. private _pointerStartedOnWheel;
  2435. private _squareLeft;
  2436. private _squareTop;
  2437. private _squareSize;
  2438. private _h;
  2439. private _s;
  2440. private _v;
  2441. private _lastPointerDownID;
  2442. /**
  2443. * BABYLON.Observable raised when the value changes
  2444. */
  2445. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  2446. /** Gets or sets the color of the color picker */
  2447. get value(): BABYLON.Color3;
  2448. set value(value: BABYLON.Color3);
  2449. /**
  2450. * Gets or sets control width
  2451. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  2452. */
  2453. get width(): string | number;
  2454. set width(value: string | number);
  2455. /**
  2456. * Gets or sets control height
  2457. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  2458. */
  2459. get height(): string | number;
  2460. /** Gets or sets control height */
  2461. set height(value: string | number);
  2462. /** Gets or sets control size */
  2463. get size(): string | number;
  2464. set size(value: string | number);
  2465. /**
  2466. * Creates a new ColorPicker
  2467. * @param name defines the control name
  2468. */
  2469. constructor(name?: string | undefined);
  2470. protected _getTypeName(): string;
  2471. /** @hidden */
  2472. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2473. private _updateSquareProps;
  2474. private _drawGradientSquare;
  2475. private _drawCircle;
  2476. private _createColorWheelCanvas;
  2477. /** @hidden */
  2478. _draw(context: CanvasRenderingContext2D): void;
  2479. private _pointerIsDown;
  2480. private _updateValueFromPointer;
  2481. private _isPointOnSquare;
  2482. private _isPointOnWheel;
  2483. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2484. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  2485. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  2486. _onCanvasBlur(): void;
  2487. /**
  2488. * This function expands the color picker by creating a color picker dialog with manual
  2489. * color value input and the ability to save colors into an array to be used later in
  2490. * subsequent launches of the dialogue.
  2491. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  2492. * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.
  2493. * @returns picked color as a hex string and the saved colors array as hex strings.
  2494. */
  2495. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  2496. pickerWidth?: string;
  2497. pickerHeight?: string;
  2498. headerHeight?: string;
  2499. lastColor?: string;
  2500. swatchLimit?: number;
  2501. numSwatchesPerLine?: number;
  2502. savedColors?: Array<string>;
  2503. }): Promise<{
  2504. savedColors?: string[];
  2505. pickedColor: string;
  2506. }>;
  2507. }
  2508. }
  2509. declare module BABYLON.GUI {
  2510. /** Class used to create 2D ellipse containers */
  2511. export class Ellipse extends Container {
  2512. name?: string | undefined;
  2513. private _thickness;
  2514. /** Gets or sets border thickness */
  2515. get thickness(): number;
  2516. set thickness(value: number);
  2517. /**
  2518. * Creates a new Ellipse
  2519. * @param name defines the control name
  2520. */
  2521. constructor(name?: string | undefined);
  2522. protected _getTypeName(): string;
  2523. protected _localDraw(context: CanvasRenderingContext2D): void;
  2524. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2525. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2526. }
  2527. }
  2528. declare module BABYLON.GUI {
  2529. /**
  2530. * Class used to create a focusable button that can easily handle keyboard events
  2531. */
  2532. export class FocusableButton extends Button implements IFocusableControl {
  2533. name?: string | undefined;
  2534. /** Highlight color when button is focused */
  2535. focusedColor: BABYLON.Nullable<string>;
  2536. private _isFocused;
  2537. private _unfocusedColor;
  2538. /** BABYLON.Observable raised when the control gets the focus */
  2539. onFocusObservable: BABYLON.Observable<Button>;
  2540. /** BABYLON.Observable raised when the control loses the focus */
  2541. onBlurObservable: BABYLON.Observable<Button>;
  2542. /** BABYLON.Observable raised when a key event was processed */
  2543. onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
  2544. constructor(name?: string | undefined);
  2545. /** @hidden */
  2546. onBlur(): void;
  2547. /** @hidden */
  2548. onFocus(): void;
  2549. /**
  2550. * Function called to get the list of controls that should not steal the focus from this control
  2551. * @returns an array of controls
  2552. */
  2553. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  2554. /**
  2555. * Function to focus a button programmatically
  2556. */
  2557. focus(): void;
  2558. /**
  2559. * Function to unfocus a button programmatically
  2560. */
  2561. blur(): void;
  2562. /**
  2563. * Handles the keyboard event
  2564. * @param evt Defines the KeyboardEvent
  2565. */
  2566. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  2567. /** @hidden */
  2568. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2569. /** @hidden */
  2570. displose(): void;
  2571. }
  2572. }
  2573. declare module BABYLON.GUI {
  2574. /**
  2575. * Class used to create a password control
  2576. */
  2577. export class InputPassword extends InputText {
  2578. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  2579. }
  2580. }
  2581. declare module BABYLON.GUI {
  2582. /** Class used to render 2D lines */
  2583. export class Line extends Control {
  2584. name?: string | undefined;
  2585. private _lineWidth;
  2586. private _x1;
  2587. private _y1;
  2588. private _x2;
  2589. private _y2;
  2590. private _dash;
  2591. private _connectedControl;
  2592. private _connectedControlDirtyObserver;
  2593. /** Gets or sets the dash pattern */
  2594. get dash(): Array<number>;
  2595. set dash(value: Array<number>);
  2596. /** Gets or sets the control connected with the line end */
  2597. get connectedControl(): Control;
  2598. set connectedControl(value: Control);
  2599. /** Gets or sets start coordinates on X axis */
  2600. get x1(): string | number;
  2601. set x1(value: string | number);
  2602. /** Gets or sets start coordinates on Y axis */
  2603. get y1(): string | number;
  2604. set y1(value: string | number);
  2605. /** Gets or sets end coordinates on X axis */
  2606. get x2(): string | number;
  2607. set x2(value: string | number);
  2608. /** Gets or sets end coordinates on Y axis */
  2609. get y2(): string | number;
  2610. set y2(value: string | number);
  2611. /** Gets or sets line width */
  2612. get lineWidth(): number;
  2613. set lineWidth(value: number);
  2614. /** Gets or sets horizontal alignment */
  2615. set horizontalAlignment(value: number);
  2616. /** Gets or sets vertical alignment */
  2617. set verticalAlignment(value: number);
  2618. private get _effectiveX2();
  2619. private get _effectiveY2();
  2620. /**
  2621. * Creates a new Line
  2622. * @param name defines the control name
  2623. */
  2624. constructor(name?: string | undefined);
  2625. protected _getTypeName(): string;
  2626. _draw(context: CanvasRenderingContext2D): void;
  2627. _measure(): void;
  2628. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2629. /**
  2630. * Move one end of the line given 3D cartesian coordinates.
  2631. * @param position Targeted world position
  2632. * @param scene BABYLON.Scene
  2633. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2634. */
  2635. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  2636. /**
  2637. * Move one end of the line to a position in screen absolute space.
  2638. * @param projectedPosition Position in screen absolute space (X, Y)
  2639. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2640. */
  2641. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  2642. }
  2643. }
  2644. declare module BABYLON.GUI {
  2645. /**
  2646. * Class used to store a point for a MultiLine object.
  2647. * The point can be pure 2D coordinates, a mesh or a control
  2648. */
  2649. export class MultiLinePoint {
  2650. private _multiLine;
  2651. private _x;
  2652. private _y;
  2653. private _control;
  2654. private _mesh;
  2655. private _controlObserver;
  2656. private _meshObserver;
  2657. /** @hidden */
  2658. _point: BABYLON.Vector3;
  2659. /**
  2660. * Creates a new MultiLinePoint
  2661. * @param multiLine defines the source MultiLine object
  2662. */
  2663. constructor(multiLine: MultiLine);
  2664. /** Gets or sets x coordinate */
  2665. get x(): string | number;
  2666. set x(value: string | number);
  2667. /** Gets or sets y coordinate */
  2668. get y(): string | number;
  2669. set y(value: string | number);
  2670. /** Gets or sets the control associated with this point */
  2671. get control(): BABYLON.Nullable<Control>;
  2672. set control(value: BABYLON.Nullable<Control>);
  2673. /** Gets or sets the mesh associated with this point */
  2674. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  2675. set mesh(value: BABYLON.Nullable<BABYLON.AbstractMesh>);
  2676. /** Resets links */
  2677. resetLinks(): void;
  2678. /**
  2679. * Gets a translation vector with Z component
  2680. * @returns the translation vector
  2681. */
  2682. translate(): BABYLON.Vector3;
  2683. private _translatePoint;
  2684. /** Release associated resources */
  2685. dispose(): void;
  2686. }
  2687. }
  2688. declare module BABYLON.GUI {
  2689. /**
  2690. * Class used to create multi line control
  2691. */
  2692. export class MultiLine extends Control {
  2693. name?: string | undefined;
  2694. private _lineWidth;
  2695. private _dash;
  2696. private _points;
  2697. private _minX;
  2698. private _minY;
  2699. private _maxX;
  2700. private _maxY;
  2701. /**
  2702. * Creates a new MultiLine
  2703. * @param name defines the control name
  2704. */
  2705. constructor(name?: string | undefined);
  2706. /** Gets or sets dash pattern */
  2707. get dash(): Array<number>;
  2708. set dash(value: Array<number>);
  2709. /**
  2710. * Gets point stored at specified index
  2711. * @param index defines the index to look for
  2712. * @returns the requested point if found
  2713. */
  2714. getAt(index: number): MultiLinePoint;
  2715. /** Function called when a point is updated */
  2716. onPointUpdate: () => void;
  2717. /**
  2718. * Adds new points to the point collection
  2719. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  2720. * @returns the list of created MultiLinePoint
  2721. */
  2722. add(...items: (AbstractMesh | Control | {
  2723. x: string | number;
  2724. y: string | number;
  2725. })[]): MultiLinePoint[];
  2726. /**
  2727. * Adds a new point to the point collection
  2728. * @param item defines the item (mesh, control or 2d coordiantes) to add
  2729. * @returns the created MultiLinePoint
  2730. */
  2731. push(item?: (AbstractMesh | Control | {
  2732. x: string | number;
  2733. y: string | number;
  2734. })): MultiLinePoint;
  2735. /**
  2736. * Remove a specific value or point from the active point collection
  2737. * @param value defines the value or point to remove
  2738. */
  2739. remove(value: number | MultiLinePoint): void;
  2740. /**
  2741. * Resets this object to initial state (no point)
  2742. */
  2743. reset(): void;
  2744. /**
  2745. * Resets all links
  2746. */
  2747. resetLinks(): void;
  2748. /** Gets or sets line width */
  2749. get lineWidth(): number;
  2750. set lineWidth(value: number);
  2751. set horizontalAlignment(value: number);
  2752. set verticalAlignment(value: number);
  2753. protected _getTypeName(): string;
  2754. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2755. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2756. _measure(): void;
  2757. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2758. dispose(): void;
  2759. }
  2760. }
  2761. declare module BABYLON.GUI {
  2762. /**
  2763. * Class used to create radio button controls
  2764. */
  2765. export class RadioButton extends Control {
  2766. name?: string | undefined;
  2767. private _isChecked;
  2768. private _background;
  2769. private _checkSizeRatio;
  2770. private _thickness;
  2771. /** Gets or sets border thickness */
  2772. get thickness(): number;
  2773. set thickness(value: number);
  2774. /** Gets or sets group name */
  2775. group: string;
  2776. /** BABYLON.Observable raised when isChecked is changed */
  2777. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  2778. /** Gets or sets a value indicating the ratio between overall size and check size */
  2779. get checkSizeRatio(): number;
  2780. set checkSizeRatio(value: number);
  2781. /** Gets or sets background color */
  2782. get background(): string;
  2783. set background(value: string);
  2784. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2785. get isChecked(): boolean;
  2786. set isChecked(value: boolean);
  2787. /**
  2788. * Creates a new RadioButton
  2789. * @param name defines the control name
  2790. */
  2791. constructor(name?: string | undefined);
  2792. protected _getTypeName(): string;
  2793. _draw(context: CanvasRenderingContext2D): void;
  2794. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2795. /**
  2796. * Utility function to easily create a radio button with a header
  2797. * @param title defines the label to use for the header
  2798. * @param group defines the group to use for the radio button
  2799. * @param isChecked defines the initial state of the radio button
  2800. * @param onValueChanged defines the callback to call when value changes
  2801. * @returns a StackPanel containing the radio button and a textBlock
  2802. */
  2803. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  2804. }
  2805. }
  2806. declare module BABYLON.GUI {
  2807. /**
  2808. * Class used to create slider controls
  2809. */
  2810. export class BaseSlider extends Control {
  2811. name?: string | undefined;
  2812. protected _thumbWidth: ValueAndUnit;
  2813. private _minimum;
  2814. private _maximum;
  2815. private _value;
  2816. private _isVertical;
  2817. protected _barOffset: ValueAndUnit;
  2818. private _isThumbClamped;
  2819. protected _displayThumb: boolean;
  2820. private _step;
  2821. private _lastPointerDownID;
  2822. protected _effectiveBarOffset: number;
  2823. protected _renderLeft: number;
  2824. protected _renderTop: number;
  2825. protected _renderWidth: number;
  2826. protected _renderHeight: number;
  2827. protected _backgroundBoxLength: number;
  2828. protected _backgroundBoxThickness: number;
  2829. protected _effectiveThumbThickness: number;
  2830. /** BABYLON.Observable raised when the sldier value changes */
  2831. onValueChangedObservable: BABYLON.Observable<number>;
  2832. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2833. get displayThumb(): boolean;
  2834. set displayThumb(value: boolean);
  2835. /** Gets or sets a step to apply to values (0 by default) */
  2836. get step(): number;
  2837. set step(value: number);
  2838. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2839. get barOffset(): string | number;
  2840. /** Gets main bar offset in pixels*/
  2841. get barOffsetInPixels(): number;
  2842. set barOffset(value: string | number);
  2843. /** Gets or sets thumb width */
  2844. get thumbWidth(): string | number;
  2845. /** Gets thumb width in pixels */
  2846. get thumbWidthInPixels(): number;
  2847. set thumbWidth(value: string | number);
  2848. /** Gets or sets minimum value */
  2849. get minimum(): number;
  2850. set minimum(value: number);
  2851. /** Gets or sets maximum value */
  2852. get maximum(): number;
  2853. set maximum(value: number);
  2854. /** Gets or sets current value */
  2855. get value(): number;
  2856. set value(value: number);
  2857. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2858. get isVertical(): boolean;
  2859. set isVertical(value: boolean);
  2860. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2861. get isThumbClamped(): boolean;
  2862. set isThumbClamped(value: boolean);
  2863. /**
  2864. * Creates a new BaseSlider
  2865. * @param name defines the control name
  2866. */
  2867. constructor(name?: string | undefined);
  2868. protected _getTypeName(): string;
  2869. protected _getThumbPosition(): number;
  2870. protected _getThumbThickness(type: string): number;
  2871. protected _prepareRenderingData(type: string): void;
  2872. private _pointerIsDown;
  2873. /** @hidden */
  2874. protected _updateValueFromPointer(x: number, y: number): void;
  2875. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2876. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  2877. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2878. _onCanvasBlur(): void;
  2879. }
  2880. }
  2881. declare module BABYLON.GUI {
  2882. /**
  2883. * Class used to create slider controls
  2884. */
  2885. export class Slider extends BaseSlider {
  2886. name?: string | undefined;
  2887. private _background;
  2888. private _borderColor;
  2889. private _thumbColor;
  2890. private _isThumbCircle;
  2891. protected _displayValueBar: boolean;
  2892. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2893. get displayValueBar(): boolean;
  2894. set displayValueBar(value: boolean);
  2895. /** Gets or sets border color */
  2896. get borderColor(): string;
  2897. set borderColor(value: string);
  2898. /** Gets or sets background color */
  2899. get background(): string;
  2900. set background(value: string);
  2901. /** Gets or sets thumb's color */
  2902. get thumbColor(): string;
  2903. set thumbColor(value: string);
  2904. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2905. get isThumbCircle(): boolean;
  2906. set isThumbCircle(value: boolean);
  2907. /**
  2908. * Creates a new Slider
  2909. * @param name defines the control name
  2910. */
  2911. constructor(name?: string | undefined);
  2912. protected _getTypeName(): string;
  2913. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2914. }
  2915. }
  2916. declare module BABYLON.GUI {
  2917. /** Class used to create a RadioGroup
  2918. * which contains groups of radio buttons
  2919. */
  2920. export class SelectorGroup {
  2921. /** name of SelectorGroup */
  2922. name: string;
  2923. private _groupPanel;
  2924. private _selectors;
  2925. private _groupHeader;
  2926. /**
  2927. * Creates a new SelectorGroup
  2928. * @param name of group, used as a group heading
  2929. */
  2930. constructor(
  2931. /** name of SelectorGroup */
  2932. name: string);
  2933. /** Gets the groupPanel of the SelectorGroup */
  2934. get groupPanel(): StackPanel;
  2935. /** Gets the selectors array */
  2936. get selectors(): StackPanel[];
  2937. /** Gets and sets the group header */
  2938. get header(): string;
  2939. set header(label: string);
  2940. /** @hidden */
  2941. private _addGroupHeader;
  2942. /** @hidden*/
  2943. _getSelector(selectorNb: number): StackPanel | undefined;
  2944. /** Removes the selector at the given position
  2945. * @param selectorNb the position of the selector within the group
  2946. */
  2947. removeSelector(selectorNb: number): void;
  2948. }
  2949. /** Class used to create a CheckboxGroup
  2950. * which contains groups of checkbox buttons
  2951. */
  2952. export class CheckboxGroup extends SelectorGroup {
  2953. /** Adds a checkbox as a control
  2954. * @param text is the label for the selector
  2955. * @param func is the function called when the Selector is checked
  2956. * @param checked is true when Selector is checked
  2957. */
  2958. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  2959. /** @hidden */
  2960. _setSelectorLabel(selectorNb: number, label: string): void;
  2961. /** @hidden */
  2962. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2963. /** @hidden */
  2964. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2965. /** @hidden */
  2966. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2967. }
  2968. /** Class used to create a RadioGroup
  2969. * which contains groups of radio buttons
  2970. */
  2971. export class RadioGroup extends SelectorGroup {
  2972. private _selectNb;
  2973. /** Adds a radio button as a control
  2974. * @param label is the label for the selector
  2975. * @param func is the function called when the Selector is checked
  2976. * @param checked is true when Selector is checked
  2977. */
  2978. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  2979. /** @hidden */
  2980. _setSelectorLabel(selectorNb: number, label: string): void;
  2981. /** @hidden */
  2982. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2983. /** @hidden */
  2984. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2985. /** @hidden */
  2986. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2987. }
  2988. /** Class used to create a SliderGroup
  2989. * which contains groups of slider buttons
  2990. */
  2991. export class SliderGroup extends SelectorGroup {
  2992. /**
  2993. * Adds a slider to the SelectorGroup
  2994. * @param label is the label for the SliderBar
  2995. * @param func is the function called when the Slider moves
  2996. * @param unit is a string describing the units used, eg degrees or metres
  2997. * @param min is the minimum value for the Slider
  2998. * @param max is the maximum value for the Slider
  2999. * @param value is the start value for the Slider between min and max
  3000. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  3001. */
  3002. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  3003. /** @hidden */
  3004. _setSelectorLabel(selectorNb: number, label: string): void;
  3005. /** @hidden */
  3006. _setSelectorLabelColor(selectorNb: number, color: string): void;
  3007. /** @hidden */
  3008. _setSelectorButtonColor(selectorNb: number, color: string): void;
  3009. /** @hidden */
  3010. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  3011. }
  3012. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  3013. * @see https://doc.babylonjs.com/how_to/selector
  3014. */
  3015. export class SelectionPanel extends Rectangle {
  3016. /** name of SelectionPanel */
  3017. name: string;
  3018. /** an array of SelectionGroups */
  3019. groups: SelectorGroup[];
  3020. private _panel;
  3021. private _buttonColor;
  3022. private _buttonBackground;
  3023. private _headerColor;
  3024. private _barColor;
  3025. private _barHeight;
  3026. private _spacerHeight;
  3027. private _labelColor;
  3028. private _groups;
  3029. private _bars;
  3030. /**
  3031. * Creates a new SelectionPanel
  3032. * @param name of SelectionPanel
  3033. * @param groups is an array of SelectionGroups
  3034. */
  3035. constructor(
  3036. /** name of SelectionPanel */
  3037. name: string,
  3038. /** an array of SelectionGroups */
  3039. groups?: SelectorGroup[]);
  3040. protected _getTypeName(): string;
  3041. /** Gets the (stack) panel of the SelectionPanel */
  3042. get panel(): StackPanel;
  3043. /** Gets or sets the headerColor */
  3044. get headerColor(): string;
  3045. set headerColor(color: string);
  3046. private _setHeaderColor;
  3047. /** Gets or sets the button color */
  3048. get buttonColor(): string;
  3049. set buttonColor(color: string);
  3050. private _setbuttonColor;
  3051. /** Gets or sets the label color */
  3052. get labelColor(): string;
  3053. set labelColor(color: string);
  3054. private _setLabelColor;
  3055. /** Gets or sets the button background */
  3056. get buttonBackground(): string;
  3057. set buttonBackground(color: string);
  3058. private _setButtonBackground;
  3059. /** Gets or sets the color of separator bar */
  3060. get barColor(): string;
  3061. set barColor(color: string);
  3062. private _setBarColor;
  3063. /** Gets or sets the height of separator bar */
  3064. get barHeight(): string;
  3065. set barHeight(value: string);
  3066. private _setBarHeight;
  3067. /** Gets or sets the height of spacers*/
  3068. get spacerHeight(): string;
  3069. set spacerHeight(value: string);
  3070. private _setSpacerHeight;
  3071. /** Adds a bar between groups */
  3072. private _addSpacer;
  3073. /** Add a group to the selection panel
  3074. * @param group is the selector group to add
  3075. */
  3076. addGroup(group: SelectorGroup): void;
  3077. /** Remove the group from the given position
  3078. * @param groupNb is the position of the group in the list
  3079. */
  3080. removeGroup(groupNb: number): void;
  3081. /** Change a group header label
  3082. * @param label is the new group header label
  3083. * @param groupNb is the number of the group to relabel
  3084. * */
  3085. setHeaderName(label: string, groupNb: number): void;
  3086. /** Change selector label to the one given
  3087. * @param label is the new selector label
  3088. * @param groupNb is the number of the groupcontaining the selector
  3089. * @param selectorNb is the number of the selector within a group to relabel
  3090. * */
  3091. relabel(label: string, groupNb: number, selectorNb: number): void;
  3092. /** For a given group position remove the selector at the given position
  3093. * @param groupNb is the number of the group to remove the selector from
  3094. * @param selectorNb is the number of the selector within the group
  3095. */
  3096. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  3097. /** For a given group position of correct type add a checkbox button
  3098. * @param groupNb is the number of the group to remove the selector from
  3099. * @param label is the label for the selector
  3100. * @param func is the function called when the Selector is checked
  3101. * @param checked is true when Selector is checked
  3102. */
  3103. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  3104. /** For a given group position of correct type add a radio button
  3105. * @param groupNb is the number of the group to remove the selector from
  3106. * @param label is the label for the selector
  3107. * @param func is the function called when the Selector is checked
  3108. * @param checked is true when Selector is checked
  3109. */
  3110. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  3111. /**
  3112. * For a given slider group add a slider
  3113. * @param groupNb is the number of the group to add the slider to
  3114. * @param label is the label for the Slider
  3115. * @param func is the function called when the Slider moves
  3116. * @param unit is a string describing the units used, eg degrees or metres
  3117. * @param min is the minimum value for the Slider
  3118. * @param max is the maximum value for the Slider
  3119. * @param value is the start value for the Slider between min and max
  3120. * @param onVal is the function used to format the value displayed, eg radians to degrees
  3121. */
  3122. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  3123. }
  3124. }
  3125. declare module BABYLON.GUI {
  3126. /**
  3127. * Class used to hold a the container for ScrollViewer
  3128. * @hidden
  3129. */
  3130. export class _ScrollViewerWindow extends Container {
  3131. parentClientWidth: number;
  3132. parentClientHeight: number;
  3133. private _freezeControls;
  3134. private _parentMeasure;
  3135. private _oldLeft;
  3136. private _oldTop;
  3137. get freezeControls(): boolean;
  3138. set freezeControls(value: boolean);
  3139. private _bucketWidth;
  3140. private _bucketHeight;
  3141. private _buckets;
  3142. private _bucketLen;
  3143. get bucketWidth(): number;
  3144. get bucketHeight(): number;
  3145. setBucketSizes(width: number, height: number): void;
  3146. private _useBuckets;
  3147. private _makeBuckets;
  3148. private _dispatchInBuckets;
  3149. private _updateMeasures;
  3150. private _updateChildrenMeasures;
  3151. private _restoreMeasures;
  3152. /**
  3153. * Creates a new ScrollViewerWindow
  3154. * @param name of ScrollViewerWindow
  3155. */
  3156. constructor(name?: string);
  3157. protected _getTypeName(): string;
  3158. /** @hidden */
  3159. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3160. /** @hidden */
  3161. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3162. private _scrollChildren;
  3163. private _scrollChildrenWithBuckets;
  3164. /** @hidden */
  3165. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  3166. protected _postMeasure(): void;
  3167. }
  3168. }
  3169. declare module BABYLON.GUI {
  3170. /**
  3171. * Class used to create slider controls
  3172. */
  3173. export class ScrollBar extends BaseSlider {
  3174. name?: string | undefined;
  3175. private _background;
  3176. private _borderColor;
  3177. private _tempMeasure;
  3178. /** Gets or sets border color */
  3179. get borderColor(): string;
  3180. set borderColor(value: string);
  3181. /** Gets or sets background color */
  3182. get background(): string;
  3183. set background(value: string);
  3184. /**
  3185. * Creates a new Slider
  3186. * @param name defines the control name
  3187. */
  3188. constructor(name?: string | undefined);
  3189. protected _getTypeName(): string;
  3190. protected _getThumbThickness(): number;
  3191. _draw(context: CanvasRenderingContext2D): void;
  3192. private _first;
  3193. private _originX;
  3194. private _originY;
  3195. /** @hidden */
  3196. protected _updateValueFromPointer(x: number, y: number): void;
  3197. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  3198. }
  3199. }
  3200. declare module BABYLON.GUI {
  3201. /**
  3202. * Class used to create slider controls
  3203. */
  3204. export class ImageScrollBar extends BaseSlider {
  3205. name?: string | undefined;
  3206. private _backgroundBaseImage;
  3207. private _backgroundImage;
  3208. private _thumbImage;
  3209. private _thumbBaseImage;
  3210. private _thumbLength;
  3211. private _thumbHeight;
  3212. private _barImageHeight;
  3213. private _tempMeasure;
  3214. /** Number of 90° rotation to apply on the images when in vertical mode */
  3215. num90RotationInVerticalMode: number;
  3216. /**
  3217. * Gets or sets the image used to render the background for horizontal bar
  3218. */
  3219. get backgroundImage(): Image;
  3220. set backgroundImage(value: Image);
  3221. /**
  3222. * Gets or sets the image used to render the thumb
  3223. */
  3224. get thumbImage(): Image;
  3225. set thumbImage(value: Image);
  3226. /**
  3227. * Gets or sets the length of the thumb
  3228. */
  3229. get thumbLength(): number;
  3230. set thumbLength(value: number);
  3231. /**
  3232. * Gets or sets the height of the thumb
  3233. */
  3234. get thumbHeight(): number;
  3235. set thumbHeight(value: number);
  3236. /**
  3237. * Gets or sets the height of the bar image
  3238. */
  3239. get barImageHeight(): number;
  3240. set barImageHeight(value: number);
  3241. /**
  3242. * Creates a new ImageScrollBar
  3243. * @param name defines the control name
  3244. */
  3245. constructor(name?: string | undefined);
  3246. protected _getTypeName(): string;
  3247. protected _getThumbThickness(): number;
  3248. _draw(context: CanvasRenderingContext2D): void;
  3249. private _first;
  3250. private _originX;
  3251. private _originY;
  3252. /** @hidden */
  3253. protected _updateValueFromPointer(x: number, y: number): void;
  3254. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  3255. }
  3256. }
  3257. declare module BABYLON.GUI {
  3258. /**
  3259. * Class used to hold a viewer window and sliders in a grid
  3260. */
  3261. export class ScrollViewer extends Rectangle {
  3262. private _grid;
  3263. private _horizontalBarSpace;
  3264. private _verticalBarSpace;
  3265. private _dragSpace;
  3266. private _horizontalBar;
  3267. private _verticalBar;
  3268. private _barColor;
  3269. private _barBackground;
  3270. private _barImage;
  3271. private _horizontalBarImage;
  3272. private _verticalBarImage;
  3273. private _barBackgroundImage;
  3274. private _horizontalBarBackgroundImage;
  3275. private _verticalBarBackgroundImage;
  3276. private _barSize;
  3277. private _window;
  3278. private _pointerIsOver;
  3279. private _wheelPrecision;
  3280. private _onWheelObserver;
  3281. private _clientWidth;
  3282. private _clientHeight;
  3283. private _useImageBar;
  3284. private _thumbLength;
  3285. private _thumbHeight;
  3286. private _barImageHeight;
  3287. private _horizontalBarImageHeight;
  3288. private _verticalBarImageHeight;
  3289. private _oldWindowContentsWidth;
  3290. private _oldWindowContentsHeight;
  3291. /**
  3292. * Gets the horizontal scrollbar
  3293. */
  3294. get horizontalBar(): ScrollBar | ImageScrollBar;
  3295. /**
  3296. * Gets the vertical scrollbar
  3297. */
  3298. get verticalBar(): ScrollBar | ImageScrollBar;
  3299. /**
  3300. * Adds a new control to the current container
  3301. * @param control defines the control to add
  3302. * @returns the current container
  3303. */
  3304. addControl(control: BABYLON.Nullable<Control>): Container;
  3305. /**
  3306. * Removes a control from the current container
  3307. * @param control defines the control to remove
  3308. * @returns the current container
  3309. */
  3310. removeControl(control: Control): Container;
  3311. /** Gets the list of children */
  3312. get children(): Control[];
  3313. _flagDescendantsAsMatrixDirty(): void;
  3314. /**
  3315. * Freezes or unfreezes the controls in the window.
  3316. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  3317. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  3318. */
  3319. get freezeControls(): boolean;
  3320. set freezeControls(value: boolean);
  3321. /** Gets the bucket width */
  3322. get bucketWidth(): number;
  3323. /** Gets the bucket height */
  3324. get bucketHeight(): number;
  3325. /**
  3326. * Sets the bucket sizes.
  3327. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  3328. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  3329. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  3330. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  3331. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  3332. * used), that's why it is not enabled by default.
  3333. * @param width width of the bucket
  3334. * @param height height of the bucket
  3335. */
  3336. setBucketSizes(width: number, height: number): void;
  3337. private _forceHorizontalBar;
  3338. private _forceVerticalBar;
  3339. /**
  3340. * Forces the horizontal scroll bar to be displayed
  3341. */
  3342. get forceHorizontalBar(): boolean;
  3343. set forceHorizontalBar(value: boolean);
  3344. /**
  3345. * Forces the vertical scroll bar to be displayed
  3346. */
  3347. get forceVerticalBar(): boolean;
  3348. set forceVerticalBar(value: boolean);
  3349. /**
  3350. * Creates a new ScrollViewer
  3351. * @param name of ScrollViewer
  3352. */
  3353. constructor(name?: string, isImageBased?: boolean);
  3354. /** Reset the scroll viewer window to initial size */
  3355. resetWindow(): void;
  3356. protected _getTypeName(): string;
  3357. private _buildClientSizes;
  3358. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3359. protected _postMeasure(): void;
  3360. /**
  3361. * Gets or sets the mouse wheel precision
  3362. * from 0 to 1 with a default value of 0.05
  3363. * */
  3364. get wheelPrecision(): number;
  3365. set wheelPrecision(value: number);
  3366. /** Gets or sets the scroll bar container background color */
  3367. get scrollBackground(): string;
  3368. set scrollBackground(color: string);
  3369. /** Gets or sets the bar color */
  3370. get barColor(): string;
  3371. set barColor(color: string);
  3372. /** Gets or sets the bar image */
  3373. get thumbImage(): Image;
  3374. set thumbImage(value: Image);
  3375. /** Gets or sets the horizontal bar image */
  3376. get horizontalThumbImage(): Image;
  3377. set horizontalThumbImage(value: Image);
  3378. /** Gets or sets the vertical bar image */
  3379. get verticalThumbImage(): Image;
  3380. set verticalThumbImage(value: Image);
  3381. /** Gets or sets the size of the bar */
  3382. get barSize(): number;
  3383. set barSize(value: number);
  3384. /** Gets or sets the length of the thumb */
  3385. get thumbLength(): number;
  3386. set thumbLength(value: number);
  3387. /** Gets or sets the height of the thumb */
  3388. get thumbHeight(): number;
  3389. set thumbHeight(value: number);
  3390. /** Gets or sets the height of the bar image */
  3391. get barImageHeight(): number;
  3392. set barImageHeight(value: number);
  3393. /** Gets or sets the height of the horizontal bar image */
  3394. get horizontalBarImageHeight(): number;
  3395. set horizontalBarImageHeight(value: number);
  3396. /** Gets or sets the height of the vertical bar image */
  3397. get verticalBarImageHeight(): number;
  3398. set verticalBarImageHeight(value: number);
  3399. /** Gets or sets the bar background */
  3400. get barBackground(): string;
  3401. set barBackground(color: string);
  3402. /** Gets or sets the bar background image */
  3403. get barImage(): Image;
  3404. set barImage(value: Image);
  3405. /** Gets or sets the horizontal bar background image */
  3406. get horizontalBarImage(): Image;
  3407. set horizontalBarImage(value: Image);
  3408. /** Gets or sets the vertical bar background image */
  3409. get verticalBarImage(): Image;
  3410. set verticalBarImage(value: Image);
  3411. private _setWindowPosition;
  3412. /** @hidden */
  3413. private _updateScroller;
  3414. _link(host: AdvancedDynamicTexture): void;
  3415. /** @hidden */
  3416. private _addBar;
  3417. /** @hidden */
  3418. private _attachWheel;
  3419. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  3420. /** Releases associated resources */
  3421. dispose(): void;
  3422. }
  3423. }
  3424. declare module BABYLON.GUI {
  3425. /**
  3426. * Class used to create toggle buttons
  3427. */
  3428. export class ToggleButton extends Rectangle {
  3429. name?: string | undefined;
  3430. /**
  3431. * Function called to generate the toActive animation
  3432. */
  3433. toActiveAnimation: () => void;
  3434. /**
  3435. * Function called to generate the toInactive animation
  3436. */
  3437. toInactiveAnimation: () => void;
  3438. /**
  3439. * Function called to generate a pointer enter animation when the toggle button is active.
  3440. */
  3441. pointerEnterActiveAnimation: () => void;
  3442. /**
  3443. * Function called to generate a pointer out animation when the toggle button is active.
  3444. */
  3445. pointerOutActiveAnimation: () => void;
  3446. /**
  3447. * Function called to generate a pointer down animation when the toggle button is active.
  3448. */
  3449. pointerDownActiveAnimation: () => void;
  3450. /**
  3451. * Function called to generate a pointer up animation when the toggle button is active.
  3452. */
  3453. pointerUpActiveAnimation: () => void;
  3454. /**
  3455. * Function called to generate a pointer enter animation when the toggle button is inactive.
  3456. */
  3457. pointerEnterInactiveAnimation: () => void;
  3458. /**
  3459. * Function called to generate a pointer out animation when the toggle button is inactive.
  3460. */
  3461. pointerOutInactiveAnimation: () => void;
  3462. /**
  3463. * Function called to generate a pointer down animation when the toggle button is inactive.
  3464. */
  3465. pointerDownInactiveAnimation: () => void;
  3466. /**
  3467. * Function called to generate a pointer up animation when the toggle button is inactive.
  3468. */
  3469. pointerUpInactiveAnimation: () => void;
  3470. /** BABYLON.Observable raised when isActive is changed */
  3471. onIsActiveChangedObservable: BABYLON.Observable<boolean>;
  3472. /**
  3473. * Gets or sets a boolean indicating that the toggle button will let internal controls handle picking instead of doing it directly using its bounding info
  3474. */
  3475. delegatePickingToChildren: boolean;
  3476. private _image;
  3477. /**
  3478. * Returns the ToggleButton's image control if it exists
  3479. */
  3480. get image(): BABYLON.Nullable<Image>;
  3481. private _textBlock;
  3482. /**
  3483. * Returns the ToggleButton's child TextBlock control if it exists
  3484. */
  3485. get textBlock(): BABYLON.Nullable<TextBlock>;
  3486. private _group;
  3487. /** Gets or sets group name this toggle button belongs to */
  3488. get group(): string;
  3489. set group(value: string);
  3490. private _isActive;
  3491. /** Gets or sets a boolean indicating if the toogle button is active or not */
  3492. get isActive(): boolean;
  3493. set isActive(value: boolean);
  3494. /**
  3495. * Creates a new ToggleButton
  3496. * @param name defines the control name
  3497. * @param group defines the toggle group this toggle belongs to
  3498. */
  3499. constructor(name?: string | undefined, group?: string);
  3500. protected _getTypeName(): string;
  3501. /** @hidden */
  3502. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  3503. /** @hidden */
  3504. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  3505. /** @hidden */
  3506. _onPointerOut(target: Control, pi: BABYLON.PointerInfoBase, force?: boolean): void;
  3507. /** @hidden */
  3508. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  3509. /** @hidden */
  3510. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  3511. }
  3512. }
  3513. declare module BABYLON.GUI {
  3514. /** Class used to render a grid */
  3515. export class DisplayGrid extends Control {
  3516. name?: string | undefined;
  3517. private _cellWidth;
  3518. private _cellHeight;
  3519. private _minorLineTickness;
  3520. private _minorLineColor;
  3521. private _majorLineTickness;
  3522. private _majorLineColor;
  3523. private _majorLineFrequency;
  3524. private _background;
  3525. private _displayMajorLines;
  3526. private _displayMinorLines;
  3527. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  3528. get displayMinorLines(): boolean;
  3529. set displayMinorLines(value: boolean);
  3530. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  3531. get displayMajorLines(): boolean;
  3532. set displayMajorLines(value: boolean);
  3533. /** Gets or sets background color (Black by default) */
  3534. get background(): string;
  3535. set background(value: string);
  3536. /** Gets or sets the width of each cell (20 by default) */
  3537. get cellWidth(): number;
  3538. set cellWidth(value: number);
  3539. /** Gets or sets the height of each cell (20 by default) */
  3540. get cellHeight(): number;
  3541. set cellHeight(value: number);
  3542. /** Gets or sets the tickness of minor lines (1 by default) */
  3543. get minorLineTickness(): number;
  3544. set minorLineTickness(value: number);
  3545. /** Gets or sets the color of minor lines (DarkGray by default) */
  3546. get minorLineColor(): string;
  3547. set minorLineColor(value: string);
  3548. /** Gets or sets the tickness of major lines (2 by default) */
  3549. get majorLineTickness(): number;
  3550. set majorLineTickness(value: number);
  3551. /** Gets or sets the color of major lines (White by default) */
  3552. get majorLineColor(): string;
  3553. set majorLineColor(value: string);
  3554. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  3555. get majorLineFrequency(): number;
  3556. set majorLineFrequency(value: number);
  3557. /**
  3558. * Creates a new GridDisplayRectangle
  3559. * @param name defines the control name
  3560. */
  3561. constructor(name?: string | undefined);
  3562. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  3563. protected _getTypeName(): string;
  3564. }
  3565. }
  3566. declare module BABYLON.GUI {
  3567. /**
  3568. * Class used to create slider controls based on images
  3569. */
  3570. export class ImageBasedSlider extends BaseSlider {
  3571. name?: string | undefined;
  3572. private _backgroundImage;
  3573. private _thumbImage;
  3574. private _valueBarImage;
  3575. private _tempMeasure;
  3576. get displayThumb(): boolean;
  3577. set displayThumb(value: boolean);
  3578. /**
  3579. * Gets or sets the image used to render the background
  3580. */
  3581. get backgroundImage(): Image;
  3582. set backgroundImage(value: Image);
  3583. /**
  3584. * Gets or sets the image used to render the value bar
  3585. */
  3586. get valueBarImage(): Image;
  3587. set valueBarImage(value: Image);
  3588. /**
  3589. * Gets or sets the image used to render the thumb
  3590. */
  3591. get thumbImage(): Image;
  3592. set thumbImage(value: Image);
  3593. /**
  3594. * Creates a new ImageBasedSlider
  3595. * @param name defines the control name
  3596. */
  3597. constructor(name?: string | undefined);
  3598. protected _getTypeName(): string;
  3599. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  3600. }
  3601. }
  3602. declare module BABYLON.GUI {
  3603. /**
  3604. * Forcing an export so that this code will execute
  3605. * @hidden
  3606. */
  3607. const name = "Statics";
  3608. }
  3609. declare module BABYLON.GUI {
  3610. /**
  3611. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  3612. */
  3613. export class AdvancedDynamicTextureInstrumentation implements BABYLON.IDisposable {
  3614. /**
  3615. * Define the instrumented AdvancedDynamicTexture.
  3616. */
  3617. texture: AdvancedDynamicTexture;
  3618. private _captureRenderTime;
  3619. private _renderTime;
  3620. private _captureLayoutTime;
  3621. private _layoutTime;
  3622. private _onBeginRenderObserver;
  3623. private _onEndRenderObserver;
  3624. private _onBeginLayoutObserver;
  3625. private _onEndLayoutObserver;
  3626. /**
  3627. * Gets the perf counter used to capture render time
  3628. */
  3629. get renderTimeCounter(): BABYLON.PerfCounter;
  3630. /**
  3631. * Gets the perf counter used to capture layout time
  3632. */
  3633. get layoutTimeCounter(): BABYLON.PerfCounter;
  3634. /**
  3635. * Enable or disable the render time capture
  3636. */
  3637. get captureRenderTime(): boolean;
  3638. set captureRenderTime(value: boolean);
  3639. /**
  3640. * Enable or disable the layout time capture
  3641. */
  3642. get captureLayoutTime(): boolean;
  3643. set captureLayoutTime(value: boolean);
  3644. /**
  3645. * Instantiates a new advanced dynamic texture instrumentation.
  3646. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  3647. * @param texture Defines the AdvancedDynamicTexture to instrument
  3648. */
  3649. constructor(
  3650. /**
  3651. * Define the instrumented AdvancedDynamicTexture.
  3652. */
  3653. texture: AdvancedDynamicTexture);
  3654. /**
  3655. * Dispose and release associated resources.
  3656. */
  3657. dispose(): void;
  3658. }
  3659. }
  3660. declare module BABYLON.GUI {
  3661. /**
  3662. * Class used to load GUI via XML.
  3663. */
  3664. export class XmlLoader {
  3665. private _nodes;
  3666. private _nodeTypes;
  3667. private _isLoaded;
  3668. private _objectAttributes;
  3669. private _parentClass;
  3670. /**
  3671. * Create a new xml loader
  3672. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  3673. */
  3674. constructor(parentClass?: null);
  3675. private _getChainElement;
  3676. private _getClassAttribute;
  3677. private _createGuiElement;
  3678. private _parseGrid;
  3679. private _parseElement;
  3680. private _prepareSourceElement;
  3681. private _parseElementsFromSource;
  3682. private _parseXml;
  3683. /**
  3684. * Gets if the loading has finished.
  3685. * @returns whether the loading has finished or not
  3686. */
  3687. isLoaded(): boolean;
  3688. /**
  3689. * Gets a loaded node / control by id.
  3690. * @param id the Controls id set in the xml
  3691. * @returns element of type Control
  3692. */
  3693. getNodeById(id: string): any;
  3694. /**
  3695. * Gets all loaded nodes / controls
  3696. * @returns Array of controls
  3697. */
  3698. getNodes(): any;
  3699. /**
  3700. * Initiates the xml layout loading
  3701. * @param xmlFile defines the xml layout to load
  3702. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  3703. * @param callback defines the callback called on layout load.
  3704. */
  3705. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  3706. }
  3707. }
  3708. declare module BABYLON.GUI {
  3709. /**
  3710. * Class used to create containers for controls
  3711. */
  3712. export class Container3D extends Control3D {
  3713. private _blockLayout;
  3714. /**
  3715. * Gets the list of child controls
  3716. */
  3717. protected _children: Control3D[];
  3718. /**
  3719. * Gets the list of child controls
  3720. */
  3721. get children(): Array<Control3D>;
  3722. /**
  3723. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  3724. * This is helpful to optimize layout operation when adding multiple children in a row
  3725. */
  3726. get blockLayout(): boolean;
  3727. set blockLayout(value: boolean);
  3728. /**
  3729. * Creates a new container
  3730. * @param name defines the container name
  3731. */
  3732. constructor(name?: string);
  3733. /**
  3734. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  3735. * @returns the current container
  3736. */
  3737. updateLayout(): Container3D;
  3738. /**
  3739. * Gets a boolean indicating if the given control is in the children of this control
  3740. * @param control defines the control to check
  3741. * @returns true if the control is in the child list
  3742. */
  3743. containsControl(control: Control3D): boolean;
  3744. /**
  3745. * Adds a control to the children of this control
  3746. * @param control defines the control to add
  3747. * @returns the current container
  3748. */
  3749. addControl(control: Control3D): Container3D;
  3750. /**
  3751. * This function will be called everytime a new control is added
  3752. */
  3753. protected _arrangeChildren(): void;
  3754. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  3755. /**
  3756. * Removes a control from the children of this control
  3757. * @param control defines the control to remove
  3758. * @returns the current container
  3759. */
  3760. removeControl(control: Control3D): Container3D;
  3761. protected _getTypeName(): string;
  3762. /**
  3763. * Releases all associated resources
  3764. */
  3765. dispose(): void;
  3766. /** Control rotation will remain unchanged */
  3767. static readonly UNSET_ORIENTATION: number;
  3768. /** Control will rotate to make it look at sphere central axis */
  3769. static readonly FACEORIGIN_ORIENTATION: number;
  3770. /** Control will rotate to make it look back at sphere central axis */
  3771. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  3772. /** Control will rotate to look at z axis (0, 0, 1) */
  3773. static readonly FACEFORWARD_ORIENTATION: number;
  3774. /** Control will rotate to look at negative z axis (0, 0, -1) */
  3775. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  3776. }
  3777. }
  3778. declare module BABYLON.GUI {
  3779. /**
  3780. * Class used to create a button in 3D
  3781. */
  3782. export class Button3D extends AbstractButton3D {
  3783. /** @hidden */
  3784. protected _currentMaterial: BABYLON.Material;
  3785. private _facadeTexture;
  3786. private _content;
  3787. private _contentResolution;
  3788. private _contentScaleRatio;
  3789. /**
  3790. * Gets or sets the texture resolution used to render content (512 by default)
  3791. */
  3792. get contentResolution(): BABYLON.int;
  3793. set contentResolution(value: BABYLON.int);
  3794. /**
  3795. * Gets or sets the texture scale ratio used to render content (2 by default)
  3796. */
  3797. get contentScaleRatio(): number;
  3798. set contentScaleRatio(value: number);
  3799. protected _disposeFacadeTexture(): void;
  3800. protected _resetContent(): void;
  3801. /**
  3802. * Creates a new button
  3803. * @param name defines the control name
  3804. */
  3805. constructor(name?: string);
  3806. /**
  3807. * Gets or sets the GUI 2D content used to display the button's facade
  3808. */
  3809. get content(): Control;
  3810. set content(value: Control);
  3811. /**
  3812. * Apply the facade texture (created from the content property).
  3813. * This function can be overloaded by child classes
  3814. * @param facadeTexture defines the AdvancedDynamicTexture to use
  3815. */
  3816. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  3817. protected _getTypeName(): string;
  3818. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3819. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  3820. /**
  3821. * Releases all associated resources
  3822. */
  3823. dispose(): void;
  3824. }
  3825. }
  3826. declare module BABYLON.GUI {
  3827. /**
  3828. * Class used to create a touchable button in 3D
  3829. */
  3830. export class TouchButton3D extends Button3D {
  3831. private _collisionMesh;
  3832. private _collidableFrontDirection;
  3833. private _lastTouchPoint;
  3834. private _tempButtonForwardRay;
  3835. private _lastKnownCollidableScale;
  3836. private _collidableInitialized;
  3837. private _frontOffset;
  3838. private _backOffset;
  3839. private _hoverOffset;
  3840. private _pushThroughBackOffset;
  3841. private _activeInteractions;
  3842. private _previousHeight;
  3843. /**
  3844. * Creates a new touchable button
  3845. * @param name defines the control name
  3846. * @param collisionMesh mesh to track collisions with
  3847. */
  3848. constructor(name?: string, collisionMesh?: BABYLON.Mesh);
  3849. /**
  3850. * Sets the front-facing direction of the button
  3851. * @param frontDir the forward direction of the button
  3852. */
  3853. set collidableFrontDirection(frontWorldDir: BABYLON.Vector3);
  3854. private _getWorldMatrixData;
  3855. /**
  3856. * Sets the mesh used for testing input collision
  3857. * @param collisionMesh the new collision mesh for the button
  3858. */
  3859. set collisionMesh(collisionMesh: BABYLON.Mesh);
  3860. private _getShortestDistancePointToLine;
  3861. private _isPrimedForInteraction;
  3862. private _getPointOnButton;
  3863. private _updateDistanceOffsets;
  3864. private _getHeightFromButtonCenter;
  3865. private _getDistanceOffPlane;
  3866. private _updateButtonState;
  3867. /** @hidden */
  3868. _collisionCheckForStateChange(mesh: BABYLON.AbstractMesh): void;
  3869. protected _getTypeName(): string;
  3870. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3871. /**
  3872. * Releases all associated resources
  3873. */
  3874. dispose(): void;
  3875. }
  3876. }
  3877. declare module BABYLON.GUI {
  3878. /**
  3879. * Class used to manage 3D user interface
  3880. * @see https://doc.babylonjs.com/how_to/gui3d
  3881. */
  3882. export class GUI3DManager implements BABYLON.IDisposable {
  3883. private _scene;
  3884. private _sceneDisposeObserver;
  3885. private _utilityLayer;
  3886. private _rootContainer;
  3887. private _pointerObserver;
  3888. private _pointerOutObserver;
  3889. private _touchableButtons;
  3890. /** @hidden */
  3891. _lastPickedControl: Control3D;
  3892. /** @hidden */
  3893. _lastControlOver: {
  3894. [pointerId: number]: Control3D;
  3895. };
  3896. /** @hidden */
  3897. _lastControlDown: {
  3898. [pointerId: number]: Control3D;
  3899. };
  3900. /**
  3901. * BABYLON.Observable raised when the point picked by the pointer events changed
  3902. */
  3903. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3904. /** @hidden */
  3905. _sharedMaterials: {
  3906. [key: string]: BABYLON.Material;
  3907. };
  3908. /** @hidden */
  3909. _touchSharedMaterials: {
  3910. [key: string]: BABYLON.Material;
  3911. };
  3912. /** Gets the hosting scene */
  3913. get scene(): BABYLON.Scene;
  3914. /** Gets associated utility layer */
  3915. get utilityLayer(): BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3916. /**
  3917. * Creates a new GUI3DManager
  3918. * @param scene
  3919. */
  3920. constructor(scene?: BABYLON.Scene);
  3921. private _handlePointerOut;
  3922. private _doPicking;
  3923. private _processTouchControls;
  3924. /**
  3925. * Gets the root container
  3926. */
  3927. get rootContainer(): Container3D;
  3928. /**
  3929. * Gets a boolean indicating if the given control is in the root child list
  3930. * @param control defines the control to check
  3931. * @returns true if the control is in the root child list
  3932. */
  3933. containsControl(control: Control3D): boolean;
  3934. /**
  3935. * Adds a control to the root child list
  3936. * @param control defines the control to add
  3937. * @returns the current manager
  3938. */
  3939. addControl(control: Control3D): GUI3DManager;
  3940. /**
  3941. * Removes a control from the root child list
  3942. * @param control defines the control to remove
  3943. * @returns the current container
  3944. */
  3945. removeControl(control: Control3D): GUI3DManager;
  3946. /**
  3947. * Releases all associated resources
  3948. */
  3949. dispose(): void;
  3950. }
  3951. }
  3952. declare module BABYLON.GUI {
  3953. /**
  3954. * Class used to transport BABYLON.Vector3 information for pointer events
  3955. */
  3956. export class Vector3WithInfo extends BABYLON.Vector3 {
  3957. /** defines the current mouse button index */
  3958. buttonIndex: number;
  3959. /**
  3960. * Creates a new Vector3WithInfo
  3961. * @param source defines the vector3 data to transport
  3962. * @param buttonIndex defines the current mouse button index
  3963. */
  3964. constructor(source: BABYLON.Vector3,
  3965. /** defines the current mouse button index */
  3966. buttonIndex?: number);
  3967. }
  3968. }
  3969. declare module BABYLON.GUI {
  3970. /**
  3971. * Class used as base class for controls
  3972. */
  3973. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  3974. /** Defines the control name */
  3975. name?: string | undefined;
  3976. /** @hidden */
  3977. _host: GUI3DManager;
  3978. private _node;
  3979. private _downCount;
  3980. private _enterCount;
  3981. private _downPointerIds;
  3982. private _isVisible;
  3983. /** Gets or sets the control position in world space */
  3984. get position(): BABYLON.Vector3;
  3985. set position(value: BABYLON.Vector3);
  3986. /** Gets or sets the control scaling in world space */
  3987. get scaling(): BABYLON.Vector3;
  3988. set scaling(value: BABYLON.Vector3);
  3989. /** Callback used to start pointer enter animation */
  3990. pointerEnterAnimation: () => void;
  3991. /** Callback used to start pointer out animation */
  3992. pointerOutAnimation: () => void;
  3993. /** Callback used to start pointer down animation */
  3994. pointerDownAnimation: () => void;
  3995. /** Callback used to start pointer up animation */
  3996. pointerUpAnimation: () => void;
  3997. /**
  3998. * An event triggered when the pointer move over the control
  3999. */
  4000. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  4001. /**
  4002. * An event triggered when the pointer move out of the control
  4003. */
  4004. onPointerOutObservable: BABYLON.Observable<Control3D>;
  4005. /**
  4006. * An event triggered when the pointer taps the control
  4007. */
  4008. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  4009. /**
  4010. * An event triggered when pointer is up
  4011. */
  4012. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  4013. /**
  4014. * An event triggered when a control is clicked on (with a mouse)
  4015. */
  4016. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  4017. /**
  4018. * An event triggered when pointer enters the control
  4019. */
  4020. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  4021. /**
  4022. * Gets or sets the parent container
  4023. */
  4024. parent: BABYLON.Nullable<Container3D>;
  4025. private _behaviors;
  4026. /**
  4027. * Gets the list of attached behaviors
  4028. * @see https://doc.babylonjs.com/features/behaviour
  4029. */
  4030. get behaviors(): BABYLON.Behavior<Control3D>[];
  4031. /**
  4032. * Attach a behavior to the control
  4033. * @see https://doc.babylonjs.com/features/behaviour
  4034. * @param behavior defines the behavior to attach
  4035. * @returns the current control
  4036. */
  4037. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4038. /**
  4039. * Remove an attached behavior
  4040. * @see https://doc.babylonjs.com/features/behaviour
  4041. * @param behavior defines the behavior to attach
  4042. * @returns the current control
  4043. */
  4044. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4045. /**
  4046. * Gets an attached behavior by name
  4047. * @param name defines the name of the behavior to look for
  4048. * @see https://doc.babylonjs.com/features/behaviour
  4049. * @returns null if behavior was not found else the requested behavior
  4050. */
  4051. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  4052. /** Gets or sets a boolean indicating if the control is visible */
  4053. get isVisible(): boolean;
  4054. set isVisible(value: boolean);
  4055. /**
  4056. * Creates a new control
  4057. * @param name defines the control name
  4058. */
  4059. constructor(
  4060. /** Defines the control name */
  4061. name?: string | undefined);
  4062. /**
  4063. * Gets a string representing the class name
  4064. */
  4065. get typeName(): string;
  4066. /**
  4067. * Get the current class name of the control.
  4068. * @returns current class name
  4069. */
  4070. getClassName(): string;
  4071. protected _getTypeName(): string;
  4072. /**
  4073. * Gets the transform node used by this control
  4074. */
  4075. get node(): BABYLON.Nullable<BABYLON.TransformNode>;
  4076. /**
  4077. * Gets the mesh used to render this control
  4078. */
  4079. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  4080. /**
  4081. * Link the control as child of the given node
  4082. * @param node defines the node to link to. Use null to unlink the control
  4083. * @returns the current control
  4084. */
  4085. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  4086. /** @hidden **/
  4087. _prepareNode(scene: BABYLON.Scene): void;
  4088. protected _injectGUI3DMetadata(node: BABYLON.TransformNode): any;
  4089. /**
  4090. * Node creation.
  4091. * Can be overriden by children
  4092. * @param scene defines the scene where the node must be attached
  4093. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  4094. */
  4095. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  4096. /**
  4097. * Affect a material to the given mesh
  4098. * @param mesh defines the mesh which will represent the control
  4099. */
  4100. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4101. /** @hidden */
  4102. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  4103. /** @hidden */
  4104. _onPointerEnter(target: Control3D): boolean;
  4105. /** @hidden */
  4106. _onPointerOut(target: Control3D): void;
  4107. /** @hidden */
  4108. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4109. /** @hidden */
  4110. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4111. /** @hidden */
  4112. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4113. /** @hidden */
  4114. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4115. /** @hidden */
  4116. _disposeNode(): void;
  4117. /**
  4118. * Releases all associated resources
  4119. */
  4120. dispose(): void;
  4121. }
  4122. }
  4123. declare module BABYLON.GUI {
  4124. /**
  4125. * Class used as a root to all buttons
  4126. */
  4127. export class AbstractButton3D extends Control3D {
  4128. /**
  4129. * Creates a new button
  4130. * @param name defines the control name
  4131. */
  4132. constructor(name?: string);
  4133. protected _getTypeName(): string;
  4134. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4135. }
  4136. }
  4137. declare module BABYLON.GUI {
  4138. /**
  4139. * Abstract class used to create a container panel deployed on the surface of a volume
  4140. */
  4141. export abstract class VolumeBasedPanel extends Container3D {
  4142. private _columns;
  4143. private _rows;
  4144. private _rowThenColum;
  4145. private _orientation;
  4146. protected _cellWidth: number;
  4147. protected _cellHeight: number;
  4148. /**
  4149. * Gets or sets the distance between elements
  4150. */
  4151. margin: number;
  4152. /**
  4153. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  4154. * | Value | Type | Description |
  4155. * | ----- | ----------------------------------- | ----------- |
  4156. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  4157. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  4158. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  4159. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  4160. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  4161. */
  4162. get orientation(): number;
  4163. set orientation(value: number);
  4164. /**
  4165. * Gets or sets the number of columns requested (10 by default).
  4166. * The panel will automatically compute the number of rows based on number of child controls.
  4167. */
  4168. get columns(): BABYLON.int;
  4169. set columns(value: BABYLON.int);
  4170. /**
  4171. * Gets or sets a the number of rows requested.
  4172. * The panel will automatically compute the number of columns based on number of child controls.
  4173. */
  4174. get rows(): BABYLON.int;
  4175. set rows(value: BABYLON.int);
  4176. /**
  4177. * Creates new VolumeBasedPanel
  4178. */
  4179. constructor();
  4180. protected _arrangeChildren(): void;
  4181. /** Child classes must implement this function to provide correct control positioning */
  4182. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4183. /** Child classes can implement this function to provide additional processing */
  4184. protected _finalProcessing(): void;
  4185. }
  4186. }
  4187. declare module BABYLON.GUI {
  4188. /**
  4189. * Class used to create a container panel deployed on the surface of a cylinder
  4190. */
  4191. export class CylinderPanel extends VolumeBasedPanel {
  4192. private _radius;
  4193. /**
  4194. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  4195. */
  4196. get radius(): BABYLON.float;
  4197. set radius(value: BABYLON.float);
  4198. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4199. private _cylindricalMapping;
  4200. }
  4201. }
  4202. declare module BABYLON.GUI {
  4203. /** @hidden */
  4204. export var fluentVertexShader: {
  4205. name: string;
  4206. shader: string;
  4207. };
  4208. }
  4209. declare module BABYLON.GUI {
  4210. /** @hidden */
  4211. export var fluentPixelShader: {
  4212. name: string;
  4213. shader: string;
  4214. };
  4215. }
  4216. declare module BABYLON.GUI {
  4217. /** @hidden */
  4218. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  4219. INNERGLOW: boolean;
  4220. BORDER: boolean;
  4221. HOVERLIGHT: boolean;
  4222. TEXTURE: boolean;
  4223. constructor();
  4224. }
  4225. /**
  4226. * Class used to render controls with fluent desgin
  4227. */
  4228. export class FluentMaterial extends BABYLON.PushMaterial {
  4229. /**
  4230. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  4231. */
  4232. innerGlowColorIntensity: number;
  4233. /**
  4234. * Gets or sets the inner glow color (white by default)
  4235. */
  4236. innerGlowColor: BABYLON.Color3;
  4237. /**
  4238. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  4239. */
  4240. albedoColor: BABYLON.Color3;
  4241. /**
  4242. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  4243. */
  4244. renderBorders: boolean;
  4245. /**
  4246. * Gets or sets border width (default is 0.5)
  4247. */
  4248. borderWidth: number;
  4249. /**
  4250. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  4251. */
  4252. edgeSmoothingValue: number;
  4253. /**
  4254. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  4255. */
  4256. borderMinValue: number;
  4257. /**
  4258. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  4259. */
  4260. renderHoverLight: boolean;
  4261. /**
  4262. * Gets or sets the radius used to render the hover light (default is 1.0)
  4263. */
  4264. hoverRadius: number;
  4265. /**
  4266. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  4267. */
  4268. hoverColor: BABYLON.Color4;
  4269. /**
  4270. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  4271. */
  4272. hoverPosition: BABYLON.Vector3;
  4273. private _albedoTexture;
  4274. /** Gets or sets the texture to use for albedo color */
  4275. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  4276. /**
  4277. * Creates a new Fluent material
  4278. * @param name defines the name of the material
  4279. * @param scene defines the hosting scene
  4280. */
  4281. constructor(name: string, scene: BABYLON.Scene);
  4282. needAlphaBlending(): boolean;
  4283. needAlphaTesting(): boolean;
  4284. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  4285. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  4286. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  4287. getActiveTextures(): BABYLON.BaseTexture[];
  4288. hasTexture(texture: BABYLON.BaseTexture): boolean;
  4289. dispose(forceDisposeEffect?: boolean): void;
  4290. clone(name: string): FluentMaterial;
  4291. serialize(): any;
  4292. getClassName(): string;
  4293. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  4294. }
  4295. }
  4296. declare module BABYLON.GUI {
  4297. /**
  4298. * Class used to create a holographic button in 3D
  4299. */
  4300. export class HolographicButton extends Button3D {
  4301. private _backPlate;
  4302. private _textPlate;
  4303. private _frontPlate;
  4304. private _text;
  4305. private _imageUrl;
  4306. private _shareMaterials;
  4307. private _frontMaterial;
  4308. private _backMaterial;
  4309. private _plateMaterial;
  4310. private _pickedPointObserver;
  4311. private _tooltipFade;
  4312. private _tooltipTextBlock;
  4313. private _tooltipTexture;
  4314. private _tooltipMesh;
  4315. private _tooltipHoverObserver;
  4316. private _tooltipOutObserver;
  4317. private _disposeTooltip;
  4318. /**
  4319. * Rendering ground id of all the mesh in the button
  4320. */
  4321. set renderingGroupId(id: number);
  4322. get renderingGroupId(): number;
  4323. /**
  4324. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4325. */
  4326. set tooltipText(text: BABYLON.Nullable<string>);
  4327. get tooltipText(): BABYLON.Nullable<string>;
  4328. /**
  4329. * Gets or sets text for the button
  4330. */
  4331. get text(): string;
  4332. set text(value: string);
  4333. /**
  4334. * Gets or sets the image url for the button
  4335. */
  4336. get imageUrl(): string;
  4337. set imageUrl(value: string);
  4338. /**
  4339. * Gets the back material used by this button
  4340. */
  4341. get backMaterial(): FluentMaterial;
  4342. /**
  4343. * Gets the front material used by this button
  4344. */
  4345. get frontMaterial(): FluentMaterial;
  4346. /**
  4347. * Gets the plate material used by this button
  4348. */
  4349. get plateMaterial(): BABYLON.StandardMaterial;
  4350. /**
  4351. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4352. */
  4353. get shareMaterials(): boolean;
  4354. /**
  4355. * Creates a new button
  4356. * @param name defines the control name
  4357. */
  4358. constructor(name?: string, shareMaterials?: boolean);
  4359. protected _getTypeName(): string;
  4360. private _rebuildContent;
  4361. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4362. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4363. private _createBackMaterial;
  4364. private _createFrontMaterial;
  4365. private _createPlateMaterial;
  4366. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  4367. /**
  4368. * Releases all associated resources
  4369. */
  4370. dispose(): void;
  4371. }
  4372. }
  4373. declare module BABYLON.GUI {
  4374. /**
  4375. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  4376. */
  4377. export class MeshButton3D extends Button3D {
  4378. /** @hidden */
  4379. protected _currentMesh: BABYLON.Mesh;
  4380. /**
  4381. * Creates a new 3D button based on a mesh
  4382. * @param mesh mesh to become a 3D button
  4383. * @param name defines the control name
  4384. */
  4385. constructor(mesh: BABYLON.Mesh, name?: string);
  4386. protected _getTypeName(): string;
  4387. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4388. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4389. }
  4390. }
  4391. declare module BABYLON.GUI {
  4392. /**
  4393. * Class used to create a container panel deployed on the surface of a plane
  4394. */
  4395. export class PlanePanel extends VolumeBasedPanel {
  4396. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4397. }
  4398. }
  4399. declare module BABYLON.GUI {
  4400. /**
  4401. * Class used to create a container panel where items get randomized planar mapping
  4402. */
  4403. export class ScatterPanel extends VolumeBasedPanel {
  4404. private _iteration;
  4405. /**
  4406. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  4407. */
  4408. get iteration(): BABYLON.float;
  4409. set iteration(value: BABYLON.float);
  4410. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4411. private _scatterMapping;
  4412. protected _finalProcessing(): void;
  4413. }
  4414. }
  4415. declare module BABYLON.GUI {
  4416. /**
  4417. * Class used to create a container panel deployed on the surface of a sphere
  4418. */
  4419. export class SpherePanel extends VolumeBasedPanel {
  4420. private _radius;
  4421. /**
  4422. * Gets or sets the radius of the sphere where to project controls (5 by default)
  4423. */
  4424. get radius(): BABYLON.float;
  4425. set radius(value: BABYLON.float);
  4426. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4427. private _sphericalMapping;
  4428. }
  4429. }
  4430. declare module BABYLON.GUI {
  4431. /**
  4432. * Class used to create a stack panel in 3D on XY plane
  4433. */
  4434. export class StackPanel3D extends Container3D {
  4435. private _isVertical;
  4436. /**
  4437. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  4438. */
  4439. get isVertical(): boolean;
  4440. set isVertical(value: boolean);
  4441. /**
  4442. * Gets or sets the distance between elements
  4443. */
  4444. margin: number;
  4445. /**
  4446. * Creates new StackPanel
  4447. * @param isVertical
  4448. */
  4449. constructor(isVertical?: boolean);
  4450. protected _arrangeChildren(): void;
  4451. }
  4452. }
  4453. declare module BABYLON.GUI {
  4454. /**
  4455. * Class used to create an interactable object. It's a touchable 3D button using a mesh coming from the current scene
  4456. */
  4457. export class TouchMeshButton3D extends TouchButton3D {
  4458. /** @hidden */
  4459. protected _currentMesh: BABYLON.Mesh;
  4460. /**
  4461. * Creates a new 3D button based on a mesh
  4462. * @param mesh mesh to become a 3D button
  4463. * @param collisionMesh mesh to track collisions with
  4464. * @param name defines the control name
  4465. */
  4466. constructor(mesh: BABYLON.Mesh, options: {
  4467. collisionMesh: BABYLON.Mesh;
  4468. useDynamicMesh?: boolean;
  4469. }, name?: string);
  4470. protected _getTypeName(): string;
  4471. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4472. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4473. }
  4474. }
  4475. declare module BABYLON.GUI {
  4476. /**
  4477. * Class used to create a holographic button in 3D
  4478. */
  4479. export class TouchHolographicButton extends TouchButton3D {
  4480. private _backPlate;
  4481. private _textPlate;
  4482. private _frontPlate;
  4483. private _text;
  4484. private _imageUrl;
  4485. private _shareMaterials;
  4486. private _frontMaterial;
  4487. private _backMaterial;
  4488. private _plateMaterial;
  4489. private _pickedPointObserver;
  4490. private _tooltipFade;
  4491. private _tooltipTextBlock;
  4492. private _tooltipTexture;
  4493. private _tooltipMesh;
  4494. private _tooltipHoverObserver;
  4495. private _tooltipOutObserver;
  4496. private _disposeTooltip;
  4497. /**
  4498. * Rendering ground id of all the mesh in the button
  4499. */
  4500. set renderingGroupId(id: number);
  4501. get renderingGroupId(): number;
  4502. /**
  4503. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4504. */
  4505. set tooltipText(text: BABYLON.Nullable<string>);
  4506. get tooltipText(): BABYLON.Nullable<string>;
  4507. /**
  4508. * Gets or sets text for the button
  4509. */
  4510. get text(): string;
  4511. set text(value: string);
  4512. /**
  4513. * Gets or sets the image url for the button
  4514. */
  4515. get imageUrl(): string;
  4516. set imageUrl(value: string);
  4517. /**
  4518. * Gets the back material used by this button
  4519. */
  4520. get backMaterial(): FluentMaterial;
  4521. /**
  4522. * Gets the front material used by this button
  4523. */
  4524. get frontMaterial(): FluentMaterial;
  4525. /**
  4526. * Gets the plate material used by this button
  4527. */
  4528. get plateMaterial(): BABYLON.StandardMaterial;
  4529. /**
  4530. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4531. */
  4532. get shareMaterials(): boolean;
  4533. /**
  4534. * Creates a new button
  4535. * @param name defines the control name
  4536. */
  4537. constructor(name?: string, shareMaterials?: boolean);
  4538. protected _getTypeName(): string;
  4539. private _rebuildContent;
  4540. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4541. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4542. private _createBackMaterial;
  4543. private _createFrontMaterial;
  4544. private _createPlateMaterial;
  4545. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  4546. /**
  4547. * Releases all associated resources
  4548. */
  4549. dispose(): void;
  4550. }
  4551. }