babylon.gui.module.d.ts 243 KB

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