babylon.gui.module.d.ts 243 KB

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