babylon.gui.module.d.ts 245 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400
  1. /*BabylonJS GUI*/
  2. // Dependencies for this module:
  3. // ../../../../tools/Gulp/babylonjs
  4. declare module 'babylonjs-gui' {
  5. export * from "babylonjs-gui/2D";
  6. export * from "babylonjs-gui/3D";
  7. }
  8. declare module 'babylonjs-gui/2D' {
  9. export * from "babylonjs-gui/2D/controls";
  10. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  11. export * from "babylonjs-gui/2D/math2D";
  12. export * from "babylonjs-gui/2D/measure";
  13. export * from "babylonjs-gui/2D/multiLinePoint";
  14. export * from "babylonjs-gui/2D/style";
  15. export * from "babylonjs-gui/2D/valueAndUnit";
  16. }
  17. declare module 'babylonjs-gui/3D' {
  18. export * from "babylonjs-gui/3D/controls";
  19. export * from "babylonjs-gui/3D/materials";
  20. export * from "babylonjs-gui/3D/gui3DManager";
  21. export * from "babylonjs-gui/3D/vector3WithInfo";
  22. }
  23. declare module 'babylonjs-gui/2D/controls' {
  24. export * from "babylonjs-gui/2D/controls/button";
  25. export * from "babylonjs-gui/2D/controls/checkbox";
  26. export * from "babylonjs-gui/2D/controls/colorpicker";
  27. export * from "babylonjs-gui/2D/controls/container";
  28. export * from "babylonjs-gui/2D/controls/control";
  29. export * from "babylonjs-gui/2D/controls/ellipse";
  30. export * from "babylonjs-gui/2D/controls/grid";
  31. export * from "babylonjs-gui/2D/controls/image";
  32. export * from "babylonjs-gui/2D/controls/inputText";
  33. export * from "babylonjs-gui/2D/controls/inputPassword";
  34. export * from "babylonjs-gui/2D/controls/line";
  35. export * from "babylonjs-gui/2D/controls/multiLine";
  36. export * from "babylonjs-gui/2D/controls/radioButton";
  37. export * from "babylonjs-gui/2D/controls/stackPanel";
  38. export * from "babylonjs-gui/2D/controls/selector";
  39. export * from "babylonjs-gui/2D/controls/textBlock";
  40. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  41. export * from "babylonjs-gui/2D/controls/slider";
  42. export * from "babylonjs-gui/2D/controls/rectangle";
  43. export * from "babylonjs-gui/2D/controls/displayGrid";
  44. export * from "babylonjs-gui/2D/controls/statics";
  45. }
  46. declare module 'babylonjs-gui/2D/advancedDynamicTexture' {
  47. import { DynamicTexture, Nullable, Layer, Viewport, Scene, Vector3, Matrix, Vector2, AbstractMesh } from "babylonjs";
  48. import { Container } from "babylonjs-gui/2D/controls/container";
  49. import { Control } from "babylonjs-gui/2D/controls/control";
  50. import { Style } from "babylonjs-gui/2D/style";
  51. /**
  52. * Interface used to define a control that can receive focus
  53. */
  54. export interface IFocusableControl {
  55. /**
  56. * Function called when the control receives the focus
  57. */
  58. onFocus(): void;
  59. /**
  60. * Function called when the control loses the focus
  61. */
  62. onBlur(): void;
  63. /**
  64. * Function called to let the control handle keyboard events
  65. * @param evt defines the current keyboard event
  66. */
  67. processKeyboard(evt: KeyboardEvent): void;
  68. /**
  69. * Function called to get the list of controls that should not steal the focus from this control
  70. * @returns an array of controls
  71. */
  72. keepsFocusWith(): Nullable<Control[]>;
  73. }
  74. /**
  75. * Class used to create texture to support 2D GUI elements
  76. * @see http://doc.babylonjs.com/how_to/gui
  77. */
  78. export class AdvancedDynamicTexture extends DynamicTexture {
  79. /** @hidden */
  80. _rootContainer: Container;
  81. /** @hidden */
  82. _lastPickedControl: Control;
  83. /** @hidden */
  84. _lastControlOver: {
  85. [pointerId: number]: Control;
  86. };
  87. /** @hidden */
  88. _lastControlDown: {
  89. [pointerId: number]: Control;
  90. };
  91. /** @hidden */
  92. _capturingControl: {
  93. [pointerId: number]: Control;
  94. };
  95. /** @hidden */
  96. _shouldBlockPointer: boolean;
  97. /** @hidden */
  98. _layerToDispose: Nullable<Layer>;
  99. /** @hidden */
  100. _linkedControls: Control[];
  101. /**
  102. * Gets or sets a boolean defining if alpha is stored as premultiplied
  103. */
  104. premulAlpha: boolean;
  105. /**
  106. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  107. * Useful when you want more antialiasing
  108. */
  109. renderScale: number;
  110. /** Gets or sets the background color */
  111. background: string;
  112. /**
  113. * Gets or sets the ideal width used to design controls.
  114. * The GUI will then rescale everything accordingly
  115. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  116. */
  117. idealWidth: number;
  118. /**
  119. * Gets or sets the ideal height used to design controls.
  120. * The GUI will then rescale everything accordingly
  121. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  122. */
  123. idealHeight: number;
  124. /**
  125. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  126. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  127. */
  128. useSmallestIdeal: boolean;
  129. /**
  130. * Gets or sets a boolean indicating if adaptive scaling must be used
  131. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  132. */
  133. renderAtIdealSize: boolean;
  134. /**
  135. * Gets the underlying layer used to render the texture when in fullscreen mode
  136. */
  137. readonly layer: Nullable<Layer>;
  138. /**
  139. * Gets the root container control
  140. */
  141. readonly rootContainer: Container;
  142. /**
  143. * Gets or sets the current focused control
  144. */
  145. focusedControl: Nullable<IFocusableControl>;
  146. /**
  147. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  148. */
  149. isForeground: boolean;
  150. /**
  151. * Creates a new AdvancedDynamicTexture
  152. * @param name defines the name of the texture
  153. * @param width defines the width of the texture
  154. * @param height defines the height of the texture
  155. * @param scene defines the hosting scene
  156. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  157. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  158. */
  159. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  160. /**
  161. * Function used to execute a function on all controls
  162. * @param func defines the function to execute
  163. * @param container defines the container where controls belong. If null the root container will be used
  164. */
  165. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  166. /**
  167. * Marks the texture as dirty forcing a complete update
  168. */
  169. markAsDirty(): void;
  170. /**
  171. * Helper function used to create a new style
  172. * @returns a new style
  173. * @see http://doc.babylonjs.com/how_to/gui#styles
  174. */
  175. createStyle(): Style;
  176. /**
  177. * Adds a new control to the root container
  178. * @param control defines the control to add
  179. * @returns the current texture
  180. */
  181. addControl(control: Control): AdvancedDynamicTexture;
  182. /**
  183. * Removes a control from the root container
  184. * @param control defines the control to remove
  185. * @returns the current texture
  186. */
  187. removeControl(control: Control): AdvancedDynamicTexture;
  188. /**
  189. * Release all resources
  190. */
  191. dispose(): void;
  192. /** @hidden */
  193. _getGlobalViewport(scene: Scene): Viewport;
  194. /**
  195. * Get screen coordinates for a vector3
  196. * @param position defines the position to project
  197. * @param worldMatrix defines the world matrix to use
  198. * @returns the projected position
  199. */
  200. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  201. /** @hidden */
  202. _changeCursor(cursor: string): void;
  203. /** @hidden */
  204. _cleanControlAfterRemovalFromList(list: {
  205. [pointerId: number]: Control;
  206. }, control: Control): void;
  207. /** @hidden */
  208. _cleanControlAfterRemoval(control: Control): void;
  209. /** Attach to all scene events required to support pointer events */
  210. attach(): void;
  211. /**
  212. * Connect the texture to a hosting mesh to enable interactions
  213. * @param mesh defines the mesh to attach to
  214. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  215. */
  216. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  217. /**
  218. * Move the focus to a specific control
  219. * @param control defines the control which will receive the focus
  220. */
  221. moveFocusToControl(control: IFocusableControl): void;
  222. /**
  223. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  224. * @param mesh defines the mesh which will receive the texture
  225. * @param width defines the texture width (1024 by default)
  226. * @param height defines the texture height (1024 by default)
  227. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  228. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  229. * @returns a new AdvancedDynamicTexture
  230. */
  231. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  232. /**
  233. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  234. * In this mode the texture will rely on a layer for its rendering.
  235. * This allows it to be treated like any other layer.
  236. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  237. * LayerMask is set through advancedTexture.layer.layerMask
  238. * @param name defines name for the texture
  239. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  240. * @param scene defines the hsoting scene
  241. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  242. * @returns a new AdvancedDynamicTexture
  243. */
  244. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  245. }
  246. }
  247. declare module 'babylonjs-gui/2D/math2D' {
  248. import { Vector2, Nullable } from "babylonjs";
  249. /**
  250. * Class used to transport Vector2 information for pointer events
  251. */
  252. export class Vector2WithInfo extends Vector2 {
  253. /** defines the current mouse button index */
  254. buttonIndex: number;
  255. /**
  256. * Creates a new Vector2WithInfo
  257. * @param source defines the vector2 data to transport
  258. * @param buttonIndex defines the current mouse button index
  259. */
  260. constructor(source: Vector2,
  261. /** defines the current mouse button index */
  262. buttonIndex?: number);
  263. }
  264. /** Class used to provide 2D matrix features */
  265. export class Matrix2D {
  266. /** Gets the internal array of 6 floats used to store matrix data */
  267. m: Float32Array;
  268. /**
  269. * Creates a new matrix
  270. * @param m00 defines value for (0, 0)
  271. * @param m01 defines value for (0, 1)
  272. * @param m10 defines value for (1, 0)
  273. * @param m11 defines value for (1, 1)
  274. * @param m20 defines value for (2, 0)
  275. * @param m21 defines value for (2, 1)
  276. */
  277. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  278. /**
  279. * Fills the matrix from direct values
  280. * @param m00 defines value for (0, 0)
  281. * @param m01 defines value for (0, 1)
  282. * @param m10 defines value for (1, 0)
  283. * @param m11 defines value for (1, 1)
  284. * @param m20 defines value for (2, 0)
  285. * @param m21 defines value for (2, 1)
  286. * @returns the current modified matrix
  287. */
  288. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  289. /**
  290. * Gets matrix determinant
  291. * @returns the determinant
  292. */
  293. determinant(): number;
  294. /**
  295. * Inverses the matrix and stores it in a target matrix
  296. * @param result defines the target matrix
  297. * @returns the current matrix
  298. */
  299. invertToRef(result: Matrix2D): Matrix2D;
  300. /**
  301. * Multiplies the current matrix with another one
  302. * @param other defines the second operand
  303. * @param result defines the target matrix
  304. * @returns the current matrix
  305. */
  306. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  307. /**
  308. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  309. * @param x defines the x coordinate to transform
  310. * @param y defines the x coordinate to transform
  311. * @param result defines the target vector2
  312. * @returns the current matrix
  313. */
  314. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  315. /**
  316. * Creates an identity matrix
  317. * @returns a new matrix
  318. */
  319. static Identity(): Matrix2D;
  320. /**
  321. * Creates a translation matrix and stores it in a target matrix
  322. * @param x defines the x coordinate of the translation
  323. * @param y defines the y coordinate of the translation
  324. * @param result defines the target matrix
  325. */
  326. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  327. /**
  328. * Creates a scaling matrix and stores it in a target matrix
  329. * @param x defines the x coordinate of the scaling
  330. * @param y defines the y coordinate of the scaling
  331. * @param result defines the target matrix
  332. */
  333. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  334. /**
  335. * Creates a rotation matrix and stores it in a target matrix
  336. * @param angle defines the rotation angle
  337. * @param result defines the target matrix
  338. */
  339. static RotationToRef(angle: number, result: Matrix2D): void;
  340. /**
  341. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  342. * @param tx defines the x coordinate of the translation
  343. * @param ty defines the y coordinate of the translation
  344. * @param angle defines the rotation angle
  345. * @param scaleX defines the x coordinate of the scaling
  346. * @param scaleY defines the y coordinate of the scaling
  347. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  348. * @param result defines the target matrix
  349. */
  350. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  351. }
  352. }
  353. declare module 'babylonjs-gui/2D/measure' {
  354. /**
  355. * Class used to store 2D control sizes
  356. */
  357. export class Measure {
  358. /** defines left coordinate */
  359. left: number;
  360. /** defines top coordinate */
  361. top: number;
  362. /** defines width dimension */
  363. width: number;
  364. /** defines height dimension */
  365. height: number;
  366. /**
  367. * Creates a new measure
  368. * @param left defines left coordinate
  369. * @param top defines top coordinate
  370. * @param width defines width dimension
  371. * @param height defines height dimension
  372. */
  373. constructor(
  374. /** defines left coordinate */
  375. left: number,
  376. /** defines top coordinate */
  377. top: number,
  378. /** defines width dimension */
  379. width: number,
  380. /** defines height dimension */
  381. height: number);
  382. /**
  383. * Copy from another measure
  384. * @param other defines the other measure to copy from
  385. */
  386. copyFrom(other: Measure): void;
  387. /**
  388. * Check equality between this measure and another one
  389. * @param other defines the other measures
  390. * @returns true if both measures are equals
  391. */
  392. isEqualsTo(other: Measure): boolean;
  393. /**
  394. * Creates an empty measure
  395. * @returns a new measure
  396. */
  397. static Empty(): Measure;
  398. }
  399. }
  400. declare module 'babylonjs-gui/2D/multiLinePoint' {
  401. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  402. import { Control } from "babylonjs-gui/2D/controls/control";
  403. import { AbstractMesh, Nullable, Vector2 } from "babylonjs";
  404. /**
  405. * Class used to store a point for a MultiLine object.
  406. * The point can be pure 2D coordinates, a mesh or a control
  407. */
  408. export class MultiLinePoint {
  409. /** @hidden */
  410. _point: Vector2;
  411. /**
  412. * Creates a new MultiLinePoint
  413. * @param multiLine defines the source MultiLine object
  414. */
  415. constructor(multiLine: MultiLine);
  416. /** Gets or sets x coordinate */
  417. x: string | number;
  418. /** Gets or sets y coordinate */
  419. y: string | number;
  420. /** Gets or sets the control associated with this point */
  421. control: Nullable<Control>;
  422. /** Gets or sets the mesh associated with this point */
  423. mesh: Nullable<AbstractMesh>;
  424. /**
  425. * Gets a translation vector
  426. * @returns the translation vector
  427. */
  428. translate(): Vector2;
  429. /** Release associated resources */
  430. dispose(): void;
  431. }
  432. }
  433. declare module 'babylonjs-gui/2D/style' {
  434. import { IDisposable, Observable } from "babylonjs";
  435. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  436. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  437. /**
  438. * Define a style used by control to automatically setup properties based on a template.
  439. * Only support font related properties so far
  440. */
  441. export class Style implements IDisposable {
  442. /** @hidden */
  443. _host: AdvancedDynamicTexture;
  444. /** @hidden */
  445. _fontSize: ValueAndUnit;
  446. /**
  447. * Observable raised when the style values are changed
  448. */
  449. onChangedObservable: Observable<Style>;
  450. /**
  451. * Creates a new style object
  452. * @param host defines the AdvancedDynamicTexture which hosts this style
  453. */
  454. constructor(host: AdvancedDynamicTexture);
  455. /**
  456. * Gets or sets the font size
  457. */
  458. fontSize: string | number;
  459. /**
  460. * Gets or sets the font family
  461. */
  462. fontFamily: string;
  463. /**
  464. * Gets or sets the font style
  465. */
  466. fontStyle: string;
  467. /** Gets or sets font weight */
  468. fontWeight: string;
  469. /** Dispose all associated resources */
  470. dispose(): void;
  471. }
  472. }
  473. declare module 'babylonjs-gui/2D/valueAndUnit' {
  474. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  475. /**
  476. * Class used to specific a value and its associated unit
  477. */
  478. export class ValueAndUnit {
  479. /** defines the unit to store */
  480. unit: number;
  481. /** defines a boolean indicating if the value can be negative */
  482. negativeValueAllowed: boolean;
  483. /**
  484. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  485. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  486. */
  487. ignoreAdaptiveScaling: boolean;
  488. /**
  489. * Creates a new ValueAndUnit
  490. * @param value defines the value to store
  491. * @param unit defines the unit to store
  492. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  493. */
  494. constructor(value: number,
  495. /** defines the unit to store */
  496. unit?: number,
  497. /** defines a boolean indicating if the value can be negative */
  498. negativeValueAllowed?: boolean);
  499. /** Gets a boolean indicating if the value is a percentage */
  500. readonly isPercentage: boolean;
  501. /** Gets a boolean indicating if the value is store as pixel */
  502. readonly isPixel: boolean;
  503. /** Gets direct internal value */
  504. readonly internalValue: number;
  505. /**
  506. * Gets value as pixel
  507. * @param host defines the root host
  508. * @param refValue defines the reference value for percentages
  509. * @returns the value as pixel
  510. */
  511. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  512. /**
  513. * Gets the value accordingly to its unit
  514. * @param host defines the root host
  515. * @returns the value
  516. */
  517. getValue(host: AdvancedDynamicTexture): number;
  518. /**
  519. * Gets a string representation of the value
  520. * @param host defines the root host
  521. * @returns a string
  522. */
  523. toString(host: AdvancedDynamicTexture): string;
  524. /**
  525. * Store a value parsed from a string
  526. * @param source defines the source string
  527. * @returns true if the value was successfully parsed
  528. */
  529. fromString(source: string | number): boolean;
  530. /** UNITMODE_PERCENTAGE */
  531. static readonly UNITMODE_PERCENTAGE: number;
  532. /** UNITMODE_PIXEL */
  533. static readonly UNITMODE_PIXEL: number;
  534. }
  535. }
  536. declare module 'babylonjs-gui/3D/controls' {
  537. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  538. export * from "babylonjs-gui/3D/controls/button3D";
  539. export * from "babylonjs-gui/3D/controls/container3D";
  540. export * from "babylonjs-gui/3D/controls/control3D";
  541. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  542. export * from "babylonjs-gui/3D/controls/holographicButton";
  543. export * from "babylonjs-gui/3D/controls/meshButton3D";
  544. export * from "babylonjs-gui/3D/controls/planePanel";
  545. export * from "babylonjs-gui/3D/controls/scatterPanel";
  546. export * from "babylonjs-gui/3D/controls/spherePanel";
  547. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  548. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  549. }
  550. declare module 'babylonjs-gui/3D/materials' {
  551. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  552. }
  553. declare module 'babylonjs-gui/3D/gui3DManager' {
  554. import { IDisposable, Scene, Nullable, UtilityLayerRenderer, Observable, Vector3, Material } from "babylonjs";
  555. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  556. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  557. /**
  558. * Class used to manage 3D user interface
  559. * @see http://doc.babylonjs.com/how_to/gui3d
  560. */
  561. export class GUI3DManager implements IDisposable {
  562. /** @hidden */
  563. _lastPickedControl: Control3D;
  564. /** @hidden */
  565. _lastControlOver: {
  566. [pointerId: number]: Control3D;
  567. };
  568. /** @hidden */
  569. _lastControlDown: {
  570. [pointerId: number]: Control3D;
  571. };
  572. /**
  573. * Observable raised when the point picked by the pointer events changed
  574. */
  575. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  576. /** @hidden */
  577. _sharedMaterials: {
  578. [key: string]: Material;
  579. };
  580. /** Gets the hosting scene */
  581. readonly scene: Scene;
  582. /** Gets associated utility layer */
  583. readonly utilityLayer: Nullable<UtilityLayerRenderer>;
  584. /**
  585. * Creates a new GUI3DManager
  586. * @param scene
  587. */
  588. constructor(scene?: Scene);
  589. /**
  590. * Gets the root container
  591. */
  592. readonly rootContainer: Container3D;
  593. /**
  594. * Gets a boolean indicating if the given control is in the root child list
  595. * @param control defines the control to check
  596. * @returns true if the control is in the root child list
  597. */
  598. containsControl(control: Control3D): boolean;
  599. /**
  600. * Adds a control to the root child list
  601. * @param control defines the control to add
  602. * @returns the current manager
  603. */
  604. addControl(control: Control3D): GUI3DManager;
  605. /**
  606. * Removes a control from the root child list
  607. * @param control defines the control to remove
  608. * @returns the current container
  609. */
  610. removeControl(control: Control3D): GUI3DManager;
  611. /**
  612. * Releases all associated resources
  613. */
  614. dispose(): void;
  615. }
  616. }
  617. declare module 'babylonjs-gui/3D/vector3WithInfo' {
  618. import { Vector3 } from "babylonjs";
  619. /**
  620. * Class used to transport Vector3 information for pointer events
  621. */
  622. export class Vector3WithInfo extends Vector3 {
  623. /** defines the current mouse button index */
  624. buttonIndex: number;
  625. /**
  626. * Creates a new Vector3WithInfo
  627. * @param source defines the vector3 data to transport
  628. * @param buttonIndex defines the current mouse button index
  629. */
  630. constructor(source: Vector3,
  631. /** defines the current mouse button index */
  632. buttonIndex?: number);
  633. }
  634. }
  635. declare module 'babylonjs-gui/2D/controls/button' {
  636. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  637. import { Control } from "babylonjs-gui/2D/controls/control";
  638. import { Vector2 } from "babylonjs";
  639. /**
  640. * Class used to create 2D buttons
  641. */
  642. export class Button extends Rectangle {
  643. name?: string | undefined;
  644. /**
  645. * Function called to generate a pointer enter animation
  646. */
  647. pointerEnterAnimation: () => void;
  648. /**
  649. * Function called to generate a pointer out animation
  650. */
  651. pointerOutAnimation: () => void;
  652. /**
  653. * Function called to generate a pointer down animation
  654. */
  655. pointerDownAnimation: () => void;
  656. /**
  657. * Function called to generate a pointer up animation
  658. */
  659. pointerUpAnimation: () => void;
  660. /**
  661. * Creates a new Button
  662. * @param name defines the name of the button
  663. */
  664. constructor(name?: string | undefined);
  665. protected _getTypeName(): string;
  666. /** @hidden */
  667. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  668. /** @hidden */
  669. _onPointerEnter(target: Control): boolean;
  670. /** @hidden */
  671. _onPointerOut(target: Control): void;
  672. /** @hidden */
  673. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  674. /** @hidden */
  675. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  676. /**
  677. * Creates a new button made with an image and a text
  678. * @param name defines the name of the button
  679. * @param text defines the text of the button
  680. * @param imageUrl defines the url of the image
  681. * @returns a new Button
  682. */
  683. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  684. /**
  685. * Creates a new button made with an image
  686. * @param name defines the name of the button
  687. * @param imageUrl defines the url of the image
  688. * @returns a new Button
  689. */
  690. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  691. /**
  692. * Creates a new button made with a text
  693. * @param name defines the name of the button
  694. * @param text defines the text of the button
  695. * @returns a new Button
  696. */
  697. static CreateSimpleButton(name: string, text: string): Button;
  698. /**
  699. * Creates a new button made with an image and a centered text
  700. * @param name defines the name of the button
  701. * @param text defines the text of the button
  702. * @param imageUrl defines the url of the image
  703. * @returns a new Button
  704. */
  705. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  706. }
  707. }
  708. declare module 'babylonjs-gui/2D/controls/checkbox' {
  709. import { Control } from "babylonjs-gui/2D/controls/control";
  710. import { Measure } from "babylonjs-gui/2D/measure";
  711. import { Observable, Vector2 } from "babylonjs";
  712. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  713. /**
  714. * Class used to represent a 2D checkbox
  715. */
  716. export class Checkbox extends Control {
  717. name?: string | undefined;
  718. /** Gets or sets border thickness */
  719. thickness: number;
  720. /**
  721. * Observable raised when isChecked property changes
  722. */
  723. onIsCheckedChangedObservable: Observable<boolean>;
  724. /** Gets or sets a value indicating the ratio between overall size and check size */
  725. checkSizeRatio: number;
  726. /** Gets or sets background color */
  727. background: string;
  728. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  729. isChecked: boolean;
  730. /**
  731. * Creates a new CheckBox
  732. * @param name defines the control name
  733. */
  734. constructor(name?: string | undefined);
  735. protected _getTypeName(): string;
  736. /** @hidden */
  737. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  738. /** @hidden */
  739. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  740. /**
  741. * Utility function to easily create a checkbox with a header
  742. * @param title defines the label to use for the header
  743. * @param onValueChanged defines the callback to call when value changes
  744. * @returns a StackPanel containing the checkbox and a textBlock
  745. */
  746. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  747. }
  748. }
  749. declare module 'babylonjs-gui/2D/controls/colorpicker' {
  750. import { Control } from "babylonjs-gui/2D/controls/control";
  751. import { Color3, Observable, Vector2 } from "babylonjs";
  752. import { Measure } from "babylonjs-gui/2D/measure";
  753. /** Class used to create color pickers */
  754. export class ColorPicker extends Control {
  755. name?: string | undefined;
  756. /**
  757. * Observable raised when the value changes
  758. */
  759. onValueChangedObservable: Observable<Color3>;
  760. /** Gets or sets the color of the color picker */
  761. value: Color3;
  762. /** Gets or sets control width */
  763. width: string | number;
  764. /** Gets or sets control height */
  765. height: string | number;
  766. /** Gets or sets control size */
  767. size: string | number;
  768. /**
  769. * Creates a new ColorPicker
  770. * @param name defines the control name
  771. */
  772. constructor(name?: string | undefined);
  773. protected _getTypeName(): string;
  774. /** @hidden */
  775. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  776. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  777. _onPointerMove(target: Control, coordinates: Vector2): void;
  778. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  779. }
  780. }
  781. declare module 'babylonjs-gui/2D/controls/container' {
  782. import { Control } from "babylonjs-gui/2D/controls/control";
  783. import { Measure } from "babylonjs-gui/2D/measure";
  784. import { Nullable } from "babylonjs";
  785. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  786. /**
  787. * Root class for 2D containers
  788. * @see http://doc.babylonjs.com/how_to/gui#containers
  789. */
  790. export class Container extends Control {
  791. name?: string | undefined;
  792. /** @hidden */
  793. protected _children: Control[];
  794. /** @hidden */
  795. protected _measureForChildren: Measure;
  796. /** @hidden */
  797. protected _background: string;
  798. /** @hidden */
  799. protected _adaptWidthToChildren: boolean;
  800. /** @hidden */
  801. protected _adaptHeightToChildren: boolean;
  802. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  803. adaptHeightToChildren: boolean;
  804. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  805. adaptWidthToChildren: boolean;
  806. /** Gets or sets background color */
  807. background: string;
  808. /** Gets the list of children */
  809. readonly children: Control[];
  810. /**
  811. * Creates a new Container
  812. * @param name defines the name of the container
  813. */
  814. constructor(name?: string | undefined);
  815. protected _getTypeName(): string;
  816. /**
  817. * Gets a child using its name
  818. * @param name defines the child name to look for
  819. * @returns the child control if found
  820. */
  821. getChildByName(name: string): Nullable<Control>;
  822. /**
  823. * Gets a child using its type and its name
  824. * @param name defines the child name to look for
  825. * @param type defines the child type to look for
  826. * @returns the child control if found
  827. */
  828. getChildByType(name: string, type: string): Nullable<Control>;
  829. /**
  830. * Search for a specific control in children
  831. * @param control defines the control to look for
  832. * @returns true if the control is in child list
  833. */
  834. containsControl(control: Control): boolean;
  835. /**
  836. * Adds a new control to the current container
  837. * @param control defines the control to add
  838. * @returns the current container
  839. */
  840. addControl(control: Nullable<Control>): Container;
  841. /**
  842. * Removes all controls from the current container
  843. * @returns the current container
  844. */
  845. clearControls(): Container;
  846. /**
  847. * Removes a control from the current container
  848. * @param control defines the control to remove
  849. * @returns the current container
  850. */
  851. removeControl(control: Control): Container;
  852. /** @hidden */
  853. _reOrderControl(control: Control): void;
  854. /** @hidden */
  855. _markMatrixAsDirty(): void;
  856. /** @hidden */
  857. _markAllAsDirty(): void;
  858. /** @hidden */
  859. protected _localDraw(context: CanvasRenderingContext2D): void;
  860. /** @hidden */
  861. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  862. /** @hidden */
  863. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  864. /** @hidden */
  865. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  866. /** @hidden */
  867. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  868. /** @hidden */
  869. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  870. /** Releases associated resources */
  871. dispose(): void;
  872. }
  873. }
  874. declare module 'babylonjs-gui/2D/controls/control' {
  875. import { Container } from "babylonjs-gui/2D/controls/container";
  876. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  877. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  878. import { Nullable, Vector2, AbstractMesh, Observable, Vector3, Scene } from "babylonjs";
  879. import { Measure } from "babylonjs-gui/2D/measure";
  880. import { Style } from "babylonjs-gui/2D/style";
  881. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  882. /**
  883. * Root class used for all 2D controls
  884. * @see http://doc.babylonjs.com/how_to/gui#controls
  885. */
  886. export class Control {
  887. /** defines the name of the control */
  888. name?: string | undefined;
  889. /** @hidden */
  890. _root: Nullable<Container>;
  891. /** @hidden */
  892. _host: AdvancedDynamicTexture;
  893. /** Gets or sets the control parent */
  894. parent: Nullable<Container>;
  895. /** @hidden */
  896. _currentMeasure: Measure;
  897. /** @hidden */
  898. _width: ValueAndUnit;
  899. /** @hidden */
  900. _height: ValueAndUnit;
  901. /** @hidden */
  902. protected _fontOffset: {
  903. ascent: number;
  904. height: number;
  905. descent: number;
  906. };
  907. /** @hidden */
  908. protected _horizontalAlignment: number;
  909. /** @hidden */
  910. protected _verticalAlignment: number;
  911. /** @hidden */
  912. _tempParentMeasure: Measure;
  913. /** @hidden */
  914. protected _cachedParentMeasure: Measure;
  915. /** @hidden */
  916. _left: ValueAndUnit;
  917. /** @hidden */
  918. _top: ValueAndUnit;
  919. /** @hidden */
  920. protected _invertTransformMatrix: Matrix2D;
  921. /** @hidden */
  922. protected _transformedPosition: Vector2;
  923. /** @hidden */
  924. _linkedMesh: Nullable<AbstractMesh>;
  925. protected _isEnabled: boolean;
  926. protected _disabledColor: string;
  927. /** @hidden */
  928. _tag: any;
  929. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  930. isHitTestVisible: boolean;
  931. /** Gets or sets a boolean indicating if the control can block pointer events */
  932. isPointerBlocker: boolean;
  933. /** Gets or sets a boolean indicating if the control can be focusable */
  934. isFocusInvisible: boolean;
  935. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  936. shadowOffsetX: number;
  937. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  938. shadowOffsetY: number;
  939. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  940. shadowBlur: number;
  941. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  942. shadowColor: string;
  943. /** Gets or sets the cursor to use when the control is hovered */
  944. hoverCursor: string;
  945. /** @hidden */
  946. protected _linkOffsetX: ValueAndUnit;
  947. /** @hidden */
  948. protected _linkOffsetY: ValueAndUnit;
  949. /** Gets the control type name */
  950. readonly typeName: string;
  951. /**
  952. * An event triggered when the pointer move over the control.
  953. */
  954. onPointerMoveObservable: Observable<Vector2>;
  955. /**
  956. * An event triggered when the pointer move out of the control.
  957. */
  958. onPointerOutObservable: Observable<Control>;
  959. /**
  960. * An event triggered when the pointer taps the control
  961. */
  962. onPointerDownObservable: Observable<Vector2WithInfo>;
  963. /**
  964. * An event triggered when pointer up
  965. */
  966. onPointerUpObservable: Observable<Vector2WithInfo>;
  967. /**
  968. * An event triggered when a control is clicked on
  969. */
  970. onPointerClickObservable: Observable<Vector2WithInfo>;
  971. /**
  972. * An event triggered when pointer enters the control
  973. */
  974. onPointerEnterObservable: Observable<Control>;
  975. /**
  976. * An event triggered when the control is marked as dirty
  977. */
  978. onDirtyObservable: Observable<Control>;
  979. /**
  980. * An event triggered after the control is drawn
  981. */
  982. onAfterDrawObservable: Observable<Control>;
  983. /** Gets or set information about font offsets (used to render and align text) */
  984. fontOffset: {
  985. ascent: number;
  986. height: number;
  987. descent: number;
  988. };
  989. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  990. alpha: number;
  991. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  992. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  993. */
  994. scaleX: number;
  995. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  996. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  997. */
  998. scaleY: number;
  999. /** Gets or sets the rotation angle (0 by default)
  1000. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1001. */
  1002. rotation: number;
  1003. /** Gets or sets the transformation center on Y axis (0 by default)
  1004. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1005. */
  1006. transformCenterY: number;
  1007. /** Gets or sets the transformation center on X axis (0 by default)
  1008. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1009. */
  1010. transformCenterX: number;
  1011. /**
  1012. * Gets or sets the horizontal alignment
  1013. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1014. */
  1015. horizontalAlignment: number;
  1016. /**
  1017. * Gets or sets the vertical alignment
  1018. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1019. */
  1020. verticalAlignment: number;
  1021. /**
  1022. * Gets or sets control width
  1023. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1024. */
  1025. width: string | number;
  1026. /**
  1027. * Gets control width in pixel
  1028. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1029. */
  1030. readonly widthInPixels: number;
  1031. /**
  1032. * Gets or sets control height
  1033. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1034. */
  1035. height: string | number;
  1036. /**
  1037. * Gets control height in pixel
  1038. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1039. */
  1040. readonly heightInPixels: number;
  1041. /** Gets or set font family */
  1042. fontFamily: string;
  1043. /** Gets or sets font style */
  1044. fontStyle: string;
  1045. /** Gets or sets font weight */
  1046. fontWeight: string;
  1047. /**
  1048. * Gets or sets style
  1049. * @see http://doc.babylonjs.com/how_to/gui#styles
  1050. */
  1051. style: Nullable<Style>;
  1052. /** @hidden */
  1053. readonly _isFontSizeInPercentage: boolean;
  1054. /** Gets font size in pixels */
  1055. readonly fontSizeInPixels: number;
  1056. /** Gets or sets font size */
  1057. fontSize: string | number;
  1058. /** Gets or sets foreground color */
  1059. color: string;
  1060. /** Gets or sets z index which is used to reorder controls on the z axis */
  1061. zIndex: number;
  1062. /** Gets or sets a boolean indicating if the control can be rendered */
  1063. notRenderable: boolean;
  1064. /** Gets or sets a boolean indicating if the control is visible */
  1065. isVisible: boolean;
  1066. /** Gets a boolean indicating that the control needs to update its rendering */
  1067. readonly isDirty: boolean;
  1068. /**
  1069. * Gets or sets a value indicating the padding to use on the left of the control
  1070. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1071. */
  1072. paddingLeft: string | number;
  1073. /**
  1074. * Gets a value indicating the padding in pixels to use on the left of the control
  1075. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1076. */
  1077. readonly paddingLeftInPixels: number;
  1078. /**
  1079. * Gets or sets a value indicating the padding to use on the right of the control
  1080. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1081. */
  1082. paddingRight: string | number;
  1083. /**
  1084. * Gets a value indicating the padding in pixels to use on the right of the control
  1085. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1086. */
  1087. readonly paddingRightInPixels: number;
  1088. /**
  1089. * Gets or sets a value indicating the padding to use on the top of the control
  1090. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1091. */
  1092. paddingTop: string | number;
  1093. /**
  1094. * Gets a value indicating the padding in pixels to use on the top of the control
  1095. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1096. */
  1097. readonly paddingTopInPixels: number;
  1098. /**
  1099. * Gets or sets a value indicating the padding to use on the bottom of the control
  1100. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1101. */
  1102. paddingBottom: string | number;
  1103. /**
  1104. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1105. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1106. */
  1107. readonly paddingBottomInPixels: number;
  1108. /**
  1109. * Gets or sets a value indicating the left coordinate of the control
  1110. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1111. */
  1112. left: string | number;
  1113. /**
  1114. * Gets a value indicating the left coordinate in pixels of the control
  1115. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1116. */
  1117. readonly leftInPixels: number;
  1118. /**
  1119. * Gets or sets a value indicating the top coordinate of the control
  1120. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1121. */
  1122. top: string | number;
  1123. /**
  1124. * Gets a value indicating the top coordinate in pixels of the control
  1125. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1126. */
  1127. readonly topInPixels: number;
  1128. /**
  1129. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1130. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1131. */
  1132. linkOffsetX: string | number;
  1133. /**
  1134. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1135. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1136. */
  1137. readonly linkOffsetXInPixels: number;
  1138. /**
  1139. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1140. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1141. */
  1142. linkOffsetY: string | number;
  1143. /**
  1144. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1145. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1146. */
  1147. readonly linkOffsetYInPixels: number;
  1148. /** Gets the center coordinate on X axis */
  1149. readonly centerX: number;
  1150. /** Gets the center coordinate on Y axis */
  1151. readonly centerY: number;
  1152. /** Gets or sets if control is Enabled*/
  1153. isEnabled: boolean;
  1154. /** Gets or sets background color of control if it's disabled*/
  1155. disabledColor: string;
  1156. /**
  1157. * Creates a new control
  1158. * @param name defines the name of the control
  1159. */
  1160. constructor(
  1161. /** defines the name of the control */
  1162. name?: string | undefined);
  1163. /** @hidden */
  1164. protected _getTypeName(): string;
  1165. /** @hidden */
  1166. _resetFontCache(): void;
  1167. /**
  1168. * Determines if a container is an ascendant of the current control
  1169. * @param container defines the container to look for
  1170. * @returns true if the container is one of the ascendant of the control
  1171. */
  1172. isAscendant(container: Control): boolean;
  1173. /**
  1174. * Gets coordinates in local control space
  1175. * @param globalCoordinates defines the coordinates to transform
  1176. * @returns the new coordinates in local space
  1177. */
  1178. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1179. /**
  1180. * Gets coordinates in local control space
  1181. * @param globalCoordinates defines the coordinates to transform
  1182. * @param result defines the target vector2 where to store the result
  1183. * @returns the current control
  1184. */
  1185. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1186. /**
  1187. * Gets coordinates in parent local control space
  1188. * @param globalCoordinates defines the coordinates to transform
  1189. * @returns the new coordinates in parent local space
  1190. */
  1191. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1192. /**
  1193. * Move the current control to a vector3 position projected onto the screen.
  1194. * @param position defines the target position
  1195. * @param scene defines the hosting scene
  1196. */
  1197. moveToVector3(position: Vector3, scene: Scene): void;
  1198. /**
  1199. * Link current control with a target mesh
  1200. * @param mesh defines the mesh to link with
  1201. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1202. */
  1203. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  1204. /** @hidden */
  1205. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1206. /** @hidden */
  1207. _markMatrixAsDirty(): void;
  1208. /** @hidden */
  1209. _markAsDirty(): void;
  1210. /** @hidden */
  1211. _markAllAsDirty(): void;
  1212. /** @hidden */
  1213. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  1214. /** @hidden */
  1215. protected _transform(context: CanvasRenderingContext2D): void;
  1216. /** @hidden */
  1217. protected _applyStates(context: CanvasRenderingContext2D): void;
  1218. /** @hidden */
  1219. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1220. /** @hidden */
  1221. protected _clip(context: CanvasRenderingContext2D): void;
  1222. /** @hidden */
  1223. _measure(): void;
  1224. /** @hidden */
  1225. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1226. /** @hidden */
  1227. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1228. /** @hidden */
  1229. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1230. /** @hidden */
  1231. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1232. /**
  1233. * Tests if a given coordinates belong to the current control
  1234. * @param x defines x coordinate to test
  1235. * @param y defines y coordinate to test
  1236. * @returns true if the coordinates are inside the control
  1237. */
  1238. contains(x: number, y: number): boolean;
  1239. /** @hidden */
  1240. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1241. /** @hidden */
  1242. _onPointerMove(target: Control, coordinates: Vector2): void;
  1243. /** @hidden */
  1244. _onPointerEnter(target: Control): boolean;
  1245. /** @hidden */
  1246. _onPointerOut(target: Control): void;
  1247. /** @hidden */
  1248. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1249. /** @hidden */
  1250. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1251. /** @hidden */
  1252. _forcePointerUp(pointerId?: Nullable<number>): void;
  1253. /** @hidden */
  1254. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1255. /** Releases associated resources */
  1256. dispose(): void;
  1257. /** HORIZONTAL_ALIGNMENT_LEFT */
  1258. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1259. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1260. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1261. /** HORIZONTAL_ALIGNMENT_CENTER */
  1262. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1263. /** VERTICAL_ALIGNMENT_TOP */
  1264. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1265. /** VERTICAL_ALIGNMENT_BOTTOM */
  1266. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1267. /** VERTICAL_ALIGNMENT_CENTER */
  1268. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1269. /** @hidden */
  1270. static _GetFontOffset(font: string): {
  1271. ascent: number;
  1272. height: number;
  1273. descent: number;
  1274. };
  1275. /**
  1276. * Creates a stack panel that can be used to render headers
  1277. * @param control defines the control to associate with the header
  1278. * @param text defines the text of the header
  1279. * @param size defines the size of the header
  1280. * @param options defines options used to configure the header
  1281. * @returns a new StackPanel
  1282. * @ignore
  1283. * @hidden
  1284. */
  1285. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1286. isHorizontal: boolean;
  1287. controlFirst: boolean;
  1288. }) => any;
  1289. /** @hidden */
  1290. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1291. }
  1292. }
  1293. declare module 'babylonjs-gui/2D/controls/ellipse' {
  1294. import { Container } from "babylonjs-gui/2D/controls/container";
  1295. import { Measure } from "babylonjs-gui/2D/measure";
  1296. /** Class used to create 2D ellipse containers */
  1297. export class Ellipse extends Container {
  1298. name?: string | undefined;
  1299. /** Gets or sets border thickness */
  1300. thickness: number;
  1301. /**
  1302. * Creates a new Ellipse
  1303. * @param name defines the control name
  1304. */
  1305. constructor(name?: string | undefined);
  1306. protected _getTypeName(): string;
  1307. protected _localDraw(context: CanvasRenderingContext2D): void;
  1308. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1309. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1310. }
  1311. }
  1312. declare module 'babylonjs-gui/2D/controls/grid' {
  1313. import { Container } from "babylonjs-gui/2D/controls/container";
  1314. import { Control } from "babylonjs-gui/2D/controls/control";
  1315. import { Measure } from "babylonjs-gui/2D/measure";
  1316. /**
  1317. * Class used to create a 2D grid container
  1318. */
  1319. export class Grid extends Container {
  1320. name?: string | undefined;
  1321. /** Gets the list of children */
  1322. readonly children: Control[];
  1323. /**
  1324. * Adds a new row to the grid
  1325. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1326. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1327. * @returns the current grid
  1328. */
  1329. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1330. /**
  1331. * Adds a new column to the grid
  1332. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1333. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1334. * @returns the current grid
  1335. */
  1336. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1337. /**
  1338. * Update a row definition
  1339. * @param index defines the index of the row to update
  1340. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1341. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1342. * @returns the current grid
  1343. */
  1344. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1345. /**
  1346. * Update a column definition
  1347. * @param index defines the index of the column to update
  1348. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1349. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1350. * @returns the current grid
  1351. */
  1352. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1353. /**
  1354. * Remove a column definition at specified index
  1355. * @param index defines the index of the column to remove
  1356. * @returns the current grid
  1357. */
  1358. removeColumnDefinition(index: number): Grid;
  1359. /**
  1360. * Remove a row definition at specified index
  1361. * @param index defines the index of the row to remove
  1362. * @returns the current grid
  1363. */
  1364. removeRowDefinition(index: number): Grid;
  1365. /**
  1366. * Adds a new control to the current grid
  1367. * @param control defines the control to add
  1368. * @param row defines the row where to add the control (0 by default)
  1369. * @param column defines the column where to add the control (0 by default)
  1370. * @returns the current grid
  1371. */
  1372. addControl(control: Control, row?: number, column?: number): Grid;
  1373. /**
  1374. * Removes a control from the current container
  1375. * @param control defines the control to remove
  1376. * @returns the current container
  1377. */
  1378. removeControl(control: Control): Container;
  1379. /**
  1380. * Creates a new Grid
  1381. * @param name defines control name
  1382. */
  1383. constructor(name?: string | undefined);
  1384. protected _getTypeName(): string;
  1385. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1386. /** Releases associated resources */
  1387. dispose(): void;
  1388. }
  1389. }
  1390. declare module 'babylonjs-gui/2D/controls/image' {
  1391. import { Control } from "babylonjs-gui/2D/controls/control";
  1392. import { Nullable } from "babylonjs";
  1393. import { Measure } from "babylonjs-gui/2D/measure";
  1394. /**
  1395. * Class used to create 2D images
  1396. */
  1397. export class Image extends Control {
  1398. name?: string | undefined;
  1399. /**
  1400. * Gets or sets the left coordinate in the source image
  1401. */
  1402. sourceLeft: number;
  1403. /**
  1404. * Gets or sets the top coordinate in the source image
  1405. */
  1406. sourceTop: number;
  1407. /**
  1408. * Gets or sets the width to capture in the source image
  1409. */
  1410. sourceWidth: number;
  1411. /**
  1412. * Gets or sets the height to capture in the source image
  1413. */
  1414. sourceHeight: number;
  1415. /**
  1416. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1417. * @see http://doc.babylonjs.com/how_to/gui#image
  1418. */
  1419. autoScale: boolean;
  1420. /** Gets or sets the streching mode used by the image */
  1421. stretch: number;
  1422. /**
  1423. * Gets or sets the internal DOM image used to render the control
  1424. */
  1425. domImage: HTMLImageElement;
  1426. /**
  1427. * Gets or sets image source url
  1428. */
  1429. source: Nullable<string>;
  1430. /**
  1431. * Gets or sets the cell width to use when animation sheet is enabled
  1432. * @see http://doc.babylonjs.com/how_to/gui#image
  1433. */
  1434. cellWidth: number;
  1435. /**
  1436. * Gets or sets the cell height to use when animation sheet is enabled
  1437. * @see http://doc.babylonjs.com/how_to/gui#image
  1438. */
  1439. cellHeight: number;
  1440. /**
  1441. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1442. * @see http://doc.babylonjs.com/how_to/gui#image
  1443. */
  1444. cellId: number;
  1445. /**
  1446. * Creates a new Image
  1447. * @param name defines the control name
  1448. * @param url defines the image url
  1449. */
  1450. constructor(name?: string | undefined, url?: Nullable<string>);
  1451. protected _getTypeName(): string;
  1452. /** Force the control to synchronize with its content */
  1453. synchronizeSizeWithContent(): void;
  1454. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1455. /** STRETCH_NONE */
  1456. static readonly STRETCH_NONE: number;
  1457. /** STRETCH_FILL */
  1458. static readonly STRETCH_FILL: number;
  1459. /** STRETCH_UNIFORM */
  1460. static readonly STRETCH_UNIFORM: number;
  1461. /** STRETCH_EXTEND */
  1462. static readonly STRETCH_EXTEND: number;
  1463. }
  1464. }
  1465. declare module 'babylonjs-gui/2D/controls/inputText' {
  1466. import { Control } from "babylonjs-gui/2D/controls/control";
  1467. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  1468. import { Nullable, Observable, Vector2 } from "babylonjs";
  1469. import { Measure } from "babylonjs-gui/2D/measure";
  1470. import { VirtualKeyboard } from "babylonjs-gui/2D/controls/virtualKeyboard";
  1471. /**
  1472. * Class used to create input text control
  1473. */
  1474. export class InputText extends Control implements IFocusableControl {
  1475. name?: string | undefined;
  1476. /** @hidden */
  1477. _connectedVirtualKeyboard: Nullable<VirtualKeyboard>;
  1478. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1479. promptMessage: string;
  1480. /** Observable raised when the text changes */
  1481. onTextChangedObservable: Observable<InputText>;
  1482. /** Observable raised just before an entered character is to be added */
  1483. onBeforeKeyAddObservable: Observable<InputText>;
  1484. /** Observable raised when the control gets the focus */
  1485. onFocusObservable: Observable<InputText>;
  1486. /** Observable raised when the control loses the focus */
  1487. onBlurObservable: Observable<InputText>;
  1488. /** Gets or sets the maximum width allowed by the control */
  1489. maxWidth: string | number;
  1490. /** Gets the maximum width allowed by the control in pixels */
  1491. readonly maxWidthInPixels: number;
  1492. /** Gets or sets control margin */
  1493. margin: string;
  1494. /** Gets control margin in pixels */
  1495. readonly marginInPixels: number;
  1496. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1497. autoStretchWidth: boolean;
  1498. /** Gets or sets border thickness */
  1499. thickness: number;
  1500. /** Gets or sets the background color when focused */
  1501. focusedBackground: string;
  1502. /** Gets or sets the background color */
  1503. background: string;
  1504. /** Gets or sets the placeholder color */
  1505. placeholderColor: string;
  1506. /** Gets or sets the text displayed when the control is empty */
  1507. placeholderText: string;
  1508. /** Gets or sets the dead key flag */
  1509. deadKey: boolean;
  1510. /** Gets or sets if the current key should be added */
  1511. addKey: boolean;
  1512. /** Gets or sets the value of the current key being entered */
  1513. currentKey: string;
  1514. /** Gets or sets the text displayed in the control */
  1515. text: string;
  1516. /** Gets or sets control width */
  1517. width: string | number;
  1518. /**
  1519. * Creates a new InputText
  1520. * @param name defines the control name
  1521. * @param text defines the text of the control
  1522. */
  1523. constructor(name?: string | undefined, text?: string);
  1524. /** @hidden */
  1525. onBlur(): void;
  1526. /** @hidden */
  1527. onFocus(): void;
  1528. protected _getTypeName(): string;
  1529. /**
  1530. * Function called to get the list of controls that should not steal the focus from this control
  1531. * @returns an array of controls
  1532. */
  1533. keepsFocusWith(): Nullable<Control[]>;
  1534. /** @hidden */
  1535. processKey(keyCode: number, key?: string): void;
  1536. /** @hidden */
  1537. processKeyboard(evt: KeyboardEvent): void;
  1538. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1539. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1540. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1541. protected _beforeRenderText(text: string): string;
  1542. dispose(): void;
  1543. }
  1544. }
  1545. declare module 'babylonjs-gui/2D/controls/inputPassword' {
  1546. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1547. /**
  1548. * Class used to create a password control
  1549. */
  1550. export class InputPassword extends InputText {
  1551. protected _beforeRenderText(text: string): string;
  1552. }
  1553. }
  1554. declare module 'babylonjs-gui/2D/controls/line' {
  1555. import { Control } from "babylonjs-gui/2D/controls/control";
  1556. import { Vector3, Scene } from "babylonjs";
  1557. import { Measure } from "babylonjs-gui/2D/measure";
  1558. /** Class used to render 2D lines */
  1559. export class Line extends Control {
  1560. name?: string | undefined;
  1561. /** Gets or sets the dash pattern */
  1562. dash: Array<number>;
  1563. /** Gets or sets the control connected with the line end */
  1564. connectedControl: Control;
  1565. /** Gets or sets start coordinates on X axis */
  1566. x1: string | number;
  1567. /** Gets or sets start coordinates on Y axis */
  1568. y1: string | number;
  1569. /** Gets or sets end coordinates on X axis */
  1570. x2: string | number;
  1571. /** Gets or sets end coordinates on Y axis */
  1572. y2: string | number;
  1573. /** Gets or sets line width */
  1574. lineWidth: number;
  1575. /** Gets or sets horizontal alignment */
  1576. horizontalAlignment: number;
  1577. /** Gets or sets vertical alignment */
  1578. verticalAlignment: number;
  1579. /**
  1580. * Creates a new Line
  1581. * @param name defines the control name
  1582. */
  1583. constructor(name?: string | undefined);
  1584. protected _getTypeName(): string;
  1585. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1586. _measure(): void;
  1587. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1588. /**
  1589. * Move one end of the line given 3D cartesian coordinates.
  1590. * @param position Targeted world position
  1591. * @param scene Scene
  1592. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1593. */
  1594. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  1595. /**
  1596. * Move one end of the line to a position in screen absolute space.
  1597. * @param projectedPosition Position in screen absolute space (X, Y)
  1598. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1599. */
  1600. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  1601. }
  1602. }
  1603. declare module 'babylonjs-gui/2D/controls/multiLine' {
  1604. import { Control } from "babylonjs-gui/2D/controls/control";
  1605. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  1606. import { AbstractMesh } from "babylonjs";
  1607. import { Measure } from "babylonjs-gui/2D/measure";
  1608. /**
  1609. * Class used to create multi line control
  1610. */
  1611. export class MultiLine extends Control {
  1612. name?: string | undefined;
  1613. /**
  1614. * Creates a new MultiLine
  1615. * @param name defines the control name
  1616. */
  1617. constructor(name?: string | undefined);
  1618. /** Gets or sets dash pattern */
  1619. dash: Array<number>;
  1620. /**
  1621. * Gets point stored at specified index
  1622. * @param index defines the index to look for
  1623. * @returns the requested point if found
  1624. */
  1625. getAt(index: number): MultiLinePoint;
  1626. /** Function called when a point is updated */
  1627. onPointUpdate: () => void;
  1628. /**
  1629. * Adds new points to the point collection
  1630. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1631. * @returns the list of created MultiLinePoint
  1632. */
  1633. add(...items: (AbstractMesh | Control | {
  1634. x: string | number;
  1635. y: string | number;
  1636. })[]): MultiLinePoint[];
  1637. /**
  1638. * Adds a new point to the point collection
  1639. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1640. * @returns the created MultiLinePoint
  1641. */
  1642. push(item?: (AbstractMesh | Control | {
  1643. x: string | number;
  1644. y: string | number;
  1645. })): MultiLinePoint;
  1646. /**
  1647. * Remove a specific value or point from the active point collection
  1648. * @param value defines the value or point to remove
  1649. */
  1650. remove(value: number | MultiLinePoint): void;
  1651. /** Gets or sets line width */
  1652. lineWidth: number;
  1653. horizontalAlignment: number;
  1654. verticalAlignment: number;
  1655. protected _getTypeName(): string;
  1656. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1657. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1658. _measure(): void;
  1659. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1660. dispose(): void;
  1661. }
  1662. }
  1663. declare module 'babylonjs-gui/2D/controls/radioButton' {
  1664. import { Control } from "babylonjs-gui/2D/controls/control";
  1665. import { Observable, Vector2 } from "babylonjs";
  1666. import { Measure } from "babylonjs-gui/2D/measure";
  1667. import { StackPanel } from "babylonjs-gui/2D/controls";
  1668. /**
  1669. * Class used to create radio button controls
  1670. */
  1671. export class RadioButton extends Control {
  1672. name?: string | undefined;
  1673. /** Gets or sets border thickness */
  1674. thickness: number;
  1675. /** Gets or sets group name */
  1676. group: string;
  1677. /** Observable raised when isChecked is changed */
  1678. onIsCheckedChangedObservable: Observable<boolean>;
  1679. /** Gets or sets a value indicating the ratio between overall size and check size */
  1680. checkSizeRatio: number;
  1681. /** Gets or sets background color */
  1682. background: string;
  1683. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1684. isChecked: boolean;
  1685. /**
  1686. * Creates a new RadioButton
  1687. * @param name defines the control name
  1688. */
  1689. constructor(name?: string | undefined);
  1690. protected _getTypeName(): string;
  1691. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1692. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1693. /**
  1694. * Utility function to easily create a radio button with a header
  1695. * @param title defines the label to use for the header
  1696. * @param group defines the group to use for the radio button
  1697. * @param isChecked defines the initial state of the radio button
  1698. * @param onValueChanged defines the callback to call when value changes
  1699. * @returns a StackPanel containing the radio button and a textBlock
  1700. */
  1701. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  1702. }
  1703. }
  1704. declare module 'babylonjs-gui/2D/controls/stackPanel' {
  1705. import { Container } from "babylonjs-gui/2D/controls/container";
  1706. import { Measure } from "babylonjs-gui/2D/measure";
  1707. /**
  1708. * Class used to create a 2D stack panel container
  1709. */
  1710. export class StackPanel extends Container {
  1711. name?: string | undefined;
  1712. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1713. isVertical: boolean;
  1714. /** Gets or sets panel width */
  1715. width: string | number;
  1716. /** Gets or sets panel height */
  1717. height: string | number;
  1718. /**
  1719. * Creates a new StackPanel
  1720. * @param name defines control name
  1721. */
  1722. constructor(name?: string | undefined);
  1723. protected _getTypeName(): string;
  1724. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1725. }
  1726. }
  1727. declare module 'babylonjs-gui/2D/controls/selector' {
  1728. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  1729. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1730. /** Class used to create a RadioGroup
  1731. * which contains groups of radio buttons
  1732. */
  1733. export class SelectorGroup {
  1734. /** name of SelectorGroup */
  1735. name: string;
  1736. /**
  1737. * Creates a new SelectorGroup
  1738. * @param name of group, used as a group heading
  1739. */
  1740. constructor(
  1741. /** name of SelectorGroup */
  1742. name: string);
  1743. /** Gets the groupPanel of the SelectorGroup */
  1744. readonly groupPanel: StackPanel;
  1745. /** Gets the selectors array */
  1746. readonly selectors: StackPanel[];
  1747. /** Gets and sets the group header */
  1748. header: string;
  1749. /** @hidden*/
  1750. _getSelector(selectorNb: number): StackPanel | undefined;
  1751. /** Removes the selector at the given position
  1752. * @param selectorNb the position of the selector within the group
  1753. */
  1754. removeSelector(selectorNb: number): void;
  1755. }
  1756. /** Class used to create a CheckboxGroup
  1757. * which contains groups of checkbox buttons
  1758. */
  1759. export class CheckboxGroup extends SelectorGroup {
  1760. /** Adds a checkbox as a control
  1761. * @param text is the label for the selector
  1762. * @param func is the function called when the Selector is checked
  1763. * @param checked is true when Selector is checked
  1764. */
  1765. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  1766. /** @hidden */
  1767. _setSelectorLabel(selectorNb: number, label: string): void;
  1768. /** @hidden */
  1769. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1770. /** @hidden */
  1771. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1772. /** @hidden */
  1773. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1774. }
  1775. /** Class used to create a RadioGroup
  1776. * which contains groups of radio buttons
  1777. */
  1778. export class RadioGroup extends SelectorGroup {
  1779. /** Adds a radio button as a control
  1780. * @param label is the label for the selector
  1781. * @param func is the function called when the Selector is checked
  1782. * @param checked is true when Selector is checked
  1783. */
  1784. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  1785. /** @hidden */
  1786. _setSelectorLabel(selectorNb: number, label: string): void;
  1787. /** @hidden */
  1788. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1789. /** @hidden */
  1790. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1791. /** @hidden */
  1792. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1793. }
  1794. /** Class used to create a SliderGroup
  1795. * which contains groups of slider buttons
  1796. */
  1797. export class SliderGroup extends SelectorGroup {
  1798. /**
  1799. * Adds a slider to the SelectorGroup
  1800. * @param label is the label for the SliderBar
  1801. * @param func is the function called when the Slider moves
  1802. * @param unit is a string describing the units used, eg degrees or metres
  1803. * @param min is the minimum value for the Slider
  1804. * @param max is the maximum value for the Slider
  1805. * @param value is the start value for the Slider between min and max
  1806. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  1807. */
  1808. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  1809. /** @hidden */
  1810. _setSelectorLabel(selectorNb: number, label: string): void;
  1811. /** @hidden */
  1812. _setSelectorLabelColor(selectorNb: number, color: string): void;
  1813. /** @hidden */
  1814. _setSelectorButtonColor(selectorNb: number, color: string): void;
  1815. /** @hidden */
  1816. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  1817. }
  1818. /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
  1819. export class SelectionPanel extends Rectangle {
  1820. /** name of SelectionPanel */
  1821. name: string;
  1822. /** an array of SelectionGroups */
  1823. groups: SelectorGroup[];
  1824. /**
  1825. * Creates a new SelectionPanel
  1826. * @param name of SelectionPanel
  1827. * @param groups is an array of SelectionGroups
  1828. */
  1829. constructor(
  1830. /** name of SelectionPanel */
  1831. name: string,
  1832. /** an array of SelectionGroups */
  1833. groups?: SelectorGroup[]);
  1834. protected _getTypeName(): string;
  1835. /** Gets or sets the headerColor */
  1836. headerColor: string;
  1837. /** Gets or sets the button color */
  1838. buttonColor: string;
  1839. /** Gets or sets the label color */
  1840. labelColor: string;
  1841. /** Gets or sets the button background */
  1842. buttonBackground: string;
  1843. /** Gets or sets the color of separator bar */
  1844. barColor: string;
  1845. /** Add a group to the selection panel
  1846. * @param group is the selector group to add
  1847. */
  1848. addGroup(group: SelectorGroup): void;
  1849. /** Remove the group from the given position
  1850. * @param groupNb is the position of the group in the list
  1851. */
  1852. removeGroup(groupNb: number): void;
  1853. /** Change a group header label
  1854. * @param label is the new group header label
  1855. * @param groupNb is the number of the group to relabel
  1856. * */
  1857. setHeaderName(label: string, groupNb: number): void;
  1858. /** Change selector label to the one given
  1859. * @param label is the new selector label
  1860. * @param groupNb is the number of the groupcontaining the selector
  1861. * @param selectorNb is the number of the selector within a group to relabel
  1862. * */
  1863. relabel(label: string, groupNb: number, selectorNb: number): void;
  1864. /** For a given group position remove the selector at the given position
  1865. * @param groupNb is the number of the group to remove the selector from
  1866. * @param selectorNb is the number of the selector within the group
  1867. */
  1868. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  1869. /** For a given group position of correct type add a checkbox button
  1870. * @param groupNb is the number of the group to remove the selector from
  1871. * @param label is the label for the selector
  1872. * @param func is the function called when the Selector is checked
  1873. * @param checked is true when Selector is checked
  1874. */
  1875. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  1876. /** For a given group position of correct type add a radio button
  1877. * @param groupNb is the number of the group to remove the selector from
  1878. * @param label is the label for the selector
  1879. * @param func is the function called when the Selector is checked
  1880. * @param checked is true when Selector is checked
  1881. */
  1882. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  1883. /**
  1884. * For a given slider group add a slider
  1885. * @param groupNb is the number of the group to add the slider to
  1886. * @param label is the label for the Slider
  1887. * @param func is the function called when the Slider moves
  1888. * @param unit is a string describing the units used, eg degrees or metres
  1889. * @param min is the minimum value for the Slider
  1890. * @param max is the maximum value for the Slider
  1891. * @param value is the start value for the Slider between min and max
  1892. * @param onVal is the function used to format the value displayed, eg radians to degrees
  1893. */
  1894. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  1895. }
  1896. }
  1897. declare module 'babylonjs-gui/2D/controls/textBlock' {
  1898. import { Observable } from "babylonjs";
  1899. import { Measure } from "babylonjs-gui/2D/measure";
  1900. import { Control } from "babylonjs-gui/2D/controls/control";
  1901. /**
  1902. * Enum that determines the text-wrapping mode to use.
  1903. */
  1904. export enum TextWrapping {
  1905. /**
  1906. * Clip the text when it's larger than Control.width; this is the default mode.
  1907. */
  1908. Clip = 0,
  1909. /**
  1910. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1911. */
  1912. WordWrap = 1,
  1913. /**
  1914. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1915. */
  1916. Ellipsis = 2
  1917. }
  1918. /**
  1919. * Class used to create text block control
  1920. */
  1921. export class TextBlock extends Control {
  1922. /**
  1923. * Defines the name of the control
  1924. */
  1925. name?: string | undefined;
  1926. /**
  1927. * An event triggered after the text is changed
  1928. */
  1929. onTextChangedObservable: Observable<TextBlock>;
  1930. /**
  1931. * An event triggered after the text was broken up into lines
  1932. */
  1933. onLinesReadyObservable: Observable<TextBlock>;
  1934. /**
  1935. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1936. */
  1937. readonly lines: any[];
  1938. /**
  1939. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1940. */
  1941. resizeToFit: boolean;
  1942. /**
  1943. * Gets or sets a boolean indicating if text must be wrapped
  1944. */
  1945. textWrapping: TextWrapping | boolean;
  1946. /**
  1947. * Gets or sets text to display
  1948. */
  1949. text: string;
  1950. /**
  1951. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1952. */
  1953. textHorizontalAlignment: number;
  1954. /**
  1955. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1956. */
  1957. textVerticalAlignment: number;
  1958. /**
  1959. * Gets or sets line spacing value
  1960. */
  1961. lineSpacing: string | number;
  1962. /**
  1963. * Gets or sets outlineWidth of the text to display
  1964. */
  1965. outlineWidth: number;
  1966. /**
  1967. * Gets or sets outlineColor of the text to display
  1968. */
  1969. outlineColor: string;
  1970. /**
  1971. * Creates a new TextBlock object
  1972. * @param name defines the name of the control
  1973. * @param text defines the text to display (emptry string by default)
  1974. */
  1975. constructor(
  1976. /**
  1977. * Defines the name of the control
  1978. */
  1979. name?: string | undefined, text?: string);
  1980. protected _getTypeName(): string;
  1981. /** @hidden */
  1982. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1983. protected _applyStates(context: CanvasRenderingContext2D): void;
  1984. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1985. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1986. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1987. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1988. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1989. protected _renderLines(context: CanvasRenderingContext2D): void;
  1990. /**
  1991. * Given a width constraint applied on the text block, find the expected height
  1992. * @returns expected height
  1993. */
  1994. computeExpectedHeight(): number;
  1995. dispose(): void;
  1996. }
  1997. }
  1998. declare module 'babylonjs-gui/2D/controls/virtualKeyboard' {
  1999. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2000. import { Observable, Nullable } from "babylonjs";
  2001. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  2002. /**
  2003. * Class used to store key control properties
  2004. */
  2005. export class KeyPropertySet {
  2006. /** Width */
  2007. width?: string;
  2008. /** Height */
  2009. height?: string;
  2010. /** Left padding */
  2011. paddingLeft?: string;
  2012. /** Right padding */
  2013. paddingRight?: string;
  2014. /** Top padding */
  2015. paddingTop?: string;
  2016. /** Bottom padding */
  2017. paddingBottom?: string;
  2018. /** Foreground color */
  2019. color?: string;
  2020. /** Background color */
  2021. background?: string;
  2022. }
  2023. /**
  2024. * Class used to create virtual keyboard
  2025. */
  2026. export class VirtualKeyboard extends StackPanel {
  2027. /** Observable raised when a key is pressed */
  2028. onKeyPressObservable: Observable<string>;
  2029. /** Gets or sets default key button width */
  2030. defaultButtonWidth: string;
  2031. /** Gets or sets default key button height */
  2032. defaultButtonHeight: string;
  2033. /** Gets or sets default key button left padding */
  2034. defaultButtonPaddingLeft: string;
  2035. /** Gets or sets default key button right padding */
  2036. defaultButtonPaddingRight: string;
  2037. /** Gets or sets default key button top padding */
  2038. defaultButtonPaddingTop: string;
  2039. /** Gets or sets default key button bottom padding */
  2040. defaultButtonPaddingBottom: string;
  2041. /** Gets or sets default key button foreground color */
  2042. defaultButtonColor: string;
  2043. /** Gets or sets default key button background color */
  2044. defaultButtonBackground: string;
  2045. /** Gets or sets shift button foreground color */
  2046. shiftButtonColor: string;
  2047. /** Gets or sets shift button thickness*/
  2048. selectedShiftThickness: number;
  2049. /** Gets shift key state */
  2050. shiftState: number;
  2051. protected _getTypeName(): string;
  2052. /**
  2053. * Adds a new row of keys
  2054. * @param keys defines the list of keys to add
  2055. * @param propertySets defines the associated property sets
  2056. */
  2057. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2058. /**
  2059. * Set the shift key to a specific state
  2060. * @param shiftState defines the new shift state
  2061. */
  2062. applyShiftState(shiftState: number): void;
  2063. /** Gets the input text control currently attached to the keyboard */
  2064. readonly connectedInputText: Nullable<InputText>;
  2065. /**
  2066. * Connects the keyboard with an input text control
  2067. *
  2068. * @param input defines the target control
  2069. */
  2070. connect(input: InputText): void;
  2071. /**
  2072. * Disconnects the keyboard from connected InputText controls
  2073. *
  2074. * @param input optionally defines a target control, otherwise all are disconnected
  2075. */
  2076. disconnect(input?: InputText): void;
  2077. /**
  2078. * Release all resources
  2079. */
  2080. dispose(): void;
  2081. /**
  2082. * Creates a new keyboard using a default layout
  2083. *
  2084. * @param name defines control name
  2085. * @returns a new VirtualKeyboard
  2086. */
  2087. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2088. }
  2089. }
  2090. declare module 'babylonjs-gui/2D/controls/slider' {
  2091. import { Control } from "babylonjs-gui/2D/controls/control";
  2092. import { Observable, Vector2 } from "babylonjs";
  2093. import { Measure } from "babylonjs-gui/2D/measure";
  2094. /**
  2095. * Class used to create slider controls
  2096. */
  2097. export class Slider extends Control {
  2098. name?: string | undefined;
  2099. /** Observable raised when the sldier value changes */
  2100. onValueChangedObservable: Observable<number>;
  2101. /** Gets or sets border color */
  2102. borderColor: string;
  2103. /** Gets or sets background color */
  2104. background: string;
  2105. /** Gets or sets main bar offset */
  2106. barOffset: string | number;
  2107. /** Gets main bar offset in pixels*/
  2108. readonly barOffsetInPixels: number;
  2109. /** Gets or sets thumb width */
  2110. thumbWidth: string | number;
  2111. /** Gets thumb width in pixels */
  2112. readonly thumbWidthInPixels: number;
  2113. /** Gets or sets minimum value */
  2114. minimum: number;
  2115. /** Gets or sets maximum value */
  2116. maximum: number;
  2117. /** Gets or sets current value */
  2118. value: number;
  2119. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2120. isVertical: boolean;
  2121. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2122. isThumbCircle: boolean;
  2123. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2124. isThumbClamped: boolean;
  2125. /**
  2126. * Creates a new Slider
  2127. * @param name defines the control name
  2128. */
  2129. constructor(name?: string | undefined);
  2130. protected _getTypeName(): string;
  2131. protected _getThumbThickness(type: string, backgroundLength: number): number;
  2132. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2133. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2134. _onPointerMove(target: Control, coordinates: Vector2): void;
  2135. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2136. }
  2137. }
  2138. declare module 'babylonjs-gui/2D/controls/rectangle' {
  2139. import { Container } from "babylonjs-gui/2D/controls/container";
  2140. import { Measure } from "babylonjs-gui/2D/measure";
  2141. /** Class used to create rectangle container */
  2142. export class Rectangle extends Container {
  2143. name?: string | undefined;
  2144. /** Gets or sets border thickness */
  2145. thickness: number;
  2146. /** Gets or sets the corner radius angle */
  2147. cornerRadius: number;
  2148. /**
  2149. * Creates a new Rectangle
  2150. * @param name defines the control name
  2151. */
  2152. constructor(name?: string | undefined);
  2153. protected _getTypeName(): string;
  2154. protected _localDraw(context: CanvasRenderingContext2D): void;
  2155. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2156. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2157. }
  2158. }
  2159. declare module 'babylonjs-gui/2D/controls/displayGrid' {
  2160. import { Control } from "babylonjs-gui/2D/controls";
  2161. import { Measure } from "babylonjs-gui/2D";
  2162. /** Class used to render a grid */
  2163. export class DisplayGrid extends Control {
  2164. name?: string | undefined;
  2165. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  2166. displayMinorLines: boolean;
  2167. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  2168. displayMajorLines: boolean;
  2169. /** Gets or sets background color (Black by default) */
  2170. background: string;
  2171. /** Gets or sets the width of each cell (20 by default) */
  2172. cellWidth: number;
  2173. /** Gets or sets the height of each cell (20 by default) */
  2174. cellHeight: number;
  2175. /** Gets or sets the tickness of minor lines (1 by default) */
  2176. minorLineTickness: number;
  2177. /** Gets or sets the color of minor lines (DarkGray by default) */
  2178. minorLineColor: string;
  2179. /** Gets or sets the tickness of major lines (2 by default) */
  2180. majorLineTickness: number;
  2181. /** Gets or sets the color of major lines (White by default) */
  2182. majorLineColor: string;
  2183. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  2184. majorLineFrequency: number;
  2185. /**
  2186. * Creates a new GridDisplayRectangle
  2187. * @param name defines the control name
  2188. */
  2189. constructor(name?: string | undefined);
  2190. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2191. protected _getTypeName(): string;
  2192. }
  2193. }
  2194. declare module 'babylonjs-gui/2D/controls/statics' {
  2195. /**
  2196. * Forcing an export so that this code will execute
  2197. * @hidden
  2198. */
  2199. const name = "Statics";
  2200. export { name };
  2201. }
  2202. declare module 'babylonjs-gui/3D/controls/abstractButton3D' {
  2203. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2204. import { TransformNode, Scene } from "babylonjs";
  2205. /**
  2206. * Class used as a root to all buttons
  2207. */
  2208. export class AbstractButton3D extends Control3D {
  2209. /**
  2210. * Creates a new button
  2211. * @param name defines the control name
  2212. */
  2213. constructor(name?: string);
  2214. protected _getTypeName(): string;
  2215. protected _createNode(scene: Scene): TransformNode;
  2216. }
  2217. }
  2218. declare module 'babylonjs-gui/3D/controls/button3D' {
  2219. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  2220. import { Material, int, Scene, TransformNode, AbstractMesh } from "babylonjs";
  2221. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2222. import { Control } from "babylonjs-gui/2D/controls/control";
  2223. /**
  2224. * Class used to create a button in 3D
  2225. */
  2226. export class Button3D extends AbstractButton3D {
  2227. /** @hidden */
  2228. protected _currentMaterial: Material;
  2229. /**
  2230. * Gets or sets the texture resolution used to render content (512 by default)
  2231. */
  2232. contentResolution: int;
  2233. /**
  2234. * Gets or sets the texture scale ratio used to render content (2 by default)
  2235. */
  2236. contentScaleRatio: number;
  2237. protected _disposeFacadeTexture(): void;
  2238. protected _resetContent(): void;
  2239. /**
  2240. * Creates a new button
  2241. * @param name defines the control name
  2242. */
  2243. constructor(name?: string);
  2244. /**
  2245. * Gets or sets the GUI 2D content used to display the button's facade
  2246. */
  2247. content: Control;
  2248. /**
  2249. * Apply the facade texture (created from the content property).
  2250. * This function can be overloaded by child classes
  2251. * @param facadeTexture defines the AdvancedDynamicTexture to use
  2252. */
  2253. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2254. protected _getTypeName(): string;
  2255. protected _createNode(scene: Scene): TransformNode;
  2256. protected _affectMaterial(mesh: AbstractMesh): void;
  2257. /**
  2258. * Releases all associated resources
  2259. */
  2260. dispose(): void;
  2261. }
  2262. }
  2263. declare module 'babylonjs-gui/3D/controls/container3D' {
  2264. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2265. import { Scene, Nullable, TransformNode } from "babylonjs";
  2266. /**
  2267. * Class used to create containers for controls
  2268. */
  2269. export class Container3D extends Control3D {
  2270. /**
  2271. * Gets the list of child controls
  2272. */
  2273. protected _children: Control3D[];
  2274. /**
  2275. * Gets the list of child controls
  2276. */
  2277. readonly children: Array<Control3D>;
  2278. /**
  2279. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2280. * This is helpful to optimize layout operation when adding multiple children in a row
  2281. */
  2282. blockLayout: boolean;
  2283. /**
  2284. * Creates a new container
  2285. * @param name defines the container name
  2286. */
  2287. constructor(name?: string);
  2288. /**
  2289. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2290. * @returns the current container
  2291. */
  2292. updateLayout(): Container3D;
  2293. /**
  2294. * Gets a boolean indicating if the given control is in the children of this control
  2295. * @param control defines the control to check
  2296. * @returns true if the control is in the child list
  2297. */
  2298. containsControl(control: Control3D): boolean;
  2299. /**
  2300. * Adds a control to the children of this control
  2301. * @param control defines the control to add
  2302. * @returns the current container
  2303. */
  2304. addControl(control: Control3D): Container3D;
  2305. /**
  2306. * This function will be called everytime a new control is added
  2307. */
  2308. protected _arrangeChildren(): void;
  2309. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2310. /**
  2311. * Removes a control from the children of this control
  2312. * @param control defines the control to remove
  2313. * @returns the current container
  2314. */
  2315. removeControl(control: Control3D): Container3D;
  2316. protected _getTypeName(): string;
  2317. /**
  2318. * Releases all associated resources
  2319. */
  2320. dispose(): void;
  2321. /** Control rotation will remain unchanged */
  2322. static readonly UNSET_ORIENTATION: number;
  2323. /** Control will rotate to make it look at sphere central axis */
  2324. static readonly FACEORIGIN_ORIENTATION: number;
  2325. /** Control will rotate to make it look back at sphere central axis */
  2326. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2327. /** Control will rotate to look at z axis (0, 0, 1) */
  2328. static readonly FACEFORWARD_ORIENTATION: number;
  2329. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2330. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2331. }
  2332. }
  2333. declare module 'babylonjs-gui/3D/controls/control3D' {
  2334. import { IDisposable, IBehaviorAware, Nullable, TransformNode, Vector3, Observable, Behavior, AbstractMesh, Scene } from "babylonjs";
  2335. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  2336. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  2337. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2338. /**
  2339. * Class used as base class for controls
  2340. */
  2341. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  2342. /** Defines the control name */
  2343. name?: string | undefined;
  2344. /** @hidden */
  2345. _host: GUI3DManager;
  2346. /** Gets or sets the control position in world space */
  2347. position: Vector3;
  2348. /** Gets or sets the control scaling in world space */
  2349. scaling: Vector3;
  2350. /** Callback used to start pointer enter animation */
  2351. pointerEnterAnimation: () => void;
  2352. /** Callback used to start pointer out animation */
  2353. pointerOutAnimation: () => void;
  2354. /** Callback used to start pointer down animation */
  2355. pointerDownAnimation: () => void;
  2356. /** Callback used to start pointer up animation */
  2357. pointerUpAnimation: () => void;
  2358. /**
  2359. * An event triggered when the pointer move over the control
  2360. */
  2361. onPointerMoveObservable: Observable<Vector3>;
  2362. /**
  2363. * An event triggered when the pointer move out of the control
  2364. */
  2365. onPointerOutObservable: Observable<Control3D>;
  2366. /**
  2367. * An event triggered when the pointer taps the control
  2368. */
  2369. onPointerDownObservable: Observable<Vector3WithInfo>;
  2370. /**
  2371. * An event triggered when pointer is up
  2372. */
  2373. onPointerUpObservable: Observable<Vector3WithInfo>;
  2374. /**
  2375. * An event triggered when a control is clicked on (with a mouse)
  2376. */
  2377. onPointerClickObservable: Observable<Vector3WithInfo>;
  2378. /**
  2379. * An event triggered when pointer enters the control
  2380. */
  2381. onPointerEnterObservable: Observable<Control3D>;
  2382. /**
  2383. * Gets or sets the parent container
  2384. */
  2385. parent: Nullable<Container3D>;
  2386. /**
  2387. * Gets the list of attached behaviors
  2388. * @see http://doc.babylonjs.com/features/behaviour
  2389. */
  2390. readonly behaviors: Behavior<Control3D>[];
  2391. /**
  2392. * Attach a behavior to the control
  2393. * @see http://doc.babylonjs.com/features/behaviour
  2394. * @param behavior defines the behavior to attach
  2395. * @returns the current control
  2396. */
  2397. addBehavior(behavior: Behavior<Control3D>): Control3D;
  2398. /**
  2399. * Remove an attached behavior
  2400. * @see http://doc.babylonjs.com/features/behaviour
  2401. * @param behavior defines the behavior to attach
  2402. * @returns the current control
  2403. */
  2404. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  2405. /**
  2406. * Gets an attached behavior by name
  2407. * @param name defines the name of the behavior to look for
  2408. * @see http://doc.babylonjs.com/features/behaviour
  2409. * @returns null if behavior was not found else the requested behavior
  2410. */
  2411. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  2412. /** Gets or sets a boolean indicating if the control is visible */
  2413. isVisible: boolean;
  2414. /**
  2415. * Creates a new control
  2416. * @param name defines the control name
  2417. */
  2418. constructor(
  2419. /** Defines the control name */
  2420. name?: string | undefined);
  2421. /**
  2422. * Gets a string representing the class name
  2423. */
  2424. readonly typeName: string;
  2425. protected _getTypeName(): string;
  2426. /**
  2427. * Gets the transform node used by this control
  2428. */
  2429. readonly node: Nullable<TransformNode>;
  2430. /**
  2431. * Gets the mesh used to render this control
  2432. */
  2433. readonly mesh: Nullable<AbstractMesh>;
  2434. /**
  2435. * Link the control as child of the given node
  2436. * @param node defines the node to link to. Use null to unlink the control
  2437. * @returns the current control
  2438. */
  2439. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  2440. /** @hidden **/
  2441. _prepareNode(scene: Scene): void;
  2442. /**
  2443. * Node creation.
  2444. * Can be overriden by children
  2445. * @param scene defines the scene where the node must be attached
  2446. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  2447. */
  2448. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2449. /**
  2450. * Affect a material to the given mesh
  2451. * @param mesh defines the mesh which will represent the control
  2452. */
  2453. protected _affectMaterial(mesh: AbstractMesh): void;
  2454. /** @hidden */
  2455. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  2456. /** @hidden */
  2457. _onPointerEnter(target: Control3D): boolean;
  2458. /** @hidden */
  2459. _onPointerOut(target: Control3D): void;
  2460. /** @hidden */
  2461. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  2462. /** @hidden */
  2463. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2464. /** @hidden */
  2465. forcePointerUp(pointerId?: Nullable<number>): void;
  2466. /** @hidden */
  2467. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  2468. /** @hidden */
  2469. _disposeNode(): void;
  2470. /**
  2471. * Releases all associated resources
  2472. */
  2473. dispose(): void;
  2474. }
  2475. }
  2476. declare module 'babylonjs-gui/3D/controls/cylinderPanel' {
  2477. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2478. import { float, Vector3 } from "babylonjs";
  2479. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2480. /**
  2481. * Class used to create a container panel deployed on the surface of a cylinder
  2482. */
  2483. export class CylinderPanel extends VolumeBasedPanel {
  2484. /**
  2485. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2486. */
  2487. radius: float;
  2488. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2489. }
  2490. }
  2491. declare module 'babylonjs-gui/3D/controls/holographicButton' {
  2492. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2493. import { Mesh, StandardMaterial, Nullable, Scene, TransformNode } from "babylonjs";
  2494. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  2495. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2496. /**
  2497. * Class used to create a holographic button in 3D
  2498. */
  2499. export class HolographicButton extends Button3D {
  2500. /**
  2501. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  2502. */
  2503. tooltipText: Nullable<string>;
  2504. /**
  2505. * Gets or sets text for the button
  2506. */
  2507. text: string;
  2508. /**
  2509. * Gets or sets the image url for the button
  2510. */
  2511. imageUrl: string;
  2512. /**
  2513. * Gets the back material used by this button
  2514. */
  2515. readonly backMaterial: FluentMaterial;
  2516. /**
  2517. * Gets the front material used by this button
  2518. */
  2519. readonly frontMaterial: FluentMaterial;
  2520. /**
  2521. * Gets the plate material used by this button
  2522. */
  2523. readonly plateMaterial: StandardMaterial;
  2524. /**
  2525. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2526. */
  2527. readonly shareMaterials: boolean;
  2528. /**
  2529. * Creates a new button
  2530. * @param name defines the control name
  2531. */
  2532. constructor(name?: string, shareMaterials?: boolean);
  2533. protected _getTypeName(): string;
  2534. protected _createNode(scene: Scene): TransformNode;
  2535. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2536. protected _affectMaterial(mesh: Mesh): void;
  2537. /**
  2538. * Releases all associated resources
  2539. */
  2540. dispose(): void;
  2541. }
  2542. }
  2543. declare module 'babylonjs-gui/3D/controls/meshButton3D' {
  2544. import { Scene, TransformNode, AbstractMesh, Mesh } from "babylonjs";
  2545. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2546. /**
  2547. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2548. */
  2549. export class MeshButton3D extends Button3D {
  2550. /** @hidden */
  2551. protected _currentMesh: Mesh;
  2552. /**
  2553. * Creates a new 3D button based on a mesh
  2554. * @param mesh mesh to become a 3D button
  2555. * @param name defines the control name
  2556. */
  2557. constructor(mesh: Mesh, name?: string);
  2558. protected _getTypeName(): string;
  2559. protected _createNode(scene: Scene): TransformNode;
  2560. protected _affectMaterial(mesh: AbstractMesh): void;
  2561. }
  2562. }
  2563. declare module 'babylonjs-gui/3D/controls/planePanel' {
  2564. import { Vector3 } from "babylonjs";
  2565. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2566. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2567. /**
  2568. * Class used to create a container panel deployed on the surface of a plane
  2569. */
  2570. export class PlanePanel extends VolumeBasedPanel {
  2571. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2572. }
  2573. }
  2574. declare module 'babylonjs-gui/3D/controls/scatterPanel' {
  2575. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2576. import { float, Vector3 } from "babylonjs";
  2577. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2578. /**
  2579. * Class used to create a container panel where items get randomized planar mapping
  2580. */
  2581. export class ScatterPanel extends VolumeBasedPanel {
  2582. /**
  2583. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2584. */
  2585. iteration: float;
  2586. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2587. protected _finalProcessing(): void;
  2588. }
  2589. }
  2590. declare module 'babylonjs-gui/3D/controls/spherePanel' {
  2591. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2592. import { float, Vector3 } from "babylonjs";
  2593. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2594. /**
  2595. * Class used to create a container panel deployed on the surface of a sphere
  2596. */
  2597. export class SpherePanel extends VolumeBasedPanel {
  2598. /**
  2599. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2600. */
  2601. radius: float;
  2602. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2603. }
  2604. }
  2605. declare module 'babylonjs-gui/3D/controls/stackPanel3D' {
  2606. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2607. /**
  2608. * Class used to create a stack panel in 3D on XY plane
  2609. */
  2610. export class StackPanel3D extends Container3D {
  2611. /**
  2612. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  2613. */
  2614. isVertical: boolean;
  2615. /**
  2616. * Gets or sets the distance between elements
  2617. */
  2618. margin: number;
  2619. /**
  2620. * Creates new StackPanel
  2621. * @param isVertical
  2622. */
  2623. constructor(isVertical?: boolean);
  2624. protected _arrangeChildren(): void;
  2625. }
  2626. }
  2627. declare module 'babylonjs-gui/3D/controls/volumeBasedPanel' {
  2628. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2629. import { int, Vector3 } from "babylonjs";
  2630. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2631. /**
  2632. * Abstract class used to create a container panel deployed on the surface of a volume
  2633. */
  2634. export abstract class VolumeBasedPanel extends Container3D {
  2635. protected _cellWidth: number;
  2636. protected _cellHeight: number;
  2637. /**
  2638. * Gets or sets the distance between elements
  2639. */
  2640. margin: number;
  2641. /**
  2642. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  2643. * | Value | Type | Description |
  2644. * | ----- | ----------------------------------- | ----------- |
  2645. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  2646. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  2647. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  2648. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  2649. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  2650. */
  2651. orientation: number;
  2652. /**
  2653. * Gets or sets the number of columns requested (10 by default).
  2654. * The panel will automatically compute the number of rows based on number of child controls.
  2655. */
  2656. columns: int;
  2657. /**
  2658. * Gets or sets a the number of rows requested.
  2659. * The panel will automatically compute the number of columns based on number of child controls.
  2660. */
  2661. rows: int;
  2662. /**
  2663. * Creates new VolumeBasedPanel
  2664. */
  2665. constructor();
  2666. protected _arrangeChildren(): void;
  2667. /** Child classes must implement this function to provide correct control positioning */
  2668. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2669. /** Child classes can implement this function to provide additional processing */
  2670. protected _finalProcessing(): void;
  2671. }
  2672. }
  2673. declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
  2674. import { MaterialDefines, PushMaterial, Color3, Color4, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, Matrix, Mesh } from "babylonjs";
  2675. /** @hidden */
  2676. export class FluentMaterialDefines extends MaterialDefines {
  2677. INNERGLOW: boolean;
  2678. BORDER: boolean;
  2679. HOVERLIGHT: boolean;
  2680. TEXTURE: boolean;
  2681. constructor();
  2682. }
  2683. /**
  2684. * Class used to render controls with fluent desgin
  2685. */
  2686. export class FluentMaterial extends PushMaterial {
  2687. /**
  2688. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  2689. */
  2690. innerGlowColorIntensity: number;
  2691. /**
  2692. * Gets or sets the inner glow color (white by default)
  2693. */
  2694. innerGlowColor: Color3;
  2695. /**
  2696. * Gets or sets alpha value (default is 1.0)
  2697. */
  2698. alpha: number;
  2699. /**
  2700. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  2701. */
  2702. albedoColor: Color3;
  2703. /**
  2704. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  2705. */
  2706. renderBorders: boolean;
  2707. /**
  2708. * Gets or sets border width (default is 0.5)
  2709. */
  2710. borderWidth: number;
  2711. /**
  2712. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  2713. */
  2714. edgeSmoothingValue: number;
  2715. /**
  2716. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  2717. */
  2718. borderMinValue: number;
  2719. /**
  2720. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  2721. */
  2722. renderHoverLight: boolean;
  2723. /**
  2724. * Gets or sets the radius used to render the hover light (default is 1.0)
  2725. */
  2726. hoverRadius: number;
  2727. /**
  2728. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  2729. */
  2730. hoverColor: Color4;
  2731. /**
  2732. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  2733. */
  2734. hoverPosition: Vector3;
  2735. /** Gets or sets the texture to use for albedo color */
  2736. albedoTexture: Nullable<BaseTexture>;
  2737. /**
  2738. * Creates a new Fluent material
  2739. * @param name defines the name of the material
  2740. * @param scene defines the hosting scene
  2741. */
  2742. constructor(name: string, scene: Scene);
  2743. needAlphaBlending(): boolean;
  2744. needAlphaTesting(): boolean;
  2745. getAlphaTestTexture(): Nullable<BaseTexture>;
  2746. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  2747. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  2748. getActiveTextures(): BaseTexture[];
  2749. hasTexture(texture: BaseTexture): boolean;
  2750. dispose(forceDisposeEffect?: boolean): void;
  2751. clone(name: string): FluentMaterial;
  2752. serialize(): any;
  2753. getClassName(): string;
  2754. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  2755. }
  2756. }
  2757. /*BabylonJS GUI*/
  2758. // Dependencies for this module:
  2759. // ../../../../tools/Gulp/babylonjs
  2760. declare module BABYLON.GUI {
  2761. }
  2762. declare module BABYLON.GUI {
  2763. }
  2764. declare module BABYLON.GUI {
  2765. }
  2766. declare module BABYLON.GUI {
  2767. }
  2768. declare module BABYLON.GUI {
  2769. /**
  2770. * Interface used to define a control that can receive focus
  2771. */
  2772. export interface IFocusableControl {
  2773. /**
  2774. * Function called when the control receives the focus
  2775. */
  2776. onFocus(): void;
  2777. /**
  2778. * Function called when the control loses the focus
  2779. */
  2780. onBlur(): void;
  2781. /**
  2782. * Function called to let the control handle keyboard events
  2783. * @param evt defines the current keyboard event
  2784. */
  2785. processKeyboard(evt: KeyboardEvent): void;
  2786. /**
  2787. * Function called to get the list of controls that should not steal the focus from this control
  2788. * @returns an array of controls
  2789. */
  2790. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  2791. }
  2792. /**
  2793. * Class used to create texture to support 2D GUI elements
  2794. * @see http://doc.babylonjs.com/how_to/gui
  2795. */
  2796. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  2797. /** @hidden */
  2798. _rootContainer: Container;
  2799. /** @hidden */
  2800. _lastPickedControl: Control;
  2801. /** @hidden */
  2802. _lastControlOver: {
  2803. [pointerId: number]: Control;
  2804. };
  2805. /** @hidden */
  2806. _lastControlDown: {
  2807. [pointerId: number]: Control;
  2808. };
  2809. /** @hidden */
  2810. _capturingControl: {
  2811. [pointerId: number]: Control;
  2812. };
  2813. /** @hidden */
  2814. _shouldBlockPointer: boolean;
  2815. /** @hidden */
  2816. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  2817. /** @hidden */
  2818. _linkedControls: Control[];
  2819. /**
  2820. * Gets or sets a boolean defining if alpha is stored as premultiplied
  2821. */
  2822. premulAlpha: boolean;
  2823. /**
  2824. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  2825. * Useful when you want more antialiasing
  2826. */
  2827. renderScale: number;
  2828. /** Gets or sets the background color */
  2829. background: string;
  2830. /**
  2831. * Gets or sets the ideal width used to design controls.
  2832. * The GUI will then rescale everything accordingly
  2833. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2834. */
  2835. idealWidth: number;
  2836. /**
  2837. * Gets or sets the ideal height used to design controls.
  2838. * The GUI will then rescale everything accordingly
  2839. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2840. */
  2841. idealHeight: number;
  2842. /**
  2843. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  2844. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2845. */
  2846. useSmallestIdeal: boolean;
  2847. /**
  2848. * Gets or sets a boolean indicating if adaptive scaling must be used
  2849. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2850. */
  2851. renderAtIdealSize: boolean;
  2852. /**
  2853. * Gets the underlying layer used to render the texture when in fullscreen mode
  2854. */
  2855. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  2856. /**
  2857. * Gets the root container control
  2858. */
  2859. readonly rootContainer: Container;
  2860. /**
  2861. * Gets or sets the current focused control
  2862. */
  2863. focusedControl: BABYLON.Nullable<IFocusableControl>;
  2864. /**
  2865. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  2866. */
  2867. isForeground: boolean;
  2868. /**
  2869. * Creates a new AdvancedDynamicTexture
  2870. * @param name defines the name of the texture
  2871. * @param width defines the width of the texture
  2872. * @param height defines the height of the texture
  2873. * @param scene defines the hosting scene
  2874. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  2875. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  2876. */
  2877. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  2878. /**
  2879. * Function used to execute a function on all controls
  2880. * @param func defines the function to execute
  2881. * @param container defines the container where controls belong. If null the root container will be used
  2882. */
  2883. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  2884. /**
  2885. * Marks the texture as dirty forcing a complete update
  2886. */
  2887. markAsDirty(): void;
  2888. /**
  2889. * Helper function used to create a new style
  2890. * @returns a new style
  2891. * @see http://doc.babylonjs.com/how_to/gui#styles
  2892. */
  2893. createStyle(): Style;
  2894. /**
  2895. * Adds a new control to the root container
  2896. * @param control defines the control to add
  2897. * @returns the current texture
  2898. */
  2899. addControl(control: Control): AdvancedDynamicTexture;
  2900. /**
  2901. * Removes a control from the root container
  2902. * @param control defines the control to remove
  2903. * @returns the current texture
  2904. */
  2905. removeControl(control: Control): AdvancedDynamicTexture;
  2906. /**
  2907. * Release all resources
  2908. */
  2909. dispose(): void;
  2910. /** @hidden */
  2911. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  2912. /**
  2913. * Get screen coordinates for a vector3
  2914. * @param position defines the position to project
  2915. * @param worldMatrix defines the world matrix to use
  2916. * @returns the projected position
  2917. */
  2918. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  2919. /** @hidden */
  2920. _changeCursor(cursor: string): void;
  2921. /** @hidden */
  2922. _cleanControlAfterRemovalFromList(list: {
  2923. [pointerId: number]: Control;
  2924. }, control: Control): void;
  2925. /** @hidden */
  2926. _cleanControlAfterRemoval(control: Control): void;
  2927. /** Attach to all scene events required to support pointer events */
  2928. attach(): void;
  2929. /**
  2930. * Connect the texture to a hosting mesh to enable interactions
  2931. * @param mesh defines the mesh to attach to
  2932. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  2933. */
  2934. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  2935. /**
  2936. * Move the focus to a specific control
  2937. * @param control defines the control which will receive the focus
  2938. */
  2939. moveFocusToControl(control: IFocusableControl): void;
  2940. /**
  2941. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  2942. * @param mesh defines the mesh which will receive the texture
  2943. * @param width defines the texture width (1024 by default)
  2944. * @param height defines the texture height (1024 by default)
  2945. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  2946. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  2947. * @returns a new AdvancedDynamicTexture
  2948. */
  2949. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  2950. /**
  2951. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  2952. * In this mode the texture will rely on a layer for its rendering.
  2953. * This allows it to be treated like any other layer.
  2954. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  2955. * LayerMask is set through advancedTexture.layer.layerMask
  2956. * @param name defines name for the texture
  2957. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  2958. * @param scene defines the hsoting scene
  2959. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  2960. * @returns a new AdvancedDynamicTexture
  2961. */
  2962. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  2963. }
  2964. }
  2965. declare module BABYLON.GUI {
  2966. /**
  2967. * Class used to transport BABYLON.Vector2 information for pointer events
  2968. */
  2969. export class Vector2WithInfo extends BABYLON.Vector2 {
  2970. /** defines the current mouse button index */
  2971. buttonIndex: number;
  2972. /**
  2973. * Creates a new Vector2WithInfo
  2974. * @param source defines the vector2 data to transport
  2975. * @param buttonIndex defines the current mouse button index
  2976. */
  2977. constructor(source: BABYLON.Vector2,
  2978. /** defines the current mouse button index */
  2979. buttonIndex?: number);
  2980. }
  2981. /** Class used to provide 2D matrix features */
  2982. export class Matrix2D {
  2983. /** Gets the internal array of 6 floats used to store matrix data */
  2984. m: Float32Array;
  2985. /**
  2986. * Creates a new matrix
  2987. * @param m00 defines value for (0, 0)
  2988. * @param m01 defines value for (0, 1)
  2989. * @param m10 defines value for (1, 0)
  2990. * @param m11 defines value for (1, 1)
  2991. * @param m20 defines value for (2, 0)
  2992. * @param m21 defines value for (2, 1)
  2993. */
  2994. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  2995. /**
  2996. * Fills the matrix from direct values
  2997. * @param m00 defines value for (0, 0)
  2998. * @param m01 defines value for (0, 1)
  2999. * @param m10 defines value for (1, 0)
  3000. * @param m11 defines value for (1, 1)
  3001. * @param m20 defines value for (2, 0)
  3002. * @param m21 defines value for (2, 1)
  3003. * @returns the current modified matrix
  3004. */
  3005. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  3006. /**
  3007. * Gets matrix determinant
  3008. * @returns the determinant
  3009. */
  3010. determinant(): number;
  3011. /**
  3012. * Inverses the matrix and stores it in a target matrix
  3013. * @param result defines the target matrix
  3014. * @returns the current matrix
  3015. */
  3016. invertToRef(result: Matrix2D): Matrix2D;
  3017. /**
  3018. * Multiplies the current matrix with another one
  3019. * @param other defines the second operand
  3020. * @param result defines the target matrix
  3021. * @returns the current matrix
  3022. */
  3023. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  3024. /**
  3025. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  3026. * @param x defines the x coordinate to transform
  3027. * @param y defines the x coordinate to transform
  3028. * @param result defines the target vector2
  3029. * @returns the current matrix
  3030. */
  3031. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  3032. /**
  3033. * Creates an identity matrix
  3034. * @returns a new matrix
  3035. */
  3036. static Identity(): Matrix2D;
  3037. /**
  3038. * Creates a translation matrix and stores it in a target matrix
  3039. * @param x defines the x coordinate of the translation
  3040. * @param y defines the y coordinate of the translation
  3041. * @param result defines the target matrix
  3042. */
  3043. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  3044. /**
  3045. * Creates a scaling matrix and stores it in a target matrix
  3046. * @param x defines the x coordinate of the scaling
  3047. * @param y defines the y coordinate of the scaling
  3048. * @param result defines the target matrix
  3049. */
  3050. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  3051. /**
  3052. * Creates a rotation matrix and stores it in a target matrix
  3053. * @param angle defines the rotation angle
  3054. * @param result defines the target matrix
  3055. */
  3056. static RotationToRef(angle: number, result: Matrix2D): void;
  3057. /**
  3058. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  3059. * @param tx defines the x coordinate of the translation
  3060. * @param ty defines the y coordinate of the translation
  3061. * @param angle defines the rotation angle
  3062. * @param scaleX defines the x coordinate of the scaling
  3063. * @param scaleY defines the y coordinate of the scaling
  3064. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  3065. * @param result defines the target matrix
  3066. */
  3067. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  3068. }
  3069. }
  3070. declare module BABYLON.GUI {
  3071. /**
  3072. * Class used to store 2D control sizes
  3073. */
  3074. export class Measure {
  3075. /** defines left coordinate */
  3076. left: number;
  3077. /** defines top coordinate */
  3078. top: number;
  3079. /** defines width dimension */
  3080. width: number;
  3081. /** defines height dimension */
  3082. height: number;
  3083. /**
  3084. * Creates a new measure
  3085. * @param left defines left coordinate
  3086. * @param top defines top coordinate
  3087. * @param width defines width dimension
  3088. * @param height defines height dimension
  3089. */
  3090. constructor(
  3091. /** defines left coordinate */
  3092. left: number,
  3093. /** defines top coordinate */
  3094. top: number,
  3095. /** defines width dimension */
  3096. width: number,
  3097. /** defines height dimension */
  3098. height: number);
  3099. /**
  3100. * Copy from another measure
  3101. * @param other defines the other measure to copy from
  3102. */
  3103. copyFrom(other: Measure): void;
  3104. /**
  3105. * Check equality between this measure and another one
  3106. * @param other defines the other measures
  3107. * @returns true if both measures are equals
  3108. */
  3109. isEqualsTo(other: Measure): boolean;
  3110. /**
  3111. * Creates an empty measure
  3112. * @returns a new measure
  3113. */
  3114. static Empty(): Measure;
  3115. }
  3116. }
  3117. declare module BABYLON.GUI {
  3118. /**
  3119. * Class used to store a point for a MultiLine object.
  3120. * The point can be pure 2D coordinates, a mesh or a control
  3121. */
  3122. export class MultiLinePoint {
  3123. /** @hidden */
  3124. _point: BABYLON.Vector2;
  3125. /**
  3126. * Creates a new MultiLinePoint
  3127. * @param multiLine defines the source MultiLine object
  3128. */
  3129. constructor(multiLine: MultiLine);
  3130. /** Gets or sets x coordinate */
  3131. x: string | number;
  3132. /** Gets or sets y coordinate */
  3133. y: string | number;
  3134. /** Gets or sets the control associated with this point */
  3135. control: BABYLON.Nullable<Control>;
  3136. /** Gets or sets the mesh associated with this point */
  3137. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3138. /**
  3139. * Gets a translation vector
  3140. * @returns the translation vector
  3141. */
  3142. translate(): BABYLON.Vector2;
  3143. /** Release associated resources */
  3144. dispose(): void;
  3145. }
  3146. }
  3147. declare module BABYLON.GUI {
  3148. /**
  3149. * Define a style used by control to automatically setup properties based on a template.
  3150. * Only support font related properties so far
  3151. */
  3152. export class Style implements BABYLON.IDisposable {
  3153. /** @hidden */
  3154. _host: AdvancedDynamicTexture;
  3155. /** @hidden */
  3156. _fontSize: ValueAndUnit;
  3157. /**
  3158. * BABYLON.Observable raised when the style values are changed
  3159. */
  3160. onChangedObservable: BABYLON.Observable<Style>;
  3161. /**
  3162. * Creates a new style object
  3163. * @param host defines the AdvancedDynamicTexture which hosts this style
  3164. */
  3165. constructor(host: AdvancedDynamicTexture);
  3166. /**
  3167. * Gets or sets the font size
  3168. */
  3169. fontSize: string | number;
  3170. /**
  3171. * Gets or sets the font family
  3172. */
  3173. fontFamily: string;
  3174. /**
  3175. * Gets or sets the font style
  3176. */
  3177. fontStyle: string;
  3178. /** Gets or sets font weight */
  3179. fontWeight: string;
  3180. /** Dispose all associated resources */
  3181. dispose(): void;
  3182. }
  3183. }
  3184. declare module BABYLON.GUI {
  3185. /**
  3186. * Class used to specific a value and its associated unit
  3187. */
  3188. export class ValueAndUnit {
  3189. /** defines the unit to store */
  3190. unit: number;
  3191. /** defines a boolean indicating if the value can be negative */
  3192. negativeValueAllowed: boolean;
  3193. /**
  3194. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3195. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3196. */
  3197. ignoreAdaptiveScaling: boolean;
  3198. /**
  3199. * Creates a new ValueAndUnit
  3200. * @param value defines the value to store
  3201. * @param unit defines the unit to store
  3202. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3203. */
  3204. constructor(value: number,
  3205. /** defines the unit to store */
  3206. unit?: number,
  3207. /** defines a boolean indicating if the value can be negative */
  3208. negativeValueAllowed?: boolean);
  3209. /** Gets a boolean indicating if the value is a percentage */
  3210. readonly isPercentage: boolean;
  3211. /** Gets a boolean indicating if the value is store as pixel */
  3212. readonly isPixel: boolean;
  3213. /** Gets direct internal value */
  3214. readonly internalValue: number;
  3215. /**
  3216. * Gets value as pixel
  3217. * @param host defines the root host
  3218. * @param refValue defines the reference value for percentages
  3219. * @returns the value as pixel
  3220. */
  3221. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3222. /**
  3223. * Gets the value accordingly to its unit
  3224. * @param host defines the root host
  3225. * @returns the value
  3226. */
  3227. getValue(host: AdvancedDynamicTexture): number;
  3228. /**
  3229. * Gets a string representation of the value
  3230. * @param host defines the root host
  3231. * @returns a string
  3232. */
  3233. toString(host: AdvancedDynamicTexture): string;
  3234. /**
  3235. * Store a value parsed from a string
  3236. * @param source defines the source string
  3237. * @returns true if the value was successfully parsed
  3238. */
  3239. fromString(source: string | number): boolean;
  3240. /** UNITMODE_PERCENTAGE */
  3241. static readonly UNITMODE_PERCENTAGE: number;
  3242. /** UNITMODE_PIXEL */
  3243. static readonly UNITMODE_PIXEL: number;
  3244. }
  3245. }
  3246. declare module BABYLON.GUI {
  3247. }
  3248. declare module BABYLON.GUI {
  3249. }
  3250. declare module BABYLON.GUI {
  3251. /**
  3252. * Class used to manage 3D user interface
  3253. * @see http://doc.babylonjs.com/how_to/gui3d
  3254. */
  3255. export class GUI3DManager implements BABYLON.IDisposable {
  3256. /** @hidden */
  3257. _lastPickedControl: Control3D;
  3258. /** @hidden */
  3259. _lastControlOver: {
  3260. [pointerId: number]: Control3D;
  3261. };
  3262. /** @hidden */
  3263. _lastControlDown: {
  3264. [pointerId: number]: Control3D;
  3265. };
  3266. /**
  3267. * BABYLON.Observable raised when the point picked by the pointer events changed
  3268. */
  3269. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3270. /** @hidden */
  3271. _sharedMaterials: {
  3272. [key: string]: BABYLON.Material;
  3273. };
  3274. /** Gets the hosting scene */
  3275. readonly scene: BABYLON.Scene;
  3276. /** Gets associated utility layer */
  3277. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3278. /**
  3279. * Creates a new GUI3DManager
  3280. * @param scene
  3281. */
  3282. constructor(scene?: BABYLON.Scene);
  3283. /**
  3284. * Gets the root container
  3285. */
  3286. readonly rootContainer: Container3D;
  3287. /**
  3288. * Gets a boolean indicating if the given control is in the root child list
  3289. * @param control defines the control to check
  3290. * @returns true if the control is in the root child list
  3291. */
  3292. containsControl(control: Control3D): boolean;
  3293. /**
  3294. * Adds a control to the root child list
  3295. * @param control defines the control to add
  3296. * @returns the current manager
  3297. */
  3298. addControl(control: Control3D): GUI3DManager;
  3299. /**
  3300. * Removes a control from the root child list
  3301. * @param control defines the control to remove
  3302. * @returns the current container
  3303. */
  3304. removeControl(control: Control3D): GUI3DManager;
  3305. /**
  3306. * Releases all associated resources
  3307. */
  3308. dispose(): void;
  3309. }
  3310. }
  3311. declare module BABYLON.GUI {
  3312. /**
  3313. * Class used to transport BABYLON.Vector3 information for pointer events
  3314. */
  3315. export class Vector3WithInfo extends BABYLON.Vector3 {
  3316. /** defines the current mouse button index */
  3317. buttonIndex: number;
  3318. /**
  3319. * Creates a new Vector3WithInfo
  3320. * @param source defines the vector3 data to transport
  3321. * @param buttonIndex defines the current mouse button index
  3322. */
  3323. constructor(source: BABYLON.Vector3,
  3324. /** defines the current mouse button index */
  3325. buttonIndex?: number);
  3326. }
  3327. }
  3328. declare module BABYLON.GUI {
  3329. /**
  3330. * Class used to create 2D buttons
  3331. */
  3332. export class Button extends Rectangle {
  3333. name?: string | undefined;
  3334. /**
  3335. * Function called to generate a pointer enter animation
  3336. */
  3337. pointerEnterAnimation: () => void;
  3338. /**
  3339. * Function called to generate a pointer out animation
  3340. */
  3341. pointerOutAnimation: () => void;
  3342. /**
  3343. * Function called to generate a pointer down animation
  3344. */
  3345. pointerDownAnimation: () => void;
  3346. /**
  3347. * Function called to generate a pointer up animation
  3348. */
  3349. pointerUpAnimation: () => void;
  3350. /**
  3351. * Creates a new Button
  3352. * @param name defines the name of the button
  3353. */
  3354. constructor(name?: string | undefined);
  3355. protected _getTypeName(): string;
  3356. /** @hidden */
  3357. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3358. /** @hidden */
  3359. _onPointerEnter(target: Control): boolean;
  3360. /** @hidden */
  3361. _onPointerOut(target: Control): void;
  3362. /** @hidden */
  3363. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3364. /** @hidden */
  3365. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3366. /**
  3367. * Creates a new button made with an image and a text
  3368. * @param name defines the name of the button
  3369. * @param text defines the text of the button
  3370. * @param imageUrl defines the url of the image
  3371. * @returns a new Button
  3372. */
  3373. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3374. /**
  3375. * Creates a new button made with an image
  3376. * @param name defines the name of the button
  3377. * @param imageUrl defines the url of the image
  3378. * @returns a new Button
  3379. */
  3380. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3381. /**
  3382. * Creates a new button made with a text
  3383. * @param name defines the name of the button
  3384. * @param text defines the text of the button
  3385. * @returns a new Button
  3386. */
  3387. static CreateSimpleButton(name: string, text: string): Button;
  3388. /**
  3389. * Creates a new button made with an image and a centered text
  3390. * @param name defines the name of the button
  3391. * @param text defines the text of the button
  3392. * @param imageUrl defines the url of the image
  3393. * @returns a new Button
  3394. */
  3395. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3396. }
  3397. }
  3398. declare module BABYLON.GUI {
  3399. /**
  3400. * Class used to represent a 2D checkbox
  3401. */
  3402. export class Checkbox extends Control {
  3403. name?: string | undefined;
  3404. /** Gets or sets border thickness */
  3405. thickness: number;
  3406. /**
  3407. * BABYLON.Observable raised when isChecked property changes
  3408. */
  3409. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3410. /** Gets or sets a value indicating the ratio between overall size and check size */
  3411. checkSizeRatio: number;
  3412. /** Gets or sets background color */
  3413. background: string;
  3414. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3415. isChecked: boolean;
  3416. /**
  3417. * Creates a new CheckBox
  3418. * @param name defines the control name
  3419. */
  3420. constructor(name?: string | undefined);
  3421. protected _getTypeName(): string;
  3422. /** @hidden */
  3423. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3424. /** @hidden */
  3425. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3426. /**
  3427. * Utility function to easily create a checkbox with a header
  3428. * @param title defines the label to use for the header
  3429. * @param onValueChanged defines the callback to call when value changes
  3430. * @returns a StackPanel containing the checkbox and a textBlock
  3431. */
  3432. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3433. }
  3434. }
  3435. declare module BABYLON.GUI {
  3436. /** Class used to create color pickers */
  3437. export class ColorPicker extends Control {
  3438. name?: string | undefined;
  3439. /**
  3440. * BABYLON.Observable raised when the value changes
  3441. */
  3442. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3443. /** Gets or sets the color of the color picker */
  3444. value: BABYLON.Color3;
  3445. /** Gets or sets control width */
  3446. width: string | number;
  3447. /** Gets or sets control height */
  3448. height: string | number;
  3449. /** Gets or sets control size */
  3450. size: string | number;
  3451. /**
  3452. * Creates a new ColorPicker
  3453. * @param name defines the control name
  3454. */
  3455. constructor(name?: string | undefined);
  3456. protected _getTypeName(): string;
  3457. /** @hidden */
  3458. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3459. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3460. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3461. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3462. }
  3463. }
  3464. declare module BABYLON.GUI {
  3465. /**
  3466. * Root class for 2D containers
  3467. * @see http://doc.babylonjs.com/how_to/gui#containers
  3468. */
  3469. export class Container extends Control {
  3470. name?: string | undefined;
  3471. /** @hidden */
  3472. protected _children: Control[];
  3473. /** @hidden */
  3474. protected _measureForChildren: Measure;
  3475. /** @hidden */
  3476. protected _background: string;
  3477. /** @hidden */
  3478. protected _adaptWidthToChildren: boolean;
  3479. /** @hidden */
  3480. protected _adaptHeightToChildren: boolean;
  3481. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3482. adaptHeightToChildren: boolean;
  3483. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3484. adaptWidthToChildren: boolean;
  3485. /** Gets or sets background color */
  3486. background: string;
  3487. /** Gets the list of children */
  3488. readonly children: Control[];
  3489. /**
  3490. * Creates a new Container
  3491. * @param name defines the name of the container
  3492. */
  3493. constructor(name?: string | undefined);
  3494. protected _getTypeName(): string;
  3495. /**
  3496. * Gets a child using its name
  3497. * @param name defines the child name to look for
  3498. * @returns the child control if found
  3499. */
  3500. getChildByName(name: string): BABYLON.Nullable<Control>;
  3501. /**
  3502. * Gets a child using its type and its name
  3503. * @param name defines the child name to look for
  3504. * @param type defines the child type to look for
  3505. * @returns the child control if found
  3506. */
  3507. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3508. /**
  3509. * Search for a specific control in children
  3510. * @param control defines the control to look for
  3511. * @returns true if the control is in child list
  3512. */
  3513. containsControl(control: Control): boolean;
  3514. /**
  3515. * Adds a new control to the current container
  3516. * @param control defines the control to add
  3517. * @returns the current container
  3518. */
  3519. addControl(control: BABYLON.Nullable<Control>): Container;
  3520. /**
  3521. * Removes all controls from the current container
  3522. * @returns the current container
  3523. */
  3524. clearControls(): Container;
  3525. /**
  3526. * Removes a control from the current container
  3527. * @param control defines the control to remove
  3528. * @returns the current container
  3529. */
  3530. removeControl(control: Control): Container;
  3531. /** @hidden */
  3532. _reOrderControl(control: Control): void;
  3533. /** @hidden */
  3534. _markMatrixAsDirty(): void;
  3535. /** @hidden */
  3536. _markAllAsDirty(): void;
  3537. /** @hidden */
  3538. protected _localDraw(context: CanvasRenderingContext2D): void;
  3539. /** @hidden */
  3540. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3541. /** @hidden */
  3542. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3543. /** @hidden */
  3544. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3545. /** @hidden */
  3546. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3547. /** @hidden */
  3548. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3549. /** Releases associated resources */
  3550. dispose(): void;
  3551. }
  3552. }
  3553. declare module BABYLON.GUI {
  3554. /**
  3555. * Root class used for all 2D controls
  3556. * @see http://doc.babylonjs.com/how_to/gui#controls
  3557. */
  3558. export class Control {
  3559. /** defines the name of the control */
  3560. name?: string | undefined;
  3561. /** @hidden */
  3562. _root: BABYLON.Nullable<Container>;
  3563. /** @hidden */
  3564. _host: AdvancedDynamicTexture;
  3565. /** Gets or sets the control parent */
  3566. parent: BABYLON.Nullable<Container>;
  3567. /** @hidden */
  3568. _currentMeasure: Measure;
  3569. /** @hidden */
  3570. _width: ValueAndUnit;
  3571. /** @hidden */
  3572. _height: ValueAndUnit;
  3573. /** @hidden */
  3574. protected _fontOffset: {
  3575. ascent: number;
  3576. height: number;
  3577. descent: number;
  3578. };
  3579. /** @hidden */
  3580. protected _horizontalAlignment: number;
  3581. /** @hidden */
  3582. protected _verticalAlignment: number;
  3583. /** @hidden */
  3584. _tempParentMeasure: Measure;
  3585. /** @hidden */
  3586. protected _cachedParentMeasure: Measure;
  3587. /** @hidden */
  3588. _left: ValueAndUnit;
  3589. /** @hidden */
  3590. _top: ValueAndUnit;
  3591. /** @hidden */
  3592. protected _invertTransformMatrix: Matrix2D;
  3593. /** @hidden */
  3594. protected _transformedPosition: BABYLON.Vector2;
  3595. /** @hidden */
  3596. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3597. protected _isEnabled: boolean;
  3598. protected _disabledColor: string;
  3599. /** @hidden */
  3600. _tag: any;
  3601. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  3602. isHitTestVisible: boolean;
  3603. /** Gets or sets a boolean indicating if the control can block pointer events */
  3604. isPointerBlocker: boolean;
  3605. /** Gets or sets a boolean indicating if the control can be focusable */
  3606. isFocusInvisible: boolean;
  3607. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  3608. shadowOffsetX: number;
  3609. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  3610. shadowOffsetY: number;
  3611. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  3612. shadowBlur: number;
  3613. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  3614. shadowColor: string;
  3615. /** Gets or sets the cursor to use when the control is hovered */
  3616. hoverCursor: string;
  3617. /** @hidden */
  3618. protected _linkOffsetX: ValueAndUnit;
  3619. /** @hidden */
  3620. protected _linkOffsetY: ValueAndUnit;
  3621. /** Gets the control type name */
  3622. readonly typeName: string;
  3623. /**
  3624. * An event triggered when the pointer move over the control.
  3625. */
  3626. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  3627. /**
  3628. * An event triggered when the pointer move out of the control.
  3629. */
  3630. onPointerOutObservable: BABYLON.Observable<Control>;
  3631. /**
  3632. * An event triggered when the pointer taps the control
  3633. */
  3634. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  3635. /**
  3636. * An event triggered when pointer up
  3637. */
  3638. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  3639. /**
  3640. * An event triggered when a control is clicked on
  3641. */
  3642. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  3643. /**
  3644. * An event triggered when pointer enters the control
  3645. */
  3646. onPointerEnterObservable: BABYLON.Observable<Control>;
  3647. /**
  3648. * An event triggered when the control is marked as dirty
  3649. */
  3650. onDirtyObservable: BABYLON.Observable<Control>;
  3651. /**
  3652. * An event triggered after the control is drawn
  3653. */
  3654. onAfterDrawObservable: BABYLON.Observable<Control>;
  3655. /** Gets or set information about font offsets (used to render and align text) */
  3656. fontOffset: {
  3657. ascent: number;
  3658. height: number;
  3659. descent: number;
  3660. };
  3661. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  3662. alpha: number;
  3663. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  3664. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3665. */
  3666. scaleX: number;
  3667. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  3668. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3669. */
  3670. scaleY: number;
  3671. /** Gets or sets the rotation angle (0 by default)
  3672. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3673. */
  3674. rotation: number;
  3675. /** Gets or sets the transformation center on Y axis (0 by default)
  3676. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3677. */
  3678. transformCenterY: number;
  3679. /** Gets or sets the transformation center on X axis (0 by default)
  3680. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3681. */
  3682. transformCenterX: number;
  3683. /**
  3684. * Gets or sets the horizontal alignment
  3685. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3686. */
  3687. horizontalAlignment: number;
  3688. /**
  3689. * Gets or sets the vertical alignment
  3690. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3691. */
  3692. verticalAlignment: number;
  3693. /**
  3694. * Gets or sets control width
  3695. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3696. */
  3697. width: string | number;
  3698. /**
  3699. * Gets control width in pixel
  3700. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3701. */
  3702. readonly widthInPixels: number;
  3703. /**
  3704. * Gets or sets control height
  3705. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3706. */
  3707. height: string | number;
  3708. /**
  3709. * Gets control height in pixel
  3710. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3711. */
  3712. readonly heightInPixels: number;
  3713. /** Gets or set font family */
  3714. fontFamily: string;
  3715. /** Gets or sets font style */
  3716. fontStyle: string;
  3717. /** Gets or sets font weight */
  3718. fontWeight: string;
  3719. /**
  3720. * Gets or sets style
  3721. * @see http://doc.babylonjs.com/how_to/gui#styles
  3722. */
  3723. style: BABYLON.Nullable<Style>;
  3724. /** @hidden */
  3725. readonly _isFontSizeInPercentage: boolean;
  3726. /** Gets font size in pixels */
  3727. readonly fontSizeInPixels: number;
  3728. /** Gets or sets font size */
  3729. fontSize: string | number;
  3730. /** Gets or sets foreground color */
  3731. color: string;
  3732. /** Gets or sets z index which is used to reorder controls on the z axis */
  3733. zIndex: number;
  3734. /** Gets or sets a boolean indicating if the control can be rendered */
  3735. notRenderable: boolean;
  3736. /** Gets or sets a boolean indicating if the control is visible */
  3737. isVisible: boolean;
  3738. /** Gets a boolean indicating that the control needs to update its rendering */
  3739. readonly isDirty: boolean;
  3740. /**
  3741. * Gets or sets a value indicating the padding to use on the left of the control
  3742. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3743. */
  3744. paddingLeft: string | number;
  3745. /**
  3746. * Gets a value indicating the padding in pixels to use on the left of the control
  3747. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3748. */
  3749. readonly paddingLeftInPixels: number;
  3750. /**
  3751. * Gets or sets a value indicating the padding to use on the right of the control
  3752. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3753. */
  3754. paddingRight: string | number;
  3755. /**
  3756. * Gets a value indicating the padding in pixels to use on the right of the control
  3757. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3758. */
  3759. readonly paddingRightInPixels: number;
  3760. /**
  3761. * Gets or sets a value indicating the padding to use on the top of the control
  3762. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3763. */
  3764. paddingTop: string | number;
  3765. /**
  3766. * Gets a value indicating the padding in pixels to use on the top of the control
  3767. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3768. */
  3769. readonly paddingTopInPixels: number;
  3770. /**
  3771. * Gets or sets a value indicating the padding to use on the bottom of the control
  3772. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3773. */
  3774. paddingBottom: string | number;
  3775. /**
  3776. * Gets a value indicating the padding in pixels to use on the bottom of the control
  3777. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3778. */
  3779. readonly paddingBottomInPixels: number;
  3780. /**
  3781. * Gets or sets a value indicating the left coordinate of the control
  3782. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3783. */
  3784. left: string | number;
  3785. /**
  3786. * Gets a value indicating the left coordinate in pixels of the control
  3787. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3788. */
  3789. readonly leftInPixels: number;
  3790. /**
  3791. * Gets or sets a value indicating the top coordinate of the control
  3792. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3793. */
  3794. top: string | number;
  3795. /**
  3796. * Gets a value indicating the top coordinate in pixels of the control
  3797. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3798. */
  3799. readonly topInPixels: number;
  3800. /**
  3801. * Gets or sets a value indicating the offset on X axis to the linked mesh
  3802. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3803. */
  3804. linkOffsetX: string | number;
  3805. /**
  3806. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  3807. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3808. */
  3809. readonly linkOffsetXInPixels: number;
  3810. /**
  3811. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  3812. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3813. */
  3814. linkOffsetY: string | number;
  3815. /**
  3816. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  3817. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3818. */
  3819. readonly linkOffsetYInPixels: number;
  3820. /** Gets the center coordinate on X axis */
  3821. readonly centerX: number;
  3822. /** Gets the center coordinate on Y axis */
  3823. readonly centerY: number;
  3824. /** Gets or sets if control is Enabled*/
  3825. isEnabled: boolean;
  3826. /** Gets or sets background color of control if it's disabled*/
  3827. disabledColor: string;
  3828. /**
  3829. * Creates a new control
  3830. * @param name defines the name of the control
  3831. */
  3832. constructor(
  3833. /** defines the name of the control */
  3834. name?: string | undefined);
  3835. /** @hidden */
  3836. protected _getTypeName(): string;
  3837. /** @hidden */
  3838. _resetFontCache(): void;
  3839. /**
  3840. * Determines if a container is an ascendant of the current control
  3841. * @param container defines the container to look for
  3842. * @returns true if the container is one of the ascendant of the control
  3843. */
  3844. isAscendant(container: Control): boolean;
  3845. /**
  3846. * Gets coordinates in local control space
  3847. * @param globalCoordinates defines the coordinates to transform
  3848. * @returns the new coordinates in local space
  3849. */
  3850. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3851. /**
  3852. * Gets coordinates in local control space
  3853. * @param globalCoordinates defines the coordinates to transform
  3854. * @param result defines the target vector2 where to store the result
  3855. * @returns the current control
  3856. */
  3857. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  3858. /**
  3859. * Gets coordinates in parent local control space
  3860. * @param globalCoordinates defines the coordinates to transform
  3861. * @returns the new coordinates in parent local space
  3862. */
  3863. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3864. /**
  3865. * Move the current control to a vector3 position projected onto the screen.
  3866. * @param position defines the target position
  3867. * @param scene defines the hosting scene
  3868. */
  3869. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  3870. /**
  3871. * Link current control with a target mesh
  3872. * @param mesh defines the mesh to link with
  3873. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3874. */
  3875. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  3876. /** @hidden */
  3877. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  3878. /** @hidden */
  3879. _markMatrixAsDirty(): void;
  3880. /** @hidden */
  3881. _markAsDirty(): void;
  3882. /** @hidden */
  3883. _markAllAsDirty(): void;
  3884. /** @hidden */
  3885. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3886. /** @hidden */
  3887. protected _transform(context: CanvasRenderingContext2D): void;
  3888. /** @hidden */
  3889. protected _applyStates(context: CanvasRenderingContext2D): void;
  3890. /** @hidden */
  3891. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3892. /** @hidden */
  3893. protected _clip(context: CanvasRenderingContext2D): void;
  3894. /** @hidden */
  3895. _measure(): void;
  3896. /** @hidden */
  3897. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3898. /** @hidden */
  3899. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3900. /** @hidden */
  3901. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3902. /** @hidden */
  3903. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3904. /**
  3905. * Tests if a given coordinates belong to the current control
  3906. * @param x defines x coordinate to test
  3907. * @param y defines y coordinate to test
  3908. * @returns true if the coordinates are inside the control
  3909. */
  3910. contains(x: number, y: number): boolean;
  3911. /** @hidden */
  3912. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3913. /** @hidden */
  3914. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3915. /** @hidden */
  3916. _onPointerEnter(target: Control): boolean;
  3917. /** @hidden */
  3918. _onPointerOut(target: Control): void;
  3919. /** @hidden */
  3920. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3921. /** @hidden */
  3922. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3923. /** @hidden */
  3924. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  3925. /** @hidden */
  3926. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  3927. /** Releases associated resources */
  3928. dispose(): void;
  3929. /** HORIZONTAL_ALIGNMENT_LEFT */
  3930. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  3931. /** HORIZONTAL_ALIGNMENT_RIGHT */
  3932. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  3933. /** HORIZONTAL_ALIGNMENT_CENTER */
  3934. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  3935. /** VERTICAL_ALIGNMENT_TOP */
  3936. static readonly VERTICAL_ALIGNMENT_TOP: number;
  3937. /** VERTICAL_ALIGNMENT_BOTTOM */
  3938. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  3939. /** VERTICAL_ALIGNMENT_CENTER */
  3940. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  3941. /** @hidden */
  3942. static _GetFontOffset(font: string): {
  3943. ascent: number;
  3944. height: number;
  3945. descent: number;
  3946. };
  3947. /**
  3948. * Creates a stack panel that can be used to render headers
  3949. * @param control defines the control to associate with the header
  3950. * @param text defines the text of the header
  3951. * @param size defines the size of the header
  3952. * @param options defines options used to configure the header
  3953. * @returns a new StackPanel
  3954. * @ignore
  3955. * @hidden
  3956. */
  3957. static AddHeader: (control: Control, text: string, size: string | number, options: {
  3958. isHorizontal: boolean;
  3959. controlFirst: boolean;
  3960. }) => any;
  3961. /** @hidden */
  3962. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  3963. }
  3964. }
  3965. declare module BABYLON.GUI {
  3966. /** Class used to create 2D ellipse containers */
  3967. export class Ellipse extends Container {
  3968. name?: string | undefined;
  3969. /** Gets or sets border thickness */
  3970. thickness: number;
  3971. /**
  3972. * Creates a new Ellipse
  3973. * @param name defines the control name
  3974. */
  3975. constructor(name?: string | undefined);
  3976. protected _getTypeName(): string;
  3977. protected _localDraw(context: CanvasRenderingContext2D): void;
  3978. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3979. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3980. }
  3981. }
  3982. declare module BABYLON.GUI {
  3983. /**
  3984. * Class used to create a 2D grid container
  3985. */
  3986. export class Grid extends Container {
  3987. name?: string | undefined;
  3988. /** Gets the list of children */
  3989. readonly children: Control[];
  3990. /**
  3991. * Adds a new row to the grid
  3992. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  3993. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  3994. * @returns the current grid
  3995. */
  3996. addRowDefinition(height: number, isPixel?: boolean): Grid;
  3997. /**
  3998. * Adds a new column to the grid
  3999. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4000. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4001. * @returns the current grid
  4002. */
  4003. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  4004. /**
  4005. * Update a row definition
  4006. * @param index defines the index of the row to update
  4007. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4008. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  4009. * @returns the current grid
  4010. */
  4011. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  4012. /**
  4013. * Update a column definition
  4014. * @param index defines the index of the column to update
  4015. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4016. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4017. * @returns the current grid
  4018. */
  4019. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  4020. /**
  4021. * Remove a column definition at specified index
  4022. * @param index defines the index of the column to remove
  4023. * @returns the current grid
  4024. */
  4025. removeColumnDefinition(index: number): Grid;
  4026. /**
  4027. * Remove a row definition at specified index
  4028. * @param index defines the index of the row to remove
  4029. * @returns the current grid
  4030. */
  4031. removeRowDefinition(index: number): Grid;
  4032. /**
  4033. * Adds a new control to the current grid
  4034. * @param control defines the control to add
  4035. * @param row defines the row where to add the control (0 by default)
  4036. * @param column defines the column where to add the control (0 by default)
  4037. * @returns the current grid
  4038. */
  4039. addControl(control: Control, row?: number, column?: number): Grid;
  4040. /**
  4041. * Removes a control from the current container
  4042. * @param control defines the control to remove
  4043. * @returns the current container
  4044. */
  4045. removeControl(control: Control): Container;
  4046. /**
  4047. * Creates a new Grid
  4048. * @param name defines control name
  4049. */
  4050. constructor(name?: string | undefined);
  4051. protected _getTypeName(): string;
  4052. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4053. /** Releases associated resources */
  4054. dispose(): void;
  4055. }
  4056. }
  4057. declare module BABYLON.GUI {
  4058. /**
  4059. * Class used to create 2D images
  4060. */
  4061. export class Image extends Control {
  4062. name?: string | undefined;
  4063. /**
  4064. * Gets or sets the left coordinate in the source image
  4065. */
  4066. sourceLeft: number;
  4067. /**
  4068. * Gets or sets the top coordinate in the source image
  4069. */
  4070. sourceTop: number;
  4071. /**
  4072. * Gets or sets the width to capture in the source image
  4073. */
  4074. sourceWidth: number;
  4075. /**
  4076. * Gets or sets the height to capture in the source image
  4077. */
  4078. sourceHeight: number;
  4079. /**
  4080. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  4081. * @see http://doc.babylonjs.com/how_to/gui#image
  4082. */
  4083. autoScale: boolean;
  4084. /** Gets or sets the streching mode used by the image */
  4085. stretch: number;
  4086. /**
  4087. * Gets or sets the internal DOM image used to render the control
  4088. */
  4089. domImage: HTMLImageElement;
  4090. /**
  4091. * Gets or sets image source url
  4092. */
  4093. source: BABYLON.Nullable<string>;
  4094. /**
  4095. * Gets or sets the cell width to use when animation sheet is enabled
  4096. * @see http://doc.babylonjs.com/how_to/gui#image
  4097. */
  4098. cellWidth: number;
  4099. /**
  4100. * Gets or sets the cell height to use when animation sheet is enabled
  4101. * @see http://doc.babylonjs.com/how_to/gui#image
  4102. */
  4103. cellHeight: number;
  4104. /**
  4105. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4106. * @see http://doc.babylonjs.com/how_to/gui#image
  4107. */
  4108. cellId: number;
  4109. /**
  4110. * Creates a new Image
  4111. * @param name defines the control name
  4112. * @param url defines the image url
  4113. */
  4114. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4115. protected _getTypeName(): string;
  4116. /** Force the control to synchronize with its content */
  4117. synchronizeSizeWithContent(): void;
  4118. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4119. /** STRETCH_NONE */
  4120. static readonly STRETCH_NONE: number;
  4121. /** STRETCH_FILL */
  4122. static readonly STRETCH_FILL: number;
  4123. /** STRETCH_UNIFORM */
  4124. static readonly STRETCH_UNIFORM: number;
  4125. /** STRETCH_EXTEND */
  4126. static readonly STRETCH_EXTEND: number;
  4127. }
  4128. }
  4129. declare module BABYLON.GUI {
  4130. /**
  4131. * Class used to create input text control
  4132. */
  4133. export class InputText extends Control implements IFocusableControl {
  4134. name?: string | undefined;
  4135. /** @hidden */
  4136. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  4137. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4138. promptMessage: string;
  4139. /** BABYLON.Observable raised when the text changes */
  4140. onTextChangedObservable: BABYLON.Observable<InputText>;
  4141. /** BABYLON.Observable raised just before an entered character is to be added */
  4142. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4143. /** BABYLON.Observable raised when the control gets the focus */
  4144. onFocusObservable: BABYLON.Observable<InputText>;
  4145. /** BABYLON.Observable raised when the control loses the focus */
  4146. onBlurObservable: BABYLON.Observable<InputText>;
  4147. /** Gets or sets the maximum width allowed by the control */
  4148. maxWidth: string | number;
  4149. /** Gets the maximum width allowed by the control in pixels */
  4150. readonly maxWidthInPixels: number;
  4151. /** Gets or sets control margin */
  4152. margin: string;
  4153. /** Gets control margin in pixels */
  4154. readonly marginInPixels: number;
  4155. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4156. autoStretchWidth: boolean;
  4157. /** Gets or sets border thickness */
  4158. thickness: number;
  4159. /** Gets or sets the background color when focused */
  4160. focusedBackground: string;
  4161. /** Gets or sets the background color */
  4162. background: string;
  4163. /** Gets or sets the placeholder color */
  4164. placeholderColor: string;
  4165. /** Gets or sets the text displayed when the control is empty */
  4166. placeholderText: string;
  4167. /** Gets or sets the dead key flag */
  4168. deadKey: boolean;
  4169. /** Gets or sets if the current key should be added */
  4170. addKey: boolean;
  4171. /** Gets or sets the value of the current key being entered */
  4172. currentKey: string;
  4173. /** Gets or sets the text displayed in the control */
  4174. text: string;
  4175. /** Gets or sets control width */
  4176. width: string | number;
  4177. /**
  4178. * Creates a new InputText
  4179. * @param name defines the control name
  4180. * @param text defines the text of the control
  4181. */
  4182. constructor(name?: string | undefined, text?: string);
  4183. /** @hidden */
  4184. onBlur(): void;
  4185. /** @hidden */
  4186. onFocus(): void;
  4187. protected _getTypeName(): string;
  4188. /**
  4189. * Function called to get the list of controls that should not steal the focus from this control
  4190. * @returns an array of controls
  4191. */
  4192. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4193. /** @hidden */
  4194. processKey(keyCode: number, key?: string): void;
  4195. /** @hidden */
  4196. processKeyboard(evt: KeyboardEvent): void;
  4197. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4198. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4199. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4200. protected _beforeRenderText(text: string): string;
  4201. dispose(): void;
  4202. }
  4203. }
  4204. declare module BABYLON.GUI {
  4205. /**
  4206. * Class used to create a password control
  4207. */
  4208. export class InputPassword extends InputText {
  4209. protected _beforeRenderText(text: string): string;
  4210. }
  4211. }
  4212. declare module BABYLON.GUI {
  4213. /** Class used to render 2D lines */
  4214. export class Line extends Control {
  4215. name?: string | undefined;
  4216. /** Gets or sets the dash pattern */
  4217. dash: Array<number>;
  4218. /** Gets or sets the control connected with the line end */
  4219. connectedControl: Control;
  4220. /** Gets or sets start coordinates on X axis */
  4221. x1: string | number;
  4222. /** Gets or sets start coordinates on Y axis */
  4223. y1: string | number;
  4224. /** Gets or sets end coordinates on X axis */
  4225. x2: string | number;
  4226. /** Gets or sets end coordinates on Y axis */
  4227. y2: string | number;
  4228. /** Gets or sets line width */
  4229. lineWidth: number;
  4230. /** Gets or sets horizontal alignment */
  4231. horizontalAlignment: number;
  4232. /** Gets or sets vertical alignment */
  4233. verticalAlignment: number;
  4234. /**
  4235. * Creates a new Line
  4236. * @param name defines the control name
  4237. */
  4238. constructor(name?: string | undefined);
  4239. protected _getTypeName(): string;
  4240. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4241. _measure(): void;
  4242. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4243. /**
  4244. * Move one end of the line given 3D cartesian coordinates.
  4245. * @param position Targeted world position
  4246. * @param scene BABYLON.Scene
  4247. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4248. */
  4249. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4250. /**
  4251. * Move one end of the line to a position in screen absolute space.
  4252. * @param projectedPosition Position in screen absolute space (X, Y)
  4253. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4254. */
  4255. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4256. }
  4257. }
  4258. declare module BABYLON.GUI {
  4259. /**
  4260. * Class used to create multi line control
  4261. */
  4262. export class MultiLine extends Control {
  4263. name?: string | undefined;
  4264. /**
  4265. * Creates a new MultiLine
  4266. * @param name defines the control name
  4267. */
  4268. constructor(name?: string | undefined);
  4269. /** Gets or sets dash pattern */
  4270. dash: Array<number>;
  4271. /**
  4272. * Gets point stored at specified index
  4273. * @param index defines the index to look for
  4274. * @returns the requested point if found
  4275. */
  4276. getAt(index: number): MultiLinePoint;
  4277. /** Function called when a point is updated */
  4278. onPointUpdate: () => void;
  4279. /**
  4280. * Adds new points to the point collection
  4281. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4282. * @returns the list of created MultiLinePoint
  4283. */
  4284. add(...items: (AbstractMesh | Control | {
  4285. x: string | number;
  4286. y: string | number;
  4287. })[]): MultiLinePoint[];
  4288. /**
  4289. * Adds a new point to the point collection
  4290. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4291. * @returns the created MultiLinePoint
  4292. */
  4293. push(item?: (AbstractMesh | Control | {
  4294. x: string | number;
  4295. y: string | number;
  4296. })): MultiLinePoint;
  4297. /**
  4298. * Remove a specific value or point from the active point collection
  4299. * @param value defines the value or point to remove
  4300. */
  4301. remove(value: number | MultiLinePoint): void;
  4302. /** Gets or sets line width */
  4303. lineWidth: number;
  4304. horizontalAlignment: number;
  4305. verticalAlignment: number;
  4306. protected _getTypeName(): string;
  4307. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4308. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4309. _measure(): void;
  4310. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4311. dispose(): void;
  4312. }
  4313. }
  4314. declare module BABYLON.GUI {
  4315. /**
  4316. * Class used to create radio button controls
  4317. */
  4318. export class RadioButton extends Control {
  4319. name?: string | undefined;
  4320. /** Gets or sets border thickness */
  4321. thickness: number;
  4322. /** Gets or sets group name */
  4323. group: string;
  4324. /** BABYLON.Observable raised when isChecked is changed */
  4325. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4326. /** Gets or sets a value indicating the ratio between overall size and check size */
  4327. checkSizeRatio: number;
  4328. /** Gets or sets background color */
  4329. background: string;
  4330. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4331. isChecked: boolean;
  4332. /**
  4333. * Creates a new RadioButton
  4334. * @param name defines the control name
  4335. */
  4336. constructor(name?: string | undefined);
  4337. protected _getTypeName(): string;
  4338. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4339. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4340. /**
  4341. * Utility function to easily create a radio button with a header
  4342. * @param title defines the label to use for the header
  4343. * @param group defines the group to use for the radio button
  4344. * @param isChecked defines the initial state of the radio button
  4345. * @param onValueChanged defines the callback to call when value changes
  4346. * @returns a StackPanel containing the radio button and a textBlock
  4347. */
  4348. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  4349. }
  4350. }
  4351. declare module BABYLON.GUI {
  4352. /**
  4353. * Class used to create a 2D stack panel container
  4354. */
  4355. export class StackPanel extends Container {
  4356. name?: string | undefined;
  4357. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  4358. isVertical: boolean;
  4359. /** Gets or sets panel width */
  4360. width: string | number;
  4361. /** Gets or sets panel height */
  4362. height: string | number;
  4363. /**
  4364. * Creates a new StackPanel
  4365. * @param name defines control name
  4366. */
  4367. constructor(name?: string | undefined);
  4368. protected _getTypeName(): string;
  4369. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4370. }
  4371. }
  4372. declare module BABYLON.GUI {
  4373. /** Class used to create a RadioGroup
  4374. * which contains groups of radio buttons
  4375. */
  4376. export class SelectorGroup {
  4377. /** name of SelectorGroup */
  4378. name: string;
  4379. /**
  4380. * Creates a new SelectorGroup
  4381. * @param name of group, used as a group heading
  4382. */
  4383. constructor(
  4384. /** name of SelectorGroup */
  4385. name: string);
  4386. /** Gets the groupPanel of the SelectorGroup */
  4387. readonly groupPanel: StackPanel;
  4388. /** Gets the selectors array */
  4389. readonly selectors: StackPanel[];
  4390. /** Gets and sets the group header */
  4391. header: string;
  4392. /** @hidden*/
  4393. _getSelector(selectorNb: number): StackPanel | undefined;
  4394. /** Removes the selector at the given position
  4395. * @param selectorNb the position of the selector within the group
  4396. */
  4397. removeSelector(selectorNb: number): void;
  4398. }
  4399. /** Class used to create a CheckboxGroup
  4400. * which contains groups of checkbox buttons
  4401. */
  4402. export class CheckboxGroup extends SelectorGroup {
  4403. /** Adds a checkbox as a control
  4404. * @param text is the label for the selector
  4405. * @param func is the function called when the Selector is checked
  4406. * @param checked is true when Selector is checked
  4407. */
  4408. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  4409. /** @hidden */
  4410. _setSelectorLabel(selectorNb: number, label: string): void;
  4411. /** @hidden */
  4412. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4413. /** @hidden */
  4414. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4415. /** @hidden */
  4416. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4417. }
  4418. /** Class used to create a RadioGroup
  4419. * which contains groups of radio buttons
  4420. */
  4421. export class RadioGroup extends SelectorGroup {
  4422. /** Adds a radio button as a control
  4423. * @param label is the label for the selector
  4424. * @param func is the function called when the Selector is checked
  4425. * @param checked is true when Selector is checked
  4426. */
  4427. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  4428. /** @hidden */
  4429. _setSelectorLabel(selectorNb: number, label: string): void;
  4430. /** @hidden */
  4431. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4432. /** @hidden */
  4433. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4434. /** @hidden */
  4435. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4436. }
  4437. /** Class used to create a SliderGroup
  4438. * which contains groups of slider buttons
  4439. */
  4440. export class SliderGroup extends SelectorGroup {
  4441. /**
  4442. * Adds a slider to the SelectorGroup
  4443. * @param label is the label for the SliderBar
  4444. * @param func is the function called when the Slider moves
  4445. * @param unit is a string describing the units used, eg degrees or metres
  4446. * @param min is the minimum value for the Slider
  4447. * @param max is the maximum value for the Slider
  4448. * @param value is the start value for the Slider between min and max
  4449. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  4450. */
  4451. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  4452. /** @hidden */
  4453. _setSelectorLabel(selectorNb: number, label: string): void;
  4454. /** @hidden */
  4455. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4456. /** @hidden */
  4457. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4458. /** @hidden */
  4459. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4460. }
  4461. /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
  4462. export class SelectionPanel extends Rectangle {
  4463. /** name of SelectionPanel */
  4464. name: string;
  4465. /** an array of SelectionGroups */
  4466. groups: SelectorGroup[];
  4467. /**
  4468. * Creates a new SelectionPanel
  4469. * @param name of SelectionPanel
  4470. * @param groups is an array of SelectionGroups
  4471. */
  4472. constructor(
  4473. /** name of SelectionPanel */
  4474. name: string,
  4475. /** an array of SelectionGroups */
  4476. groups?: SelectorGroup[]);
  4477. protected _getTypeName(): string;
  4478. /** Gets or sets the headerColor */
  4479. headerColor: string;
  4480. /** Gets or sets the button color */
  4481. buttonColor: string;
  4482. /** Gets or sets the label color */
  4483. labelColor: string;
  4484. /** Gets or sets the button background */
  4485. buttonBackground: string;
  4486. /** Gets or sets the color of separator bar */
  4487. barColor: string;
  4488. /** Add a group to the selection panel
  4489. * @param group is the selector group to add
  4490. */
  4491. addGroup(group: SelectorGroup): void;
  4492. /** Remove the group from the given position
  4493. * @param groupNb is the position of the group in the list
  4494. */
  4495. removeGroup(groupNb: number): void;
  4496. /** Change a group header label
  4497. * @param label is the new group header label
  4498. * @param groupNb is the number of the group to relabel
  4499. * */
  4500. setHeaderName(label: string, groupNb: number): void;
  4501. /** Change selector label to the one given
  4502. * @param label is the new selector label
  4503. * @param groupNb is the number of the groupcontaining the selector
  4504. * @param selectorNb is the number of the selector within a group to relabel
  4505. * */
  4506. relabel(label: string, groupNb: number, selectorNb: number): void;
  4507. /** For a given group position remove the selector at the given position
  4508. * @param groupNb is the number of the group to remove the selector from
  4509. * @param selectorNb is the number of the selector within the group
  4510. */
  4511. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  4512. /** For a given group position of correct type add a checkbox button
  4513. * @param groupNb is the number of the group to remove the selector from
  4514. * @param label is the label for the selector
  4515. * @param func is the function called when the Selector is checked
  4516. * @param checked is true when Selector is checked
  4517. */
  4518. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  4519. /** For a given group position of correct type add a radio button
  4520. * @param groupNb is the number of the group to remove the selector from
  4521. * @param label is the label for the selector
  4522. * @param func is the function called when the Selector is checked
  4523. * @param checked is true when Selector is checked
  4524. */
  4525. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  4526. /**
  4527. * For a given slider group add a slider
  4528. * @param groupNb is the number of the group to add the slider to
  4529. * @param label is the label for the Slider
  4530. * @param func is the function called when the Slider moves
  4531. * @param unit is a string describing the units used, eg degrees or metres
  4532. * @param min is the minimum value for the Slider
  4533. * @param max is the maximum value for the Slider
  4534. * @param value is the start value for the Slider between min and max
  4535. * @param onVal is the function used to format the value displayed, eg radians to degrees
  4536. */
  4537. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  4538. }
  4539. }
  4540. declare module BABYLON.GUI {
  4541. /**
  4542. * Enum that determines the text-wrapping mode to use.
  4543. */
  4544. export enum TextWrapping {
  4545. /**
  4546. * Clip the text when it's larger than Control.width; this is the default mode.
  4547. */
  4548. Clip = 0,
  4549. /**
  4550. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  4551. */
  4552. WordWrap = 1,
  4553. /**
  4554. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  4555. */
  4556. Ellipsis = 2
  4557. }
  4558. /**
  4559. * Class used to create text block control
  4560. */
  4561. export class TextBlock extends Control {
  4562. /**
  4563. * Defines the name of the control
  4564. */
  4565. name?: string | undefined;
  4566. /**
  4567. * An event triggered after the text is changed
  4568. */
  4569. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  4570. /**
  4571. * An event triggered after the text was broken up into lines
  4572. */
  4573. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  4574. /**
  4575. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  4576. */
  4577. readonly lines: any[];
  4578. /**
  4579. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  4580. */
  4581. resizeToFit: boolean;
  4582. /**
  4583. * Gets or sets a boolean indicating if text must be wrapped
  4584. */
  4585. textWrapping: TextWrapping | boolean;
  4586. /**
  4587. * Gets or sets text to display
  4588. */
  4589. text: string;
  4590. /**
  4591. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  4592. */
  4593. textHorizontalAlignment: number;
  4594. /**
  4595. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  4596. */
  4597. textVerticalAlignment: number;
  4598. /**
  4599. * Gets or sets line spacing value
  4600. */
  4601. lineSpacing: string | number;
  4602. /**
  4603. * Gets or sets outlineWidth of the text to display
  4604. */
  4605. outlineWidth: number;
  4606. /**
  4607. * Gets or sets outlineColor of the text to display
  4608. */
  4609. outlineColor: string;
  4610. /**
  4611. * Creates a new TextBlock object
  4612. * @param name defines the name of the control
  4613. * @param text defines the text to display (emptry string by default)
  4614. */
  4615. constructor(
  4616. /**
  4617. * Defines the name of the control
  4618. */
  4619. name?: string | undefined, text?: string);
  4620. protected _getTypeName(): string;
  4621. /** @hidden */
  4622. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4623. protected _applyStates(context: CanvasRenderingContext2D): void;
  4624. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4625. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  4626. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  4627. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  4628. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  4629. protected _renderLines(context: CanvasRenderingContext2D): void;
  4630. /**
  4631. * Given a width constraint applied on the text block, find the expected height
  4632. * @returns expected height
  4633. */
  4634. computeExpectedHeight(): number;
  4635. dispose(): void;
  4636. }
  4637. }
  4638. declare module BABYLON.GUI {
  4639. /**
  4640. * Class used to store key control properties
  4641. */
  4642. export class KeyPropertySet {
  4643. /** Width */
  4644. width?: string;
  4645. /** Height */
  4646. height?: string;
  4647. /** Left padding */
  4648. paddingLeft?: string;
  4649. /** Right padding */
  4650. paddingRight?: string;
  4651. /** Top padding */
  4652. paddingTop?: string;
  4653. /** Bottom padding */
  4654. paddingBottom?: string;
  4655. /** Foreground color */
  4656. color?: string;
  4657. /** Background color */
  4658. background?: string;
  4659. }
  4660. /**
  4661. * Class used to create virtual keyboard
  4662. */
  4663. export class VirtualKeyboard extends StackPanel {
  4664. /** BABYLON.Observable raised when a key is pressed */
  4665. onKeyPressObservable: BABYLON.Observable<string>;
  4666. /** Gets or sets default key button width */
  4667. defaultButtonWidth: string;
  4668. /** Gets or sets default key button height */
  4669. defaultButtonHeight: string;
  4670. /** Gets or sets default key button left padding */
  4671. defaultButtonPaddingLeft: string;
  4672. /** Gets or sets default key button right padding */
  4673. defaultButtonPaddingRight: string;
  4674. /** Gets or sets default key button top padding */
  4675. defaultButtonPaddingTop: string;
  4676. /** Gets or sets default key button bottom padding */
  4677. defaultButtonPaddingBottom: string;
  4678. /** Gets or sets default key button foreground color */
  4679. defaultButtonColor: string;
  4680. /** Gets or sets default key button background color */
  4681. defaultButtonBackground: string;
  4682. /** Gets or sets shift button foreground color */
  4683. shiftButtonColor: string;
  4684. /** Gets or sets shift button thickness*/
  4685. selectedShiftThickness: number;
  4686. /** Gets shift key state */
  4687. shiftState: number;
  4688. protected _getTypeName(): string;
  4689. /**
  4690. * Adds a new row of keys
  4691. * @param keys defines the list of keys to add
  4692. * @param propertySets defines the associated property sets
  4693. */
  4694. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  4695. /**
  4696. * Set the shift key to a specific state
  4697. * @param shiftState defines the new shift state
  4698. */
  4699. applyShiftState(shiftState: number): void;
  4700. /** Gets the input text control currently attached to the keyboard */
  4701. readonly connectedInputText: BABYLON.Nullable<InputText>;
  4702. /**
  4703. * Connects the keyboard with an input text control
  4704. *
  4705. * @param input defines the target control
  4706. */
  4707. connect(input: InputText): void;
  4708. /**
  4709. * Disconnects the keyboard from connected InputText controls
  4710. *
  4711. * @param input optionally defines a target control, otherwise all are disconnected
  4712. */
  4713. disconnect(input?: InputText): void;
  4714. /**
  4715. * Release all resources
  4716. */
  4717. dispose(): void;
  4718. /**
  4719. * Creates a new keyboard using a default layout
  4720. *
  4721. * @param name defines control name
  4722. * @returns a new VirtualKeyboard
  4723. */
  4724. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  4725. }
  4726. }
  4727. declare module BABYLON.GUI {
  4728. /**
  4729. * Class used to create slider controls
  4730. */
  4731. export class Slider extends Control {
  4732. name?: string | undefined;
  4733. /** BABYLON.Observable raised when the sldier value changes */
  4734. onValueChangedObservable: BABYLON.Observable<number>;
  4735. /** Gets or sets border color */
  4736. borderColor: string;
  4737. /** Gets or sets background color */
  4738. background: string;
  4739. /** Gets or sets main bar offset */
  4740. barOffset: string | number;
  4741. /** Gets main bar offset in pixels*/
  4742. readonly barOffsetInPixels: number;
  4743. /** Gets or sets thumb width */
  4744. thumbWidth: string | number;
  4745. /** Gets thumb width in pixels */
  4746. readonly thumbWidthInPixels: number;
  4747. /** Gets or sets minimum value */
  4748. minimum: number;
  4749. /** Gets or sets maximum value */
  4750. maximum: number;
  4751. /** Gets or sets current value */
  4752. value: number;
  4753. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  4754. isVertical: boolean;
  4755. /** Gets or sets a boolean indicating if the thumb should be round or square */
  4756. isThumbCircle: boolean;
  4757. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  4758. isThumbClamped: boolean;
  4759. /**
  4760. * Creates a new Slider
  4761. * @param name defines the control name
  4762. */
  4763. constructor(name?: string | undefined);
  4764. protected _getTypeName(): string;
  4765. protected _getThumbThickness(type: string, backgroundLength: number): number;
  4766. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4767. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4768. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4769. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4770. }
  4771. }
  4772. declare module BABYLON.GUI {
  4773. /** Class used to create rectangle container */
  4774. export class Rectangle extends Container {
  4775. name?: string | undefined;
  4776. /** Gets or sets border thickness */
  4777. thickness: number;
  4778. /** Gets or sets the corner radius angle */
  4779. cornerRadius: number;
  4780. /**
  4781. * Creates a new Rectangle
  4782. * @param name defines the control name
  4783. */
  4784. constructor(name?: string | undefined);
  4785. protected _getTypeName(): string;
  4786. protected _localDraw(context: CanvasRenderingContext2D): void;
  4787. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4788. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4789. }
  4790. }
  4791. declare module BABYLON.GUI {
  4792. /** Class used to render a grid */
  4793. export class DisplayGrid extends Control {
  4794. name?: string | undefined;
  4795. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  4796. displayMinorLines: boolean;
  4797. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  4798. displayMajorLines: boolean;
  4799. /** Gets or sets background color (Black by default) */
  4800. background: string;
  4801. /** Gets or sets the width of each cell (20 by default) */
  4802. cellWidth: number;
  4803. /** Gets or sets the height of each cell (20 by default) */
  4804. cellHeight: number;
  4805. /** Gets or sets the tickness of minor lines (1 by default) */
  4806. minorLineTickness: number;
  4807. /** Gets or sets the color of minor lines (DarkGray by default) */
  4808. minorLineColor: string;
  4809. /** Gets or sets the tickness of major lines (2 by default) */
  4810. majorLineTickness: number;
  4811. /** Gets or sets the color of major lines (White by default) */
  4812. majorLineColor: string;
  4813. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  4814. majorLineFrequency: number;
  4815. /**
  4816. * Creates a new GridDisplayRectangle
  4817. * @param name defines the control name
  4818. */
  4819. constructor(name?: string | undefined);
  4820. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4821. protected _getTypeName(): string;
  4822. }
  4823. }
  4824. declare module BABYLON.GUI {
  4825. /**
  4826. * Forcing an export so that this code will execute
  4827. * @hidden
  4828. */
  4829. const name = "Statics";
  4830. }
  4831. declare module BABYLON.GUI {
  4832. /**
  4833. * Class used as a root to all buttons
  4834. */
  4835. export class AbstractButton3D extends Control3D {
  4836. /**
  4837. * Creates a new button
  4838. * @param name defines the control name
  4839. */
  4840. constructor(name?: string);
  4841. protected _getTypeName(): string;
  4842. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4843. }
  4844. }
  4845. declare module BABYLON.GUI {
  4846. /**
  4847. * Class used to create a button in 3D
  4848. */
  4849. export class Button3D extends AbstractButton3D {
  4850. /** @hidden */
  4851. protected _currentMaterial: BABYLON.Material;
  4852. /**
  4853. * Gets or sets the texture resolution used to render content (512 by default)
  4854. */
  4855. contentResolution: BABYLON.int;
  4856. /**
  4857. * Gets or sets the texture scale ratio used to render content (2 by default)
  4858. */
  4859. contentScaleRatio: number;
  4860. protected _disposeFacadeTexture(): void;
  4861. protected _resetContent(): void;
  4862. /**
  4863. * Creates a new button
  4864. * @param name defines the control name
  4865. */
  4866. constructor(name?: string);
  4867. /**
  4868. * Gets or sets the GUI 2D content used to display the button's facade
  4869. */
  4870. content: Control;
  4871. /**
  4872. * Apply the facade texture (created from the content property).
  4873. * This function can be overloaded by child classes
  4874. * @param facadeTexture defines the AdvancedDynamicTexture to use
  4875. */
  4876. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4877. protected _getTypeName(): string;
  4878. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4879. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4880. /**
  4881. * Releases all associated resources
  4882. */
  4883. dispose(): void;
  4884. }
  4885. }
  4886. declare module BABYLON.GUI {
  4887. /**
  4888. * Class used to create containers for controls
  4889. */
  4890. export class Container3D extends Control3D {
  4891. /**
  4892. * Gets the list of child controls
  4893. */
  4894. protected _children: Control3D[];
  4895. /**
  4896. * Gets the list of child controls
  4897. */
  4898. readonly children: Array<Control3D>;
  4899. /**
  4900. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  4901. * This is helpful to optimize layout operation when adding multiple children in a row
  4902. */
  4903. blockLayout: boolean;
  4904. /**
  4905. * Creates a new container
  4906. * @param name defines the container name
  4907. */
  4908. constructor(name?: string);
  4909. /**
  4910. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  4911. * @returns the current container
  4912. */
  4913. updateLayout(): Container3D;
  4914. /**
  4915. * Gets a boolean indicating if the given control is in the children of this control
  4916. * @param control defines the control to check
  4917. * @returns true if the control is in the child list
  4918. */
  4919. containsControl(control: Control3D): boolean;
  4920. /**
  4921. * Adds a control to the children of this control
  4922. * @param control defines the control to add
  4923. * @returns the current container
  4924. */
  4925. addControl(control: Control3D): Container3D;
  4926. /**
  4927. * This function will be called everytime a new control is added
  4928. */
  4929. protected _arrangeChildren(): void;
  4930. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  4931. /**
  4932. * Removes a control from the children of this control
  4933. * @param control defines the control to remove
  4934. * @returns the current container
  4935. */
  4936. removeControl(control: Control3D): Container3D;
  4937. protected _getTypeName(): string;
  4938. /**
  4939. * Releases all associated resources
  4940. */
  4941. dispose(): void;
  4942. /** Control rotation will remain unchanged */
  4943. static readonly UNSET_ORIENTATION: number;
  4944. /** Control will rotate to make it look at sphere central axis */
  4945. static readonly FACEORIGIN_ORIENTATION: number;
  4946. /** Control will rotate to make it look back at sphere central axis */
  4947. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  4948. /** Control will rotate to look at z axis (0, 0, 1) */
  4949. static readonly FACEFORWARD_ORIENTATION: number;
  4950. /** Control will rotate to look at negative z axis (0, 0, -1) */
  4951. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  4952. }
  4953. }
  4954. declare module BABYLON.GUI {
  4955. /**
  4956. * Class used as base class for controls
  4957. */
  4958. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  4959. /** Defines the control name */
  4960. name?: string | undefined;
  4961. /** @hidden */
  4962. _host: GUI3DManager;
  4963. /** Gets or sets the control position in world space */
  4964. position: BABYLON.Vector3;
  4965. /** Gets or sets the control scaling in world space */
  4966. scaling: BABYLON.Vector3;
  4967. /** Callback used to start pointer enter animation */
  4968. pointerEnterAnimation: () => void;
  4969. /** Callback used to start pointer out animation */
  4970. pointerOutAnimation: () => void;
  4971. /** Callback used to start pointer down animation */
  4972. pointerDownAnimation: () => void;
  4973. /** Callback used to start pointer up animation */
  4974. pointerUpAnimation: () => void;
  4975. /**
  4976. * An event triggered when the pointer move over the control
  4977. */
  4978. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  4979. /**
  4980. * An event triggered when the pointer move out of the control
  4981. */
  4982. onPointerOutObservable: BABYLON.Observable<Control3D>;
  4983. /**
  4984. * An event triggered when the pointer taps the control
  4985. */
  4986. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  4987. /**
  4988. * An event triggered when pointer is up
  4989. */
  4990. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  4991. /**
  4992. * An event triggered when a control is clicked on (with a mouse)
  4993. */
  4994. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  4995. /**
  4996. * An event triggered when pointer enters the control
  4997. */
  4998. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  4999. /**
  5000. * Gets or sets the parent container
  5001. */
  5002. parent: BABYLON.Nullable<Container3D>;
  5003. /**
  5004. * Gets the list of attached behaviors
  5005. * @see http://doc.babylonjs.com/features/behaviour
  5006. */
  5007. readonly behaviors: BABYLON.Behavior<Control3D>[];
  5008. /**
  5009. * Attach a behavior to the control
  5010. * @see http://doc.babylonjs.com/features/behaviour
  5011. * @param behavior defines the behavior to attach
  5012. * @returns the current control
  5013. */
  5014. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5015. /**
  5016. * Remove an attached behavior
  5017. * @see http://doc.babylonjs.com/features/behaviour
  5018. * @param behavior defines the behavior to attach
  5019. * @returns the current control
  5020. */
  5021. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5022. /**
  5023. * Gets an attached behavior by name
  5024. * @param name defines the name of the behavior to look for
  5025. * @see http://doc.babylonjs.com/features/behaviour
  5026. * @returns null if behavior was not found else the requested behavior
  5027. */
  5028. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  5029. /** Gets or sets a boolean indicating if the control is visible */
  5030. isVisible: boolean;
  5031. /**
  5032. * Creates a new control
  5033. * @param name defines the control name
  5034. */
  5035. constructor(
  5036. /** Defines the control name */
  5037. name?: string | undefined);
  5038. /**
  5039. * Gets a string representing the class name
  5040. */
  5041. readonly typeName: string;
  5042. protected _getTypeName(): string;
  5043. /**
  5044. * Gets the transform node used by this control
  5045. */
  5046. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  5047. /**
  5048. * Gets the mesh used to render this control
  5049. */
  5050. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  5051. /**
  5052. * Link the control as child of the given node
  5053. * @param node defines the node to link to. Use null to unlink the control
  5054. * @returns the current control
  5055. */
  5056. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  5057. /** @hidden **/
  5058. _prepareNode(scene: BABYLON.Scene): void;
  5059. /**
  5060. * Node creation.
  5061. * Can be overriden by children
  5062. * @param scene defines the scene where the node must be attached
  5063. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  5064. */
  5065. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5066. /**
  5067. * Affect a material to the given mesh
  5068. * @param mesh defines the mesh which will represent the control
  5069. */
  5070. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5071. /** @hidden */
  5072. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  5073. /** @hidden */
  5074. _onPointerEnter(target: Control3D): boolean;
  5075. /** @hidden */
  5076. _onPointerOut(target: Control3D): void;
  5077. /** @hidden */
  5078. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5079. /** @hidden */
  5080. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5081. /** @hidden */
  5082. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  5083. /** @hidden */
  5084. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5085. /** @hidden */
  5086. _disposeNode(): void;
  5087. /**
  5088. * Releases all associated resources
  5089. */
  5090. dispose(): void;
  5091. }
  5092. }
  5093. declare module BABYLON.GUI {
  5094. /**
  5095. * Class used to create a container panel deployed on the surface of a cylinder
  5096. */
  5097. export class CylinderPanel extends VolumeBasedPanel {
  5098. /**
  5099. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  5100. */
  5101. radius: BABYLON.float;
  5102. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5103. }
  5104. }
  5105. declare module BABYLON.GUI {
  5106. /**
  5107. * Class used to create a holographic button in 3D
  5108. */
  5109. export class HolographicButton extends Button3D {
  5110. /**
  5111. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  5112. */
  5113. tooltipText: BABYLON.Nullable<string>;
  5114. /**
  5115. * Gets or sets text for the button
  5116. */
  5117. text: string;
  5118. /**
  5119. * Gets or sets the image url for the button
  5120. */
  5121. imageUrl: string;
  5122. /**
  5123. * Gets the back material used by this button
  5124. */
  5125. readonly backMaterial: FluentMaterial;
  5126. /**
  5127. * Gets the front material used by this button
  5128. */
  5129. readonly frontMaterial: FluentMaterial;
  5130. /**
  5131. * Gets the plate material used by this button
  5132. */
  5133. readonly plateMaterial: BABYLON.StandardMaterial;
  5134. /**
  5135. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  5136. */
  5137. readonly shareMaterials: boolean;
  5138. /**
  5139. * Creates a new button
  5140. * @param name defines the control name
  5141. */
  5142. constructor(name?: string, shareMaterials?: boolean);
  5143. protected _getTypeName(): string;
  5144. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5145. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5146. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  5147. /**
  5148. * Releases all associated resources
  5149. */
  5150. dispose(): void;
  5151. }
  5152. }
  5153. declare module BABYLON.GUI {
  5154. /**
  5155. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  5156. */
  5157. export class MeshButton3D extends Button3D {
  5158. /** @hidden */
  5159. protected _currentMesh: BABYLON.Mesh;
  5160. /**
  5161. * Creates a new 3D button based on a mesh
  5162. * @param mesh mesh to become a 3D button
  5163. * @param name defines the control name
  5164. */
  5165. constructor(mesh: BABYLON.Mesh, name?: string);
  5166. protected _getTypeName(): string;
  5167. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5168. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5169. }
  5170. }
  5171. declare module BABYLON.GUI {
  5172. /**
  5173. * Class used to create a container panel deployed on the surface of a plane
  5174. */
  5175. export class PlanePanel extends VolumeBasedPanel {
  5176. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5177. }
  5178. }
  5179. declare module BABYLON.GUI {
  5180. /**
  5181. * Class used to create a container panel where items get randomized planar mapping
  5182. */
  5183. export class ScatterPanel extends VolumeBasedPanel {
  5184. /**
  5185. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  5186. */
  5187. iteration: BABYLON.float;
  5188. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5189. protected _finalProcessing(): void;
  5190. }
  5191. }
  5192. declare module BABYLON.GUI {
  5193. /**
  5194. * Class used to create a container panel deployed on the surface of a sphere
  5195. */
  5196. export class SpherePanel extends VolumeBasedPanel {
  5197. /**
  5198. * Gets or sets the radius of the sphere where to project controls (5 by default)
  5199. */
  5200. radius: BABYLON.float;
  5201. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5202. }
  5203. }
  5204. declare module BABYLON.GUI {
  5205. /**
  5206. * Class used to create a stack panel in 3D on XY plane
  5207. */
  5208. export class StackPanel3D extends Container3D {
  5209. /**
  5210. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  5211. */
  5212. isVertical: boolean;
  5213. /**
  5214. * Gets or sets the distance between elements
  5215. */
  5216. margin: number;
  5217. /**
  5218. * Creates new StackPanel
  5219. * @param isVertical
  5220. */
  5221. constructor(isVertical?: boolean);
  5222. protected _arrangeChildren(): void;
  5223. }
  5224. }
  5225. declare module BABYLON.GUI {
  5226. /**
  5227. * Abstract class used to create a container panel deployed on the surface of a volume
  5228. */
  5229. export abstract class VolumeBasedPanel extends Container3D {
  5230. protected _cellWidth: number;
  5231. protected _cellHeight: number;
  5232. /**
  5233. * Gets or sets the distance between elements
  5234. */
  5235. margin: number;
  5236. /**
  5237. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  5238. * | Value | Type | Description |
  5239. * | ----- | ----------------------------------- | ----------- |
  5240. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  5241. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  5242. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  5243. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  5244. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  5245. */
  5246. orientation: number;
  5247. /**
  5248. * Gets or sets the number of columns requested (10 by default).
  5249. * The panel will automatically compute the number of rows based on number of child controls.
  5250. */
  5251. columns: BABYLON.int;
  5252. /**
  5253. * Gets or sets a the number of rows requested.
  5254. * The panel will automatically compute the number of columns based on number of child controls.
  5255. */
  5256. rows: BABYLON.int;
  5257. /**
  5258. * Creates new VolumeBasedPanel
  5259. */
  5260. constructor();
  5261. protected _arrangeChildren(): void;
  5262. /** Child classes must implement this function to provide correct control positioning */
  5263. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5264. /** Child classes can implement this function to provide additional processing */
  5265. protected _finalProcessing(): void;
  5266. }
  5267. }
  5268. declare module BABYLON.GUI {
  5269. /** @hidden */
  5270. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  5271. INNERGLOW: boolean;
  5272. BORDER: boolean;
  5273. HOVERLIGHT: boolean;
  5274. TEXTURE: boolean;
  5275. constructor();
  5276. }
  5277. /**
  5278. * Class used to render controls with fluent desgin
  5279. */
  5280. export class FluentMaterial extends BABYLON.PushMaterial {
  5281. /**
  5282. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  5283. */
  5284. innerGlowColorIntensity: number;
  5285. /**
  5286. * Gets or sets the inner glow color (white by default)
  5287. */
  5288. innerGlowColor: BABYLON.Color3;
  5289. /**
  5290. * Gets or sets alpha value (default is 1.0)
  5291. */
  5292. alpha: number;
  5293. /**
  5294. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  5295. */
  5296. albedoColor: BABYLON.Color3;
  5297. /**
  5298. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  5299. */
  5300. renderBorders: boolean;
  5301. /**
  5302. * Gets or sets border width (default is 0.5)
  5303. */
  5304. borderWidth: number;
  5305. /**
  5306. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  5307. */
  5308. edgeSmoothingValue: number;
  5309. /**
  5310. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  5311. */
  5312. borderMinValue: number;
  5313. /**
  5314. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  5315. */
  5316. renderHoverLight: boolean;
  5317. /**
  5318. * Gets or sets the radius used to render the hover light (default is 1.0)
  5319. */
  5320. hoverRadius: number;
  5321. /**
  5322. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  5323. */
  5324. hoverColor: BABYLON.Color4;
  5325. /**
  5326. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  5327. */
  5328. hoverPosition: BABYLON.Vector3;
  5329. /** Gets or sets the texture to use for albedo color */
  5330. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  5331. /**
  5332. * Creates a new Fluent material
  5333. * @param name defines the name of the material
  5334. * @param scene defines the hosting scene
  5335. */
  5336. constructor(name: string, scene: BABYLON.Scene);
  5337. needAlphaBlending(): boolean;
  5338. needAlphaTesting(): boolean;
  5339. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  5340. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  5341. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  5342. getActiveTextures(): BABYLON.BaseTexture[];
  5343. hasTexture(texture: BABYLON.BaseTexture): boolean;
  5344. dispose(forceDisposeEffect?: boolean): void;
  5345. clone(name: string): FluentMaterial;
  5346. serialize(): any;
  5347. getClassName(): string;
  5348. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  5349. }
  5350. }