babylon.gui.module.d.ts 246 KB

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