babylon.gui.module.d.ts 344 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400
  1. declare module "babylonjs-gui/2D/valueAndUnit" {
  2. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3. /**
  4. * Class used to specific a value and its associated unit
  5. */
  6. export class ValueAndUnit {
  7. /** defines the unit to store */
  8. unit: number;
  9. /** defines a boolean indicating if the value can be negative */
  10. negativeValueAllowed: boolean;
  11. private _value;
  12. private _originalUnit;
  13. /**
  14. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  15. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  16. */
  17. ignoreAdaptiveScaling: boolean;
  18. /**
  19. * Creates a new ValueAndUnit
  20. * @param value defines the value to store
  21. * @param unit defines the unit to store
  22. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  23. */
  24. constructor(value: number,
  25. /** defines the unit to store */
  26. unit?: number,
  27. /** defines a boolean indicating if the value can be negative */
  28. negativeValueAllowed?: boolean);
  29. /** Gets a boolean indicating if the value is a percentage */
  30. get isPercentage(): boolean;
  31. /** Gets a boolean indicating if the value is store as pixel */
  32. get isPixel(): boolean;
  33. /** Gets direct internal value */
  34. get internalValue(): number;
  35. /**
  36. * Gets value as pixel
  37. * @param host defines the root host
  38. * @param refValue defines the reference value for percentages
  39. * @returns the value as pixel
  40. */
  41. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  42. /**
  43. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  44. * @param value defines the value to store
  45. * @param unit defines the unit to store
  46. * @returns the current ValueAndUnit
  47. */
  48. updateInPlace(value: number, unit?: number): ValueAndUnit;
  49. /**
  50. * Gets the value accordingly to its unit
  51. * @param host defines the root host
  52. * @returns the value
  53. */
  54. getValue(host: AdvancedDynamicTexture): number;
  55. /**
  56. * Gets a string representation of the value
  57. * @param host defines the root host
  58. * @param decimals defines an optional number of decimals to display
  59. * @returns a string
  60. */
  61. toString(host: AdvancedDynamicTexture, decimals?: number): string;
  62. /**
  63. * Store a value parsed from a string
  64. * @param source defines the source string
  65. * @returns true if the value was successfully parsed
  66. */
  67. fromString(source: string | number): boolean;
  68. private static _Regex;
  69. private static _UNITMODE_PERCENTAGE;
  70. private static _UNITMODE_PIXEL;
  71. /** UNITMODE_PERCENTAGE */
  72. static get UNITMODE_PERCENTAGE(): number;
  73. /** UNITMODE_PIXEL */
  74. static get UNITMODE_PIXEL(): number;
  75. }
  76. }
  77. declare module "babylonjs-gui/2D/style" {
  78. import { Observable } from "babylonjs/Misc/observable";
  79. import { IDisposable } from "babylonjs/scene";
  80. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  81. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  82. /**
  83. * Define a style used by control to automatically setup properties based on a template.
  84. * Only support font related properties so far
  85. */
  86. export class Style implements IDisposable {
  87. private _fontFamily;
  88. private _fontStyle;
  89. private _fontWeight;
  90. /** @hidden */
  91. _host: AdvancedDynamicTexture;
  92. /** @hidden */
  93. _fontSize: ValueAndUnit;
  94. /**
  95. * Observable raised when the style values are changed
  96. */
  97. onChangedObservable: Observable<Style>;
  98. /**
  99. * Creates a new style object
  100. * @param host defines the AdvancedDynamicTexture which hosts this style
  101. */
  102. constructor(host: AdvancedDynamicTexture);
  103. /**
  104. * Gets or sets the font size
  105. */
  106. get fontSize(): string | number;
  107. set fontSize(value: string | number);
  108. /**
  109. * Gets or sets the font family
  110. */
  111. get fontFamily(): string;
  112. set fontFamily(value: string);
  113. /**
  114. * Gets or sets the font style
  115. */
  116. get fontStyle(): string;
  117. set fontStyle(value: string);
  118. /** Gets or sets font weight */
  119. get fontWeight(): string;
  120. set fontWeight(value: string);
  121. /** Dispose all associated resources */
  122. dispose(): void;
  123. }
  124. }
  125. declare module "babylonjs-gui/2D/math2D" {
  126. import { Nullable } from "babylonjs/types";
  127. import { Vector2 } from "babylonjs/Maths/math";
  128. /**
  129. * Class used to transport Vector2 information for pointer events
  130. */
  131. export class Vector2WithInfo extends Vector2 {
  132. /** defines the current mouse button index */
  133. buttonIndex: number;
  134. /**
  135. * Creates a new Vector2WithInfo
  136. * @param source defines the vector2 data to transport
  137. * @param buttonIndex defines the current mouse button index
  138. */
  139. constructor(source: Vector2,
  140. /** defines the current mouse button index */
  141. buttonIndex?: number);
  142. }
  143. /** Class used to provide 2D matrix features */
  144. export class Matrix2D {
  145. /** Gets the internal array of 6 floats used to store matrix data */
  146. m: Float32Array;
  147. /**
  148. * Creates a new matrix
  149. * @param m00 defines value for (0, 0)
  150. * @param m01 defines value for (0, 1)
  151. * @param m10 defines value for (1, 0)
  152. * @param m11 defines value for (1, 1)
  153. * @param m20 defines value for (2, 0)
  154. * @param m21 defines value for (2, 1)
  155. */
  156. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  157. /**
  158. * Fills the matrix from direct values
  159. * @param m00 defines value for (0, 0)
  160. * @param m01 defines value for (0, 1)
  161. * @param m10 defines value for (1, 0)
  162. * @param m11 defines value for (1, 1)
  163. * @param m20 defines value for (2, 0)
  164. * @param m21 defines value for (2, 1)
  165. * @returns the current modified matrix
  166. */
  167. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  168. /**
  169. * Gets matrix determinant
  170. * @returns the determinant
  171. */
  172. determinant(): number;
  173. /**
  174. * Inverses the matrix and stores it in a target matrix
  175. * @param result defines the target matrix
  176. * @returns the current matrix
  177. */
  178. invertToRef(result: Matrix2D): Matrix2D;
  179. /**
  180. * Multiplies the current matrix with another one
  181. * @param other defines the second operand
  182. * @param result defines the target matrix
  183. * @returns the current matrix
  184. */
  185. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  186. /**
  187. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  188. * @param x defines the x coordinate to transform
  189. * @param y defines the x coordinate to transform
  190. * @param result defines the target vector2
  191. * @returns the current matrix
  192. */
  193. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  194. /**
  195. * Creates an identity matrix
  196. * @returns a new matrix
  197. */
  198. static Identity(): Matrix2D;
  199. /**
  200. * Creates a translation matrix and stores it in a target matrix
  201. * @param x defines the x coordinate of the translation
  202. * @param y defines the y coordinate of the translation
  203. * @param result defines the target matrix
  204. */
  205. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  206. /**
  207. * Creates a scaling matrix and stores it in a target matrix
  208. * @param x defines the x coordinate of the scaling
  209. * @param y defines the y coordinate of the scaling
  210. * @param result defines the target matrix
  211. */
  212. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  213. /**
  214. * Creates a rotation matrix and stores it in a target matrix
  215. * @param angle defines the rotation angle
  216. * @param result defines the target matrix
  217. */
  218. static RotationToRef(angle: number, result: Matrix2D): void;
  219. private static _TempPreTranslationMatrix;
  220. private static _TempPostTranslationMatrix;
  221. private static _TempRotationMatrix;
  222. private static _TempScalingMatrix;
  223. private static _TempCompose0;
  224. private static _TempCompose1;
  225. private static _TempCompose2;
  226. /**
  227. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  228. * @param tx defines the x coordinate of the translation
  229. * @param ty defines the y coordinate of the translation
  230. * @param angle defines the rotation angle
  231. * @param scaleX defines the x coordinate of the scaling
  232. * @param scaleY defines the y coordinate of the scaling
  233. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  234. * @param result defines the target matrix
  235. */
  236. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  237. }
  238. }
  239. declare module "babylonjs-gui/2D/measure" {
  240. import { Matrix2D } from "babylonjs-gui/2D/math2D";
  241. /**
  242. * Class used to store 2D control sizes
  243. */
  244. export class Measure {
  245. /** defines left coordinate */
  246. left: number;
  247. /** defines top coordinate */
  248. top: number;
  249. /** defines width dimension */
  250. width: number;
  251. /** defines height dimension */
  252. height: number;
  253. /**
  254. * Creates a new measure
  255. * @param left defines left coordinate
  256. * @param top defines top coordinate
  257. * @param width defines width dimension
  258. * @param height defines height dimension
  259. */
  260. constructor(
  261. /** defines left coordinate */
  262. left: number,
  263. /** defines top coordinate */
  264. top: number,
  265. /** defines width dimension */
  266. width: number,
  267. /** defines height dimension */
  268. height: number);
  269. /**
  270. * Copy from another measure
  271. * @param other defines the other measure to copy from
  272. */
  273. copyFrom(other: Measure): void;
  274. /**
  275. * Copy from a group of 4 floats
  276. * @param left defines left coordinate
  277. * @param top defines top coordinate
  278. * @param width defines width dimension
  279. * @param height defines height dimension
  280. */
  281. copyFromFloats(left: number, top: number, width: number, height: number): void;
  282. /**
  283. * Computes the axis aligned bounding box measure for two given measures
  284. * @param a Input measure
  285. * @param b Input measure
  286. * @param result the resulting bounding measure
  287. */
  288. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  289. /**
  290. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  291. * @param transform the matrix to transform the measure before computing the AABB
  292. * @param result the resulting AABB
  293. */
  294. transformToRef(transform: Matrix2D, result: Measure): void;
  295. /**
  296. * Check equality between this measure and another one
  297. * @param other defines the other measures
  298. * @returns true if both measures are equals
  299. */
  300. isEqualsTo(other: Measure): boolean;
  301. /**
  302. * Creates an empty measure
  303. * @returns a new measure
  304. */
  305. static Empty(): Measure;
  306. }
  307. }
  308. declare module "babylonjs-gui/2D/advancedDynamicTexture" {
  309. import { Nullable } from "babylonjs/types";
  310. import { Observable } from "babylonjs/Misc/observable";
  311. import { Viewport, Vector2, Vector3, Matrix } from "babylonjs/Maths/math";
  312. import { ClipboardInfo } from "babylonjs/Events/clipboardEvents";
  313. import { DynamicTexture } from "babylonjs/Materials/Textures/dynamicTexture";
  314. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  315. import { Layer } from "babylonjs/Layers/layer";
  316. import { Scene } from "babylonjs/scene";
  317. import { Container } from "babylonjs-gui/2D/controls/container";
  318. import { Control } from "babylonjs-gui/2D/controls/control";
  319. import { Style } from "babylonjs-gui/2D/style";
  320. /**
  321. * Interface used to define a control that can receive focus
  322. */
  323. export interface IFocusableControl {
  324. /**
  325. * Function called when the control receives the focus
  326. */
  327. onFocus(): void;
  328. /**
  329. * Function called when the control loses the focus
  330. */
  331. onBlur(): void;
  332. /**
  333. * Function called to let the control handle keyboard events
  334. * @param evt defines the current keyboard event
  335. */
  336. processKeyboard(evt: KeyboardEvent): void;
  337. /**
  338. * Function called to get the list of controls that should not steal the focus from this control
  339. * @returns an array of controls
  340. */
  341. keepsFocusWith(): Nullable<Control[]>;
  342. }
  343. /**
  344. * Class used to create texture to support 2D GUI elements
  345. * @see http://doc.babylonjs.com/how_to/gui
  346. */
  347. export class AdvancedDynamicTexture extends DynamicTexture {
  348. private _isDirty;
  349. private _renderObserver;
  350. private _resizeObserver;
  351. private _preKeyboardObserver;
  352. private _pointerMoveObserver;
  353. private _pointerObserver;
  354. private _canvasPointerOutObserver;
  355. private _background;
  356. /** @hidden */
  357. _rootContainer: Container;
  358. /** @hidden */
  359. _lastPickedControl: Control;
  360. /** @hidden */
  361. _lastControlOver: {
  362. [pointerId: number]: Control;
  363. };
  364. /** @hidden */
  365. _lastControlDown: {
  366. [pointerId: number]: Control;
  367. };
  368. /** @hidden */
  369. _capturingControl: {
  370. [pointerId: number]: Control;
  371. };
  372. /** @hidden */
  373. _shouldBlockPointer: boolean;
  374. /** @hidden */
  375. _layerToDispose: Nullable<Layer>;
  376. /** @hidden */
  377. _linkedControls: Control[];
  378. private _isFullscreen;
  379. private _fullscreenViewport;
  380. private _idealWidth;
  381. private _idealHeight;
  382. private _useSmallestIdeal;
  383. private _renderAtIdealSize;
  384. private _focusedControl;
  385. private _blockNextFocusCheck;
  386. private _renderScale;
  387. private _rootElement;
  388. private _cursorChanged;
  389. /** @hidden */
  390. _numLayoutCalls: number;
  391. /** Gets the number of layout calls made the last time the ADT has been rendered */
  392. get numLayoutCalls(): number;
  393. /** @hidden */
  394. _numRenderCalls: number;
  395. /** Gets the number of render calls made the last time the ADT has been rendered */
  396. get numRenderCalls(): number;
  397. /**
  398. * Define type to string to ensure compatibility across browsers
  399. * Safari doesn't support DataTransfer constructor
  400. */
  401. private _clipboardData;
  402. /**
  403. * Observable event triggered each time an clipboard event is received from the rendering canvas
  404. */
  405. onClipboardObservable: Observable<ClipboardInfo>;
  406. /**
  407. * Observable event triggered each time a pointer down is intercepted by a control
  408. */
  409. onControlPickedObservable: Observable<Control>;
  410. /**
  411. * Observable event triggered before layout is evaluated
  412. */
  413. onBeginLayoutObservable: Observable<AdvancedDynamicTexture>;
  414. /**
  415. * Observable event triggered after the layout was evaluated
  416. */
  417. onEndLayoutObservable: Observable<AdvancedDynamicTexture>;
  418. /**
  419. * Observable event triggered before the texture is rendered
  420. */
  421. onBeginRenderObservable: Observable<AdvancedDynamicTexture>;
  422. /**
  423. * Observable event triggered after the texture was rendered
  424. */
  425. onEndRenderObservable: Observable<AdvancedDynamicTexture>;
  426. /**
  427. * Gets or sets a boolean defining if alpha is stored as premultiplied
  428. */
  429. premulAlpha: boolean;
  430. /**
  431. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  432. * Useful when you want more antialiasing
  433. */
  434. get renderScale(): number;
  435. set renderScale(value: number);
  436. /** Gets or sets the background color */
  437. get background(): string;
  438. set background(value: string);
  439. /**
  440. * Gets or sets the ideal width used to design controls.
  441. * The GUI will then rescale everything accordingly
  442. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  443. */
  444. get idealWidth(): number;
  445. set idealWidth(value: number);
  446. /**
  447. * Gets or sets the ideal height used to design controls.
  448. * The GUI will then rescale everything accordingly
  449. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  450. */
  451. get idealHeight(): number;
  452. set idealHeight(value: number);
  453. /**
  454. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  455. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  456. */
  457. get useSmallestIdeal(): boolean;
  458. set useSmallestIdeal(value: boolean);
  459. /**
  460. * Gets or sets a boolean indicating if adaptive scaling must be used
  461. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  462. */
  463. get renderAtIdealSize(): boolean;
  464. set renderAtIdealSize(value: boolean);
  465. /**
  466. * Gets the ratio used when in "ideal mode"
  467. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  468. * */
  469. get idealRatio(): number;
  470. /**
  471. * Gets the underlying layer used to render the texture when in fullscreen mode
  472. */
  473. get layer(): Nullable<Layer>;
  474. /**
  475. * Gets the root container control
  476. */
  477. get rootContainer(): Container;
  478. /**
  479. * Returns an array containing the root container.
  480. * This is mostly used to let the Inspector introspects the ADT
  481. * @returns an array containing the rootContainer
  482. */
  483. getChildren(): Array<Container>;
  484. /**
  485. * Will return all controls that are inside this texture
  486. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  487. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  488. * @return all child controls
  489. */
  490. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  491. /**
  492. * Gets or sets the current focused control
  493. */
  494. get focusedControl(): Nullable<IFocusableControl>;
  495. set focusedControl(control: Nullable<IFocusableControl>);
  496. /**
  497. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  498. */
  499. get isForeground(): boolean;
  500. set isForeground(value: boolean);
  501. /**
  502. * Gets or set information about clipboardData
  503. */
  504. get clipboardData(): string;
  505. set clipboardData(value: string);
  506. /**
  507. * Creates a new AdvancedDynamicTexture
  508. * @param name defines the name of the texture
  509. * @param width defines the width of the texture
  510. * @param height defines the height of the texture
  511. * @param scene defines the hosting scene
  512. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  513. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  514. */
  515. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  516. /**
  517. * Get the current class name of the texture useful for serialization or dynamic coding.
  518. * @returns "AdvancedDynamicTexture"
  519. */
  520. getClassName(): string;
  521. /**
  522. * Function used to execute a function on all controls
  523. * @param func defines the function to execute
  524. * @param container defines the container where controls belong. If null the root container will be used
  525. */
  526. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  527. private _useInvalidateRectOptimization;
  528. /**
  529. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  530. */
  531. get useInvalidateRectOptimization(): boolean;
  532. set useInvalidateRectOptimization(value: boolean);
  533. private _invalidatedRectangle;
  534. /**
  535. * Invalidates a rectangle area on the gui texture
  536. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  537. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  538. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  539. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  540. */
  541. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  542. /**
  543. * Marks the texture as dirty forcing a complete update
  544. */
  545. markAsDirty(): void;
  546. /**
  547. * Helper function used to create a new style
  548. * @returns a new style
  549. * @see http://doc.babylonjs.com/how_to/gui#styles
  550. */
  551. createStyle(): Style;
  552. /**
  553. * Adds a new control to the root container
  554. * @param control defines the control to add
  555. * @returns the current texture
  556. */
  557. addControl(control: Control): AdvancedDynamicTexture;
  558. /**
  559. * Removes a control from the root container
  560. * @param control defines the control to remove
  561. * @returns the current texture
  562. */
  563. removeControl(control: Control): AdvancedDynamicTexture;
  564. /**
  565. * Release all resources
  566. */
  567. dispose(): void;
  568. private _onResize;
  569. /** @hidden */
  570. _getGlobalViewport(scene: Scene): Viewport;
  571. /**
  572. * Get screen coordinates for a vector3
  573. * @param position defines the position to project
  574. * @param worldMatrix defines the world matrix to use
  575. * @returns the projected position
  576. */
  577. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  578. private _checkUpdate;
  579. private _clearMeasure;
  580. private _render;
  581. /** @hidden */
  582. _changeCursor(cursor: string): void;
  583. /** @hidden */
  584. _registerLastControlDown(control: Control, pointerId: number): void;
  585. private _doPicking;
  586. /** @hidden */
  587. _cleanControlAfterRemovalFromList(list: {
  588. [pointerId: number]: Control;
  589. }, control: Control): void;
  590. /** @hidden */
  591. _cleanControlAfterRemoval(control: Control): void;
  592. /** Attach to all scene events required to support pointer events */
  593. attach(): void;
  594. /** @hidden */
  595. private onClipboardCopy;
  596. /** @hidden */
  597. private onClipboardCut;
  598. /** @hidden */
  599. private onClipboardPaste;
  600. /**
  601. * Register the clipboard Events onto the canvas
  602. */
  603. registerClipboardEvents(): void;
  604. /**
  605. * Unregister the clipboard Events from the canvas
  606. */
  607. unRegisterClipboardEvents(): void;
  608. /**
  609. * Connect the texture to a hosting mesh to enable interactions
  610. * @param mesh defines the mesh to attach to
  611. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  612. */
  613. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  614. /**
  615. * Move the focus to a specific control
  616. * @param control defines the control which will receive the focus
  617. */
  618. moveFocusToControl(control: IFocusableControl): void;
  619. private _manageFocus;
  620. private _attachToOnPointerOut;
  621. /**
  622. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  623. * @param mesh defines the mesh which will receive the texture
  624. * @param width defines the texture width (1024 by default)
  625. * @param height defines the texture height (1024 by default)
  626. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  627. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  628. * @returns a new AdvancedDynamicTexture
  629. */
  630. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  631. /**
  632. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  633. * In this mode the texture will rely on a layer for its rendering.
  634. * This allows it to be treated like any other layer.
  635. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  636. * LayerMask is set through advancedTexture.layer.layerMask
  637. * @param name defines name for the texture
  638. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  639. * @param scene defines the hsoting scene
  640. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  641. * @returns a new AdvancedDynamicTexture
  642. */
  643. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  644. }
  645. }
  646. declare module "babylonjs-gui/2D/controls/control" {
  647. import { Nullable } from "babylonjs/types";
  648. import { Observable } from "babylonjs/Misc/observable";
  649. import { Vector2, Vector3 } from "babylonjs/Maths/math";
  650. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  651. import { Scene } from "babylonjs/scene";
  652. import { Container } from "babylonjs-gui/2D/controls/container";
  653. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  654. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  655. import { Measure } from "babylonjs-gui/2D/measure";
  656. import { Style } from "babylonjs-gui/2D/style";
  657. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  658. /**
  659. * Root class used for all 2D controls
  660. * @see http://doc.babylonjs.com/how_to/gui#controls
  661. */
  662. export class Control {
  663. /** defines the name of the control */
  664. name?: string | undefined;
  665. /**
  666. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  667. */
  668. static AllowAlphaInheritance: boolean;
  669. private _alpha;
  670. private _alphaSet;
  671. private _zIndex;
  672. /** @hidden */
  673. _host: AdvancedDynamicTexture;
  674. /** Gets or sets the control parent */
  675. parent: Nullable<Container>;
  676. /** @hidden */
  677. _currentMeasure: Measure;
  678. private _fontFamily;
  679. private _fontStyle;
  680. private _fontWeight;
  681. private _fontSize;
  682. private _font;
  683. /** @hidden */
  684. _width: ValueAndUnit;
  685. /** @hidden */
  686. _height: ValueAndUnit;
  687. /** @hidden */
  688. protected _fontOffset: {
  689. ascent: number;
  690. height: number;
  691. descent: number;
  692. };
  693. private _color;
  694. private _style;
  695. private _styleObserver;
  696. /** @hidden */
  697. protected _horizontalAlignment: number;
  698. /** @hidden */
  699. protected _verticalAlignment: number;
  700. /** @hidden */
  701. protected _isDirty: boolean;
  702. /** @hidden */
  703. protected _wasDirty: boolean;
  704. /** @hidden */
  705. _tempParentMeasure: Measure;
  706. /** @hidden */
  707. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  708. /** @hidden */
  709. protected _cachedParentMeasure: Measure;
  710. private _paddingLeft;
  711. private _paddingRight;
  712. private _paddingTop;
  713. private _paddingBottom;
  714. /** @hidden */
  715. _left: ValueAndUnit;
  716. /** @hidden */
  717. _top: ValueAndUnit;
  718. private _scaleX;
  719. private _scaleY;
  720. private _rotation;
  721. private _transformCenterX;
  722. private _transformCenterY;
  723. /** @hidden */
  724. _transformMatrix: Matrix2D;
  725. /** @hidden */
  726. protected _invertTransformMatrix: Matrix2D;
  727. /** @hidden */
  728. protected _transformedPosition: Vector2;
  729. private _isMatrixDirty;
  730. private _cachedOffsetX;
  731. private _cachedOffsetY;
  732. private _isVisible;
  733. private _isHighlighted;
  734. /** @hidden */
  735. _linkedMesh: Nullable<AbstractMesh>;
  736. private _fontSet;
  737. private _dummyVector2;
  738. private _downCount;
  739. private _enterCount;
  740. private _doNotRender;
  741. private _downPointerIds;
  742. protected _isEnabled: boolean;
  743. protected _disabledColor: string;
  744. /** @hidden */
  745. protected _rebuildLayout: boolean;
  746. /** @hidden */
  747. _customData: any;
  748. /** @hidden */
  749. _isClipped: boolean;
  750. /** @hidden */
  751. _automaticSize: boolean;
  752. /** @hidden */
  753. _tag: any;
  754. /**
  755. * Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
  756. */
  757. uniqueId: number;
  758. /**
  759. * Gets or sets an object used to store user defined information for the node
  760. */
  761. metadata: any;
  762. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  763. isHitTestVisible: boolean;
  764. /** Gets or sets a boolean indicating if the control can block pointer events */
  765. isPointerBlocker: boolean;
  766. /** Gets or sets a boolean indicating if the control can be focusable */
  767. isFocusInvisible: boolean;
  768. /**
  769. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  770. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  771. */
  772. clipChildren: boolean;
  773. /**
  774. * Gets or sets a boolean indicating that control content must be clipped
  775. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  776. */
  777. clipContent: boolean;
  778. /**
  779. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  780. */
  781. useBitmapCache: boolean;
  782. private _cacheData;
  783. private _shadowOffsetX;
  784. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  785. get shadowOffsetX(): number;
  786. set shadowOffsetX(value: number);
  787. private _shadowOffsetY;
  788. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  789. get shadowOffsetY(): number;
  790. set shadowOffsetY(value: number);
  791. private _shadowBlur;
  792. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  793. get shadowBlur(): number;
  794. set shadowBlur(value: number);
  795. private _shadowColor;
  796. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  797. get shadowColor(): string;
  798. set shadowColor(value: string);
  799. /** Gets or sets the cursor to use when the control is hovered */
  800. hoverCursor: string;
  801. /** @hidden */
  802. protected _linkOffsetX: ValueAndUnit;
  803. /** @hidden */
  804. protected _linkOffsetY: ValueAndUnit;
  805. /** Gets the control type name */
  806. get typeName(): string;
  807. /**
  808. * Get the current class name of the control.
  809. * @returns current class name
  810. */
  811. getClassName(): string;
  812. /**
  813. * An event triggered when the pointer move over the control.
  814. */
  815. onPointerMoveObservable: Observable<Vector2>;
  816. /**
  817. * An event triggered when the pointer move out of the control.
  818. */
  819. onPointerOutObservable: Observable<Control>;
  820. /**
  821. * An event triggered when the pointer taps the control
  822. */
  823. onPointerDownObservable: Observable<Vector2WithInfo>;
  824. /**
  825. * An event triggered when pointer up
  826. */
  827. onPointerUpObservable: Observable<Vector2WithInfo>;
  828. /**
  829. * An event triggered when a control is clicked on
  830. */
  831. onPointerClickObservable: Observable<Vector2WithInfo>;
  832. /**
  833. * An event triggered when pointer enters the control
  834. */
  835. onPointerEnterObservable: Observable<Control>;
  836. /**
  837. * An event triggered when the control is marked as dirty
  838. */
  839. onDirtyObservable: Observable<Control>;
  840. /**
  841. * An event triggered before drawing the control
  842. */
  843. onBeforeDrawObservable: Observable<Control>;
  844. /**
  845. * An event triggered after the control was drawn
  846. */
  847. onAfterDrawObservable: Observable<Control>;
  848. /**
  849. * Get the hosting AdvancedDynamicTexture
  850. */
  851. get host(): AdvancedDynamicTexture;
  852. /** Gets or set information about font offsets (used to render and align text) */
  853. get fontOffset(): {
  854. ascent: number;
  855. height: number;
  856. descent: number;
  857. };
  858. set fontOffset(offset: {
  859. ascent: number;
  860. height: number;
  861. descent: number;
  862. });
  863. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  864. get alpha(): number;
  865. set alpha(value: number);
  866. /**
  867. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  868. */
  869. get isHighlighted(): boolean;
  870. set isHighlighted(value: boolean);
  871. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  872. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  873. */
  874. get scaleX(): number;
  875. set scaleX(value: number);
  876. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  877. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  878. */
  879. get scaleY(): number;
  880. set scaleY(value: number);
  881. /** Gets or sets the rotation angle (0 by default)
  882. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  883. */
  884. get rotation(): number;
  885. set rotation(value: number);
  886. /** Gets or sets the transformation center on Y axis (0 by default)
  887. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  888. */
  889. get transformCenterY(): number;
  890. set transformCenterY(value: number);
  891. /** Gets or sets the transformation center on X axis (0 by default)
  892. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  893. */
  894. get transformCenterX(): number;
  895. set transformCenterX(value: number);
  896. /**
  897. * Gets or sets the horizontal alignment
  898. * @see http://doc.babylonjs.com/how_to/gui#alignments
  899. */
  900. get horizontalAlignment(): number;
  901. set horizontalAlignment(value: number);
  902. /**
  903. * Gets or sets the vertical alignment
  904. * @see http://doc.babylonjs.com/how_to/gui#alignments
  905. */
  906. get verticalAlignment(): number;
  907. set verticalAlignment(value: number);
  908. /**
  909. * Gets or sets control width
  910. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  911. */
  912. get width(): string | number;
  913. set width(value: string | number);
  914. /**
  915. * Gets or sets the control width in pixel
  916. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  917. */
  918. get widthInPixels(): number;
  919. set widthInPixels(value: number);
  920. /**
  921. * Gets or sets control height
  922. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  923. */
  924. get height(): string | number;
  925. set height(value: string | number);
  926. /**
  927. * Gets or sets control height in pixel
  928. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  929. */
  930. get heightInPixels(): number;
  931. set heightInPixels(value: number);
  932. /** Gets or set font family */
  933. get fontFamily(): string;
  934. set fontFamily(value: string);
  935. /** Gets or sets font style */
  936. get fontStyle(): string;
  937. set fontStyle(value: string);
  938. /** Gets or sets font weight */
  939. get fontWeight(): string;
  940. set fontWeight(value: string);
  941. /**
  942. * Gets or sets style
  943. * @see http://doc.babylonjs.com/how_to/gui#styles
  944. */
  945. get style(): Nullable<Style>;
  946. set style(value: Nullable<Style>);
  947. /** @hidden */
  948. get _isFontSizeInPercentage(): boolean;
  949. /** Gets or sets font size in pixels */
  950. get fontSizeInPixels(): number;
  951. set fontSizeInPixels(value: number);
  952. /** Gets or sets font size */
  953. get fontSize(): string | number;
  954. set fontSize(value: string | number);
  955. /** Gets or sets foreground color */
  956. get color(): string;
  957. set color(value: string);
  958. /** Gets or sets z index which is used to reorder controls on the z axis */
  959. get zIndex(): number;
  960. set zIndex(value: number);
  961. /** Gets or sets a boolean indicating if the control can be rendered */
  962. get notRenderable(): boolean;
  963. set notRenderable(value: boolean);
  964. /** Gets or sets a boolean indicating if the control is visible */
  965. get isVisible(): boolean;
  966. set isVisible(value: boolean);
  967. /** Gets a boolean indicating that the control needs to update its rendering */
  968. get isDirty(): boolean;
  969. /**
  970. * Gets the current linked mesh (or null if none)
  971. */
  972. get linkedMesh(): Nullable<AbstractMesh>;
  973. /**
  974. * Gets or sets a value indicating the padding to use on the left of the control
  975. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  976. */
  977. get paddingLeft(): string | number;
  978. set paddingLeft(value: string | number);
  979. /**
  980. * Gets or sets a value indicating the padding in pixels to use on the left of the control
  981. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  982. */
  983. get paddingLeftInPixels(): number;
  984. set paddingLeftInPixels(value: number);
  985. /**
  986. * Gets or sets a value indicating the padding to use on the right of the control
  987. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  988. */
  989. get paddingRight(): string | number;
  990. set paddingRight(value: string | number);
  991. /**
  992. * Gets or sets a value indicating the padding in pixels to use on the right of the control
  993. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  994. */
  995. get paddingRightInPixels(): number;
  996. set paddingRightInPixels(value: number);
  997. /**
  998. * Gets or sets a value indicating the padding to use on the top of the control
  999. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1000. */
  1001. get paddingTop(): string | number;
  1002. set paddingTop(value: string | number);
  1003. /**
  1004. * Gets or sets a value indicating the padding in pixels to use on the top of the control
  1005. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1006. */
  1007. get paddingTopInPixels(): number;
  1008. set paddingTopInPixels(value: number);
  1009. /**
  1010. * Gets or sets a value indicating the padding to use on the bottom of the control
  1011. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1012. */
  1013. get paddingBottom(): string | number;
  1014. set paddingBottom(value: string | number);
  1015. /**
  1016. * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
  1017. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1018. */
  1019. get paddingBottomInPixels(): number;
  1020. set paddingBottomInPixels(value: number);
  1021. /**
  1022. * Gets or sets a value indicating the left coordinate of the control
  1023. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1024. */
  1025. get left(): string | number;
  1026. set left(value: string | number);
  1027. /**
  1028. * Gets or sets a value indicating the left coordinate in pixels of the control
  1029. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1030. */
  1031. get leftInPixels(): number;
  1032. set leftInPixels(value: number);
  1033. /**
  1034. * Gets or sets a value indicating the top coordinate of the control
  1035. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1036. */
  1037. get top(): string | number;
  1038. set top(value: string | number);
  1039. /**
  1040. * Gets or sets a value indicating the top coordinate in pixels of the control
  1041. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1042. */
  1043. get topInPixels(): number;
  1044. set topInPixels(value: number);
  1045. /**
  1046. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1047. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1048. */
  1049. get linkOffsetX(): string | number;
  1050. set linkOffsetX(value: string | number);
  1051. /**
  1052. * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
  1053. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1054. */
  1055. get linkOffsetXInPixels(): number;
  1056. set linkOffsetXInPixels(value: number);
  1057. /**
  1058. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1059. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1060. */
  1061. get linkOffsetY(): string | number;
  1062. set linkOffsetY(value: string | number);
  1063. /**
  1064. * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
  1065. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1066. */
  1067. get linkOffsetYInPixels(): number;
  1068. set linkOffsetYInPixels(value: number);
  1069. /** Gets the center coordinate on X axis */
  1070. get centerX(): number;
  1071. /** Gets the center coordinate on Y axis */
  1072. get centerY(): number;
  1073. /** Gets or sets if control is Enabled*/
  1074. get isEnabled(): boolean;
  1075. set isEnabled(value: boolean);
  1076. /** Gets or sets background color of control if it's disabled*/
  1077. get disabledColor(): string;
  1078. set disabledColor(value: string);
  1079. /**
  1080. * Creates a new control
  1081. * @param name defines the name of the control
  1082. */
  1083. constructor(
  1084. /** defines the name of the control */
  1085. name?: string | undefined);
  1086. /** @hidden */
  1087. protected _getTypeName(): string;
  1088. /**
  1089. * Gets the first ascendant in the hierarchy of the given type
  1090. * @param className defines the required type
  1091. * @returns the ascendant or null if not found
  1092. */
  1093. getAscendantOfClass(className: string): Nullable<Control>;
  1094. /** @hidden */
  1095. _resetFontCache(): void;
  1096. /**
  1097. * Determines if a container is an ascendant of the current control
  1098. * @param container defines the container to look for
  1099. * @returns true if the container is one of the ascendant of the control
  1100. */
  1101. isAscendant(container: Control): boolean;
  1102. /**
  1103. * Gets coordinates in local control space
  1104. * @param globalCoordinates defines the coordinates to transform
  1105. * @returns the new coordinates in local space
  1106. */
  1107. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1108. /**
  1109. * Gets coordinates in local control space
  1110. * @param globalCoordinates defines the coordinates to transform
  1111. * @param result defines the target vector2 where to store the result
  1112. * @returns the current control
  1113. */
  1114. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1115. /**
  1116. * Gets coordinates in parent local control space
  1117. * @param globalCoordinates defines the coordinates to transform
  1118. * @returns the new coordinates in parent local space
  1119. */
  1120. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1121. /**
  1122. * Move the current control to a vector3 position projected onto the screen.
  1123. * @param position defines the target position
  1124. * @param scene defines the hosting scene
  1125. */
  1126. moveToVector3(position: Vector3, scene: Scene): void;
  1127. /**
  1128. * Will store all controls that have this control as ascendant in a given array
  1129. * @param results defines the array where to store the descendants
  1130. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1131. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1132. */
  1133. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1134. /**
  1135. * Will return all controls that have this control as ascendant
  1136. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1137. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1138. * @return all child controls
  1139. */
  1140. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1141. /**
  1142. * Link current control with a target mesh
  1143. * @param mesh defines the mesh to link with
  1144. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1145. */
  1146. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  1147. /** @hidden */
  1148. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1149. /** @hidden */
  1150. _offsetLeft(offset: number): void;
  1151. /** @hidden */
  1152. _offsetTop(offset: number): void;
  1153. /** @hidden */
  1154. _markMatrixAsDirty(): void;
  1155. /** @hidden */
  1156. _flagDescendantsAsMatrixDirty(): void;
  1157. /** @hidden */
  1158. _intersectsRect(rect: Measure): boolean;
  1159. /** @hidden */
  1160. protected invalidateRect(): void;
  1161. /** @hidden */
  1162. _markAsDirty(force?: boolean): void;
  1163. /** @hidden */
  1164. _markAllAsDirty(): void;
  1165. /** @hidden */
  1166. _link(host: AdvancedDynamicTexture): void;
  1167. /** @hidden */
  1168. protected _transform(context?: CanvasRenderingContext2D): void;
  1169. /** @hidden */
  1170. _renderHighlight(context: CanvasRenderingContext2D): void;
  1171. /** @hidden */
  1172. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1173. /** @hidden */
  1174. protected _applyStates(context: CanvasRenderingContext2D): void;
  1175. /** @hidden */
  1176. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1177. /** @hidden */
  1178. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1179. protected _evaluateClippingState(parentMeasure: Measure): void;
  1180. /** @hidden */
  1181. _measure(): void;
  1182. /** @hidden */
  1183. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1184. /** @hidden */
  1185. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1186. /** @hidden */
  1187. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1188. /** @hidden */
  1189. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1190. private static _ClipMeasure;
  1191. private _tmpMeasureA;
  1192. private _clip;
  1193. /** @hidden */
  1194. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): boolean;
  1195. /** @hidden */
  1196. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  1197. /**
  1198. * Tests if a given coordinates belong to the current control
  1199. * @param x defines x coordinate to test
  1200. * @param y defines y coordinate to test
  1201. * @returns true if the coordinates are inside the control
  1202. */
  1203. contains(x: number, y: number): boolean;
  1204. /** @hidden */
  1205. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1206. /** @hidden */
  1207. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number): void;
  1208. /** @hidden */
  1209. _onPointerEnter(target: Control): boolean;
  1210. /** @hidden */
  1211. _onPointerOut(target: Control, force?: boolean): void;
  1212. /** @hidden */
  1213. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1214. /** @hidden */
  1215. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1216. /** @hidden */
  1217. _forcePointerUp(pointerId?: Nullable<number>): void;
  1218. /** @hidden */
  1219. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1220. private _prepareFont;
  1221. /** Releases associated resources */
  1222. dispose(): void;
  1223. private static _HORIZONTAL_ALIGNMENT_LEFT;
  1224. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  1225. private static _HORIZONTAL_ALIGNMENT_CENTER;
  1226. private static _VERTICAL_ALIGNMENT_TOP;
  1227. private static _VERTICAL_ALIGNMENT_BOTTOM;
  1228. private static _VERTICAL_ALIGNMENT_CENTER;
  1229. /** HORIZONTAL_ALIGNMENT_LEFT */
  1230. static get HORIZONTAL_ALIGNMENT_LEFT(): number;
  1231. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1232. static get HORIZONTAL_ALIGNMENT_RIGHT(): number;
  1233. /** HORIZONTAL_ALIGNMENT_CENTER */
  1234. static get HORIZONTAL_ALIGNMENT_CENTER(): number;
  1235. /** VERTICAL_ALIGNMENT_TOP */
  1236. static get VERTICAL_ALIGNMENT_TOP(): number;
  1237. /** VERTICAL_ALIGNMENT_BOTTOM */
  1238. static get VERTICAL_ALIGNMENT_BOTTOM(): number;
  1239. /** VERTICAL_ALIGNMENT_CENTER */
  1240. static get VERTICAL_ALIGNMENT_CENTER(): number;
  1241. private static _FontHeightSizes;
  1242. /** @hidden */
  1243. static _GetFontOffset(font: string): {
  1244. ascent: number;
  1245. height: number;
  1246. descent: number;
  1247. };
  1248. /**
  1249. * Creates a stack panel that can be used to render headers
  1250. * @param control defines the control to associate with the header
  1251. * @param text defines the text of the header
  1252. * @param size defines the size of the header
  1253. * @param options defines options used to configure the header
  1254. * @returns a new StackPanel
  1255. * @ignore
  1256. * @hidden
  1257. */
  1258. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1259. isHorizontal: boolean;
  1260. controlFirst: boolean;
  1261. }) => any;
  1262. /** @hidden */
  1263. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1264. }
  1265. }
  1266. declare module "babylonjs-gui/2D/controls/container" {
  1267. import { Nullable } from "babylonjs/types";
  1268. import { Control } from "babylonjs-gui/2D/controls/control";
  1269. import { Measure } from "babylonjs-gui/2D/measure";
  1270. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  1271. /**
  1272. * Root class for 2D containers
  1273. * @see http://doc.babylonjs.com/how_to/gui#containers
  1274. */
  1275. export class Container extends Control {
  1276. name?: string | undefined;
  1277. /** @hidden */
  1278. _children: Control[];
  1279. /** @hidden */
  1280. protected _measureForChildren: Measure;
  1281. /** @hidden */
  1282. protected _background: string;
  1283. /** @hidden */
  1284. protected _adaptWidthToChildren: boolean;
  1285. /** @hidden */
  1286. protected _adaptHeightToChildren: boolean;
  1287. /**
  1288. * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
  1289. */
  1290. logLayoutCycleErrors: boolean;
  1291. /**
  1292. * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
  1293. */
  1294. maxLayoutCycle: number;
  1295. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  1296. get adaptHeightToChildren(): boolean;
  1297. set adaptHeightToChildren(value: boolean);
  1298. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  1299. get adaptWidthToChildren(): boolean;
  1300. set adaptWidthToChildren(value: boolean);
  1301. /** Gets or sets background color */
  1302. get background(): string;
  1303. set background(value: string);
  1304. /** Gets the list of children */
  1305. get children(): Control[];
  1306. /**
  1307. * Creates a new Container
  1308. * @param name defines the name of the container
  1309. */
  1310. constructor(name?: string | undefined);
  1311. protected _getTypeName(): string;
  1312. _flagDescendantsAsMatrixDirty(): void;
  1313. /**
  1314. * Gets a child using its name
  1315. * @param name defines the child name to look for
  1316. * @returns the child control if found
  1317. */
  1318. getChildByName(name: string): Nullable<Control>;
  1319. /**
  1320. * Gets a child using its type and its name
  1321. * @param name defines the child name to look for
  1322. * @param type defines the child type to look for
  1323. * @returns the child control if found
  1324. */
  1325. getChildByType(name: string, type: string): Nullable<Control>;
  1326. /**
  1327. * Search for a specific control in children
  1328. * @param control defines the control to look for
  1329. * @returns true if the control is in child list
  1330. */
  1331. containsControl(control: Control): boolean;
  1332. /**
  1333. * Adds a new control to the current container
  1334. * @param control defines the control to add
  1335. * @returns the current container
  1336. */
  1337. addControl(control: Nullable<Control>): Container;
  1338. /**
  1339. * Removes all controls from the current container
  1340. * @returns the current container
  1341. */
  1342. clearControls(): Container;
  1343. /**
  1344. * Removes a control from the current container
  1345. * @param control defines the control to remove
  1346. * @returns the current container
  1347. */
  1348. removeControl(control: Control): Container;
  1349. /** @hidden */
  1350. _reOrderControl(control: Control): void;
  1351. /** @hidden */
  1352. _offsetLeft(offset: number): void;
  1353. /** @hidden */
  1354. _offsetTop(offset: number): void;
  1355. /** @hidden */
  1356. _markAllAsDirty(): void;
  1357. /** @hidden */
  1358. protected _localDraw(context: CanvasRenderingContext2D): void;
  1359. /** @hidden */
  1360. _link(host: AdvancedDynamicTexture): void;
  1361. /** @hidden */
  1362. protected _beforeLayout(): void;
  1363. /** @hidden */
  1364. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1365. /** @hidden */
  1366. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1367. protected _postMeasure(): void;
  1368. /** @hidden */
  1369. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  1370. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1371. /** @hidden */
  1372. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1373. /** @hidden */
  1374. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1375. /** Releases associated resources */
  1376. dispose(): void;
  1377. }
  1378. }
  1379. declare module "babylonjs-gui/2D/controls/rectangle" {
  1380. import { Container } from "babylonjs-gui/2D/controls/container";
  1381. import { Measure } from "babylonjs-gui/2D/measure";
  1382. /** Class used to create rectangle container */
  1383. export class Rectangle extends Container {
  1384. name?: string | undefined;
  1385. private _thickness;
  1386. private _cornerRadius;
  1387. /** Gets or sets border thickness */
  1388. get thickness(): number;
  1389. set thickness(value: number);
  1390. /** Gets or sets the corner radius angle */
  1391. get cornerRadius(): number;
  1392. set cornerRadius(value: number);
  1393. /**
  1394. * Creates a new Rectangle
  1395. * @param name defines the control name
  1396. */
  1397. constructor(name?: string | undefined);
  1398. protected _getTypeName(): string;
  1399. protected _localDraw(context: CanvasRenderingContext2D): void;
  1400. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1401. private _drawRoundedRect;
  1402. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1403. }
  1404. }
  1405. declare module "babylonjs-gui/2D/controls/textBlock" {
  1406. import { Observable } from "babylonjs/Misc/observable";
  1407. import { Measure } from "babylonjs-gui/2D/measure";
  1408. import { Control } from "babylonjs-gui/2D/controls/control";
  1409. import { Nullable } from 'babylonjs/types';
  1410. /**
  1411. * Enum that determines the text-wrapping mode to use.
  1412. */
  1413. export enum TextWrapping {
  1414. /**
  1415. * Clip the text when it's larger than Control.width; this is the default mode.
  1416. */
  1417. Clip = 0,
  1418. /**
  1419. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1420. */
  1421. WordWrap = 1,
  1422. /**
  1423. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1424. */
  1425. Ellipsis = 2
  1426. }
  1427. /**
  1428. * Class used to create text block control
  1429. */
  1430. export class TextBlock extends Control {
  1431. /**
  1432. * Defines the name of the control
  1433. */
  1434. name?: string | undefined;
  1435. private _text;
  1436. private _textWrapping;
  1437. private _textHorizontalAlignment;
  1438. private _textVerticalAlignment;
  1439. private _lines;
  1440. private _resizeToFit;
  1441. private _lineSpacing;
  1442. private _outlineWidth;
  1443. private _outlineColor;
  1444. /**
  1445. * An event triggered after the text is changed
  1446. */
  1447. onTextChangedObservable: Observable<TextBlock>;
  1448. /**
  1449. * An event triggered after the text was broken up into lines
  1450. */
  1451. onLinesReadyObservable: Observable<TextBlock>;
  1452. /**
  1453. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1454. */
  1455. get lines(): any[];
  1456. /**
  1457. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1458. */
  1459. get resizeToFit(): boolean;
  1460. /**
  1461. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1462. */
  1463. set resizeToFit(value: boolean);
  1464. /**
  1465. * Gets or sets a boolean indicating if text must be wrapped
  1466. */
  1467. get textWrapping(): TextWrapping | boolean;
  1468. /**
  1469. * Gets or sets a boolean indicating if text must be wrapped
  1470. */
  1471. set textWrapping(value: TextWrapping | boolean);
  1472. /**
  1473. * Gets or sets text to display
  1474. */
  1475. get text(): string;
  1476. /**
  1477. * Gets or sets text to display
  1478. */
  1479. set text(value: string);
  1480. /**
  1481. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1482. */
  1483. get textHorizontalAlignment(): number;
  1484. /**
  1485. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1486. */
  1487. set textHorizontalAlignment(value: number);
  1488. /**
  1489. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1490. */
  1491. get textVerticalAlignment(): number;
  1492. /**
  1493. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1494. */
  1495. set textVerticalAlignment(value: number);
  1496. /**
  1497. * Gets or sets line spacing value
  1498. */
  1499. set lineSpacing(value: string | number);
  1500. /**
  1501. * Gets or sets line spacing value
  1502. */
  1503. get lineSpacing(): string | number;
  1504. /**
  1505. * Gets or sets outlineWidth of the text to display
  1506. */
  1507. get outlineWidth(): number;
  1508. /**
  1509. * Gets or sets outlineWidth of the text to display
  1510. */
  1511. set outlineWidth(value: number);
  1512. /**
  1513. * Gets or sets outlineColor of the text to display
  1514. */
  1515. get outlineColor(): string;
  1516. /**
  1517. * Gets or sets outlineColor of the text to display
  1518. */
  1519. set outlineColor(value: string);
  1520. /**
  1521. * Creates a new TextBlock object
  1522. * @param name defines the name of the control
  1523. * @param text defines the text to display (emptry string by default)
  1524. */
  1525. constructor(
  1526. /**
  1527. * Defines the name of the control
  1528. */
  1529. name?: string | undefined, text?: string);
  1530. protected _getTypeName(): string;
  1531. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1532. private _drawText;
  1533. /** @hidden */
  1534. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  1535. protected _applyStates(context: CanvasRenderingContext2D): void;
  1536. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1537. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1538. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1539. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1540. protected _renderLines(context: CanvasRenderingContext2D): void;
  1541. /**
  1542. * Given a width constraint applied on the text block, find the expected height
  1543. * @returns expected height
  1544. */
  1545. computeExpectedHeight(): number;
  1546. dispose(): void;
  1547. }
  1548. }
  1549. declare module "babylonjs-gui/2D/controls/image" {
  1550. import { Nullable } from "babylonjs/types";
  1551. import { Observable } from "babylonjs/Misc/observable";
  1552. import { Control } from "babylonjs-gui/2D/controls/control";
  1553. import { Measure } from "babylonjs-gui/2D/measure";
  1554. /**
  1555. * Class used to create 2D images
  1556. */
  1557. export class Image extends Control {
  1558. name?: string | undefined;
  1559. private _workingCanvas;
  1560. private _domImage;
  1561. private _imageWidth;
  1562. private _imageHeight;
  1563. private _loaded;
  1564. private _stretch;
  1565. private _source;
  1566. private _autoScale;
  1567. private _sourceLeft;
  1568. private _sourceTop;
  1569. private _sourceWidth;
  1570. private _sourceHeight;
  1571. private _cellWidth;
  1572. private _cellHeight;
  1573. private _cellId;
  1574. private _populateNinePatchSlicesFromImage;
  1575. private _sliceLeft;
  1576. private _sliceRight;
  1577. private _sliceTop;
  1578. private _sliceBottom;
  1579. private _detectPointerOnOpaqueOnly;
  1580. /**
  1581. * Observable notified when the content is loaded
  1582. */
  1583. onImageLoadedObservable: Observable<Image>;
  1584. /**
  1585. * Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed
  1586. */
  1587. onSVGAttributesComputedObservable: Observable<Image>;
  1588. /**
  1589. * Gets a boolean indicating that the content is loaded
  1590. */
  1591. get isLoaded(): boolean;
  1592. /**
  1593. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  1594. */
  1595. get populateNinePatchSlicesFromImage(): boolean;
  1596. set populateNinePatchSlicesFromImage(value: boolean);
  1597. /**
  1598. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  1599. * Beware using this as this will comsume more memory as the image has to be stored twice
  1600. */
  1601. get detectPointerOnOpaqueOnly(): boolean;
  1602. set detectPointerOnOpaqueOnly(value: boolean);
  1603. /**
  1604. * Gets or sets the left value for slicing (9-patch)
  1605. */
  1606. get sliceLeft(): number;
  1607. set sliceLeft(value: number);
  1608. /**
  1609. * Gets or sets the right value for slicing (9-patch)
  1610. */
  1611. get sliceRight(): number;
  1612. set sliceRight(value: number);
  1613. /**
  1614. * Gets or sets the top value for slicing (9-patch)
  1615. */
  1616. get sliceTop(): number;
  1617. set sliceTop(value: number);
  1618. /**
  1619. * Gets or sets the bottom value for slicing (9-patch)
  1620. */
  1621. get sliceBottom(): number;
  1622. set sliceBottom(value: number);
  1623. /**
  1624. * Gets or sets the left coordinate in the source image
  1625. */
  1626. get sourceLeft(): number;
  1627. set sourceLeft(value: number);
  1628. /**
  1629. * Gets or sets the top coordinate in the source image
  1630. */
  1631. get sourceTop(): number;
  1632. set sourceTop(value: number);
  1633. /**
  1634. * Gets or sets the width to capture in the source image
  1635. */
  1636. get sourceWidth(): number;
  1637. set sourceWidth(value: number);
  1638. /**
  1639. * Gets or sets the height to capture in the source image
  1640. */
  1641. get sourceHeight(): number;
  1642. set sourceHeight(value: number);
  1643. /**
  1644. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1645. * @see http://doc.babylonjs.com/how_to/gui#image
  1646. */
  1647. get autoScale(): boolean;
  1648. set autoScale(value: boolean);
  1649. /** Gets or sets the streching mode used by the image */
  1650. get stretch(): number;
  1651. set stretch(value: number);
  1652. /** @hidden */
  1653. _rotate90(n: number): Image;
  1654. /**
  1655. * Gets or sets the internal DOM image used to render the control
  1656. */
  1657. set domImage(value: HTMLImageElement);
  1658. get domImage(): HTMLImageElement;
  1659. private _onImageLoaded;
  1660. private _extractNinePatchSliceDataFromImage;
  1661. /**
  1662. * Gets or sets image source url
  1663. */
  1664. set source(value: Nullable<string>);
  1665. /**
  1666. * Checks for svg document with icon id present
  1667. */
  1668. private _svgCheck;
  1669. /**
  1670. * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically
  1671. * given external svg file and icon id
  1672. */
  1673. private _getSVGAttribs;
  1674. /**
  1675. * Gets or sets the cell width to use when animation sheet is enabled
  1676. * @see http://doc.babylonjs.com/how_to/gui#image
  1677. */
  1678. get cellWidth(): number;
  1679. set cellWidth(value: number);
  1680. /**
  1681. * Gets or sets the cell height to use when animation sheet is enabled
  1682. * @see http://doc.babylonjs.com/how_to/gui#image
  1683. */
  1684. get cellHeight(): number;
  1685. set cellHeight(value: number);
  1686. /**
  1687. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1688. * @see http://doc.babylonjs.com/how_to/gui#image
  1689. */
  1690. get cellId(): number;
  1691. set cellId(value: number);
  1692. /**
  1693. * Creates a new Image
  1694. * @param name defines the control name
  1695. * @param url defines the image url
  1696. */
  1697. constructor(name?: string | undefined, url?: Nullable<string>);
  1698. /**
  1699. * Tests if a given coordinates belong to the current control
  1700. * @param x defines x coordinate to test
  1701. * @param y defines y coordinate to test
  1702. * @returns true if the coordinates are inside the control
  1703. */
  1704. contains(x: number, y: number): boolean;
  1705. protected _getTypeName(): string;
  1706. /** Force the control to synchronize with its content */
  1707. synchronizeSizeWithContent(): void;
  1708. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1709. private _prepareWorkingCanvasForOpaqueDetection;
  1710. private _drawImage;
  1711. _draw(context: CanvasRenderingContext2D): void;
  1712. private _renderCornerPatch;
  1713. private _renderNinePatch;
  1714. dispose(): void;
  1715. /** STRETCH_NONE */
  1716. static readonly STRETCH_NONE: number;
  1717. /** STRETCH_FILL */
  1718. static readonly STRETCH_FILL: number;
  1719. /** STRETCH_UNIFORM */
  1720. static readonly STRETCH_UNIFORM: number;
  1721. /** STRETCH_EXTEND */
  1722. static readonly STRETCH_EXTEND: number;
  1723. /** NINE_PATCH */
  1724. static readonly STRETCH_NINE_PATCH: number;
  1725. }
  1726. }
  1727. declare module "babylonjs-gui/2D/controls/button" {
  1728. import { Nullable } from "babylonjs/types";
  1729. import { Vector2 } from "babylonjs/Maths/math";
  1730. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  1731. import { Control } from "babylonjs-gui/2D/controls/control";
  1732. import { TextBlock } from "babylonjs-gui/2D/controls/textBlock";
  1733. import { Image } from "babylonjs-gui/2D/controls/image";
  1734. /**
  1735. * Class used to create 2D buttons
  1736. */
  1737. export class Button extends Rectangle {
  1738. name?: string | undefined;
  1739. /**
  1740. * Function called to generate a pointer enter animation
  1741. */
  1742. pointerEnterAnimation: () => void;
  1743. /**
  1744. * Function called to generate a pointer out animation
  1745. */
  1746. pointerOutAnimation: () => void;
  1747. /**
  1748. * Function called to generate a pointer down animation
  1749. */
  1750. pointerDownAnimation: () => void;
  1751. /**
  1752. * Function called to generate a pointer up animation
  1753. */
  1754. pointerUpAnimation: () => void;
  1755. /**
  1756. * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
  1757. */
  1758. delegatePickingToChildren: boolean;
  1759. private _image;
  1760. /**
  1761. * Returns the image part of the button (if any)
  1762. */
  1763. get image(): Nullable<Image>;
  1764. private _textBlock;
  1765. /**
  1766. * Returns the image part of the button (if any)
  1767. */
  1768. get textBlock(): Nullable<TextBlock>;
  1769. /**
  1770. * Creates a new Button
  1771. * @param name defines the name of the button
  1772. */
  1773. constructor(name?: string | undefined);
  1774. protected _getTypeName(): string;
  1775. /** @hidden */
  1776. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1777. /** @hidden */
  1778. _onPointerEnter(target: Control): boolean;
  1779. /** @hidden */
  1780. _onPointerOut(target: Control, force?: boolean): void;
  1781. /** @hidden */
  1782. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1783. /** @hidden */
  1784. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1785. /**
  1786. * Creates a new button made with an image and a text
  1787. * @param name defines the name of the button
  1788. * @param text defines the text of the button
  1789. * @param imageUrl defines the url of the image
  1790. * @returns a new Button
  1791. */
  1792. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  1793. /**
  1794. * Creates a new button made with an image
  1795. * @param name defines the name of the button
  1796. * @param imageUrl defines the url of the image
  1797. * @returns a new Button
  1798. */
  1799. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  1800. /**
  1801. * Creates a new button made with a text
  1802. * @param name defines the name of the button
  1803. * @param text defines the text of the button
  1804. * @returns a new Button
  1805. */
  1806. static CreateSimpleButton(name: string, text: string): Button;
  1807. /**
  1808. * Creates a new button made with an image and a centered text
  1809. * @param name defines the name of the button
  1810. * @param text defines the text of the button
  1811. * @param imageUrl defines the url of the image
  1812. * @returns a new Button
  1813. */
  1814. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  1815. }
  1816. }
  1817. declare module "babylonjs-gui/2D/controls/stackPanel" {
  1818. import { Container } from "babylonjs-gui/2D/controls/container";
  1819. import { Measure } from "babylonjs-gui/2D/measure";
  1820. /**
  1821. * Class used to create a 2D stack panel container
  1822. */
  1823. export class StackPanel extends Container {
  1824. name?: string | undefined;
  1825. private _isVertical;
  1826. private _manualWidth;
  1827. private _manualHeight;
  1828. private _doNotTrackManualChanges;
  1829. /**
  1830. * Gets or sets a boolean indicating that layou warnings should be ignored
  1831. */
  1832. ignoreLayoutWarnings: boolean;
  1833. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1834. get isVertical(): boolean;
  1835. set isVertical(value: boolean);
  1836. /**
  1837. * Gets or sets panel width.
  1838. * This value should not be set when in horizontal mode as it will be computed automatically
  1839. */
  1840. set width(value: string | number);
  1841. get width(): string | number;
  1842. /**
  1843. * Gets or sets panel height.
  1844. * This value should not be set when in vertical mode as it will be computed automatically
  1845. */
  1846. set height(value: string | number);
  1847. get height(): string | number;
  1848. /**
  1849. * Creates a new StackPanel
  1850. * @param name defines control name
  1851. */
  1852. constructor(name?: string | undefined);
  1853. protected _getTypeName(): string;
  1854. /** @hidden */
  1855. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1856. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1857. protected _postMeasure(): void;
  1858. }
  1859. }
  1860. declare module "babylonjs-gui/2D/controls/checkbox" {
  1861. import { Observable } from "babylonjs/Misc/observable";
  1862. import { Vector2 } from "babylonjs/Maths/math";
  1863. import { Control } from "babylonjs-gui/2D/controls/control";
  1864. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1865. import { Nullable } from 'babylonjs/types';
  1866. import { Measure } from "babylonjs-gui/2D/measure";
  1867. /**
  1868. * Class used to represent a 2D checkbox
  1869. */
  1870. export class Checkbox extends Control {
  1871. name?: string | undefined;
  1872. private _isChecked;
  1873. private _background;
  1874. private _checkSizeRatio;
  1875. private _thickness;
  1876. /** Gets or sets border thickness */
  1877. get thickness(): number;
  1878. set thickness(value: number);
  1879. /**
  1880. * Observable raised when isChecked property changes
  1881. */
  1882. onIsCheckedChangedObservable: Observable<boolean>;
  1883. /** Gets or sets a value indicating the ratio between overall size and check size */
  1884. get checkSizeRatio(): number;
  1885. set checkSizeRatio(value: number);
  1886. /** Gets or sets background color */
  1887. get background(): string;
  1888. set background(value: string);
  1889. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1890. get isChecked(): boolean;
  1891. set isChecked(value: boolean);
  1892. /**
  1893. * Creates a new CheckBox
  1894. * @param name defines the control name
  1895. */
  1896. constructor(name?: string | undefined);
  1897. protected _getTypeName(): string;
  1898. /** @hidden */
  1899. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  1900. /** @hidden */
  1901. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1902. /**
  1903. * Utility function to easily create a checkbox with a header
  1904. * @param title defines the label to use for the header
  1905. * @param onValueChanged defines the callback to call when value changes
  1906. * @returns a StackPanel containing the checkbox and a textBlock
  1907. */
  1908. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  1909. }
  1910. }
  1911. declare module "babylonjs-gui/2D/controls/virtualKeyboard" {
  1912. import { Nullable } from "babylonjs/types";
  1913. import { Observable } from "babylonjs/Misc/observable";
  1914. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1915. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1916. /**
  1917. * Class used to store key control properties
  1918. */
  1919. export class KeyPropertySet {
  1920. /** Width */
  1921. width?: string;
  1922. /** Height */
  1923. height?: string;
  1924. /** Left padding */
  1925. paddingLeft?: string;
  1926. /** Right padding */
  1927. paddingRight?: string;
  1928. /** Top padding */
  1929. paddingTop?: string;
  1930. /** Bottom padding */
  1931. paddingBottom?: string;
  1932. /** Foreground color */
  1933. color?: string;
  1934. /** Background color */
  1935. background?: string;
  1936. }
  1937. /**
  1938. * Class used to create virtual keyboard
  1939. */
  1940. export class VirtualKeyboard extends StackPanel {
  1941. /** Observable raised when a key is pressed */
  1942. onKeyPressObservable: Observable<string>;
  1943. /** Gets or sets default key button width */
  1944. defaultButtonWidth: string;
  1945. /** Gets or sets default key button height */
  1946. defaultButtonHeight: string;
  1947. /** Gets or sets default key button left padding */
  1948. defaultButtonPaddingLeft: string;
  1949. /** Gets or sets default key button right padding */
  1950. defaultButtonPaddingRight: string;
  1951. /** Gets or sets default key button top padding */
  1952. defaultButtonPaddingTop: string;
  1953. /** Gets or sets default key button bottom padding */
  1954. defaultButtonPaddingBottom: string;
  1955. /** Gets or sets default key button foreground color */
  1956. defaultButtonColor: string;
  1957. /** Gets or sets default key button background color */
  1958. defaultButtonBackground: string;
  1959. /** Gets or sets shift button foreground color */
  1960. shiftButtonColor: string;
  1961. /** Gets or sets shift button thickness*/
  1962. selectedShiftThickness: number;
  1963. /** Gets shift key state */
  1964. shiftState: number;
  1965. protected _getTypeName(): string;
  1966. private _createKey;
  1967. /**
  1968. * Adds a new row of keys
  1969. * @param keys defines the list of keys to add
  1970. * @param propertySets defines the associated property sets
  1971. */
  1972. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  1973. /**
  1974. * Set the shift key to a specific state
  1975. * @param shiftState defines the new shift state
  1976. */
  1977. applyShiftState(shiftState: number): void;
  1978. private _currentlyConnectedInputText;
  1979. private _connectedInputTexts;
  1980. private _onKeyPressObserver;
  1981. /** Gets the input text control currently attached to the keyboard */
  1982. get connectedInputText(): Nullable<InputText>;
  1983. /**
  1984. * Connects the keyboard with an input text control
  1985. *
  1986. * @param input defines the target control
  1987. */
  1988. connect(input: InputText): void;
  1989. /**
  1990. * Disconnects the keyboard from connected InputText controls
  1991. *
  1992. * @param input optionally defines a target control, otherwise all are disconnected
  1993. */
  1994. disconnect(input?: InputText): void;
  1995. private _removeConnectedInputObservables;
  1996. /**
  1997. * Release all resources
  1998. */
  1999. dispose(): void;
  2000. /**
  2001. * Creates a new keyboard using a default layout
  2002. *
  2003. * @param name defines control name
  2004. * @returns a new VirtualKeyboard
  2005. */
  2006. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2007. }
  2008. }
  2009. declare module "babylonjs-gui/2D/controls/inputText" {
  2010. import { Nullable } from "babylonjs/types";
  2011. import { Observable } from "babylonjs/Misc/observable";
  2012. import { Vector2 } from "babylonjs/Maths/math";
  2013. import { Control } from "babylonjs-gui/2D/controls/control";
  2014. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  2015. import { VirtualKeyboard } from "babylonjs-gui/2D/controls/virtualKeyboard";
  2016. import { Measure } from "babylonjs-gui/2D/measure";
  2017. /**
  2018. * Class used to create input text control
  2019. */
  2020. export class InputText extends Control implements IFocusableControl {
  2021. name?: string | undefined;
  2022. private _text;
  2023. private _placeholderText;
  2024. private _background;
  2025. private _focusedBackground;
  2026. private _focusedColor;
  2027. private _placeholderColor;
  2028. private _thickness;
  2029. private _margin;
  2030. private _autoStretchWidth;
  2031. private _maxWidth;
  2032. private _isFocused;
  2033. private _blinkTimeout;
  2034. private _blinkIsEven;
  2035. private _cursorOffset;
  2036. private _scrollLeft;
  2037. private _textWidth;
  2038. private _clickedCoordinate;
  2039. private _deadKey;
  2040. private _addKey;
  2041. private _currentKey;
  2042. private _isTextHighlightOn;
  2043. private _textHighlightColor;
  2044. private _highligherOpacity;
  2045. private _highlightedText;
  2046. private _startHighlightIndex;
  2047. private _endHighlightIndex;
  2048. private _cursorIndex;
  2049. private _onFocusSelectAll;
  2050. private _isPointerDown;
  2051. private _onClipboardObserver;
  2052. private _onPointerDblTapObserver;
  2053. /** @hidden */
  2054. _connectedVirtualKeyboard: Nullable<VirtualKeyboard>;
  2055. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  2056. promptMessage: string;
  2057. /** Force disable prompt on mobile device */
  2058. disableMobilePrompt: boolean;
  2059. /** Observable raised when the text changes */
  2060. onTextChangedObservable: Observable<InputText>;
  2061. /** Observable raised just before an entered character is to be added */
  2062. onBeforeKeyAddObservable: Observable<InputText>;
  2063. /** Observable raised when the control gets the focus */
  2064. onFocusObservable: Observable<InputText>;
  2065. /** Observable raised when the control loses the focus */
  2066. onBlurObservable: Observable<InputText>;
  2067. /**Observable raised when the text is highlighted */
  2068. onTextHighlightObservable: Observable<InputText>;
  2069. /**Observable raised when copy event is triggered */
  2070. onTextCopyObservable: Observable<InputText>;
  2071. /** Observable raised when cut event is triggered */
  2072. onTextCutObservable: Observable<InputText>;
  2073. /** Observable raised when paste event is triggered */
  2074. onTextPasteObservable: Observable<InputText>;
  2075. /** Observable raised when a key event was processed */
  2076. onKeyboardEventProcessedObservable: Observable<KeyboardEvent>;
  2077. /** Gets or sets the maximum width allowed by the control */
  2078. get maxWidth(): string | number;
  2079. /** Gets the maximum width allowed by the control in pixels */
  2080. get maxWidthInPixels(): number;
  2081. set maxWidth(value: string | number);
  2082. /** Gets or sets the text highlighter transparency; default: 0.4 */
  2083. get highligherOpacity(): number;
  2084. set highligherOpacity(value: number);
  2085. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  2086. get onFocusSelectAll(): boolean;
  2087. set onFocusSelectAll(value: boolean);
  2088. /** Gets or sets the text hightlight color */
  2089. get textHighlightColor(): string;
  2090. set textHighlightColor(value: string);
  2091. /** Gets or sets control margin */
  2092. get margin(): string;
  2093. /** Gets control margin in pixels */
  2094. get marginInPixels(): number;
  2095. set margin(value: string);
  2096. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  2097. get autoStretchWidth(): boolean;
  2098. set autoStretchWidth(value: boolean);
  2099. /** Gets or sets border thickness */
  2100. get thickness(): number;
  2101. set thickness(value: number);
  2102. /** Gets or sets the background color when focused */
  2103. get focusedBackground(): string;
  2104. set focusedBackground(value: string);
  2105. /** Gets or sets the background color when focused */
  2106. get focusedColor(): string;
  2107. set focusedColor(value: string);
  2108. /** Gets or sets the background color */
  2109. get background(): string;
  2110. set background(value: string);
  2111. /** Gets or sets the placeholder color */
  2112. get placeholderColor(): string;
  2113. set placeholderColor(value: string);
  2114. /** Gets or sets the text displayed when the control is empty */
  2115. get placeholderText(): string;
  2116. set placeholderText(value: string);
  2117. /** Gets or sets the dead key flag */
  2118. get deadKey(): boolean;
  2119. set deadKey(flag: boolean);
  2120. /** Gets or sets the highlight text */
  2121. get highlightedText(): string;
  2122. set highlightedText(text: string);
  2123. /** Gets or sets if the current key should be added */
  2124. get addKey(): boolean;
  2125. set addKey(flag: boolean);
  2126. /** Gets or sets the value of the current key being entered */
  2127. get currentKey(): string;
  2128. set currentKey(key: string);
  2129. /** Gets or sets the text displayed in the control */
  2130. get text(): string;
  2131. set text(value: string);
  2132. /** Gets or sets control width */
  2133. get width(): string | number;
  2134. set width(value: string | number);
  2135. /**
  2136. * Creates a new InputText
  2137. * @param name defines the control name
  2138. * @param text defines the text of the control
  2139. */
  2140. constructor(name?: string | undefined, text?: string);
  2141. /** @hidden */
  2142. onBlur(): void;
  2143. /** @hidden */
  2144. onFocus(): void;
  2145. protected _getTypeName(): string;
  2146. /**
  2147. * Function called to get the list of controls that should not steal the focus from this control
  2148. * @returns an array of controls
  2149. */
  2150. keepsFocusWith(): Nullable<Control[]>;
  2151. /** @hidden */
  2152. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  2153. /** @hidden */
  2154. private _updateValueFromCursorIndex;
  2155. /** @hidden */
  2156. private _processDblClick;
  2157. /** @hidden */
  2158. private _selectAllText;
  2159. /**
  2160. * Handles the keyboard event
  2161. * @param evt Defines the KeyboardEvent
  2162. */
  2163. processKeyboard(evt: KeyboardEvent): void;
  2164. /** @hidden */
  2165. private _onCopyText;
  2166. /** @hidden */
  2167. private _onCutText;
  2168. /** @hidden */
  2169. private _onPasteText;
  2170. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  2171. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2172. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number): void;
  2173. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2174. protected _beforeRenderText(text: string): string;
  2175. dispose(): void;
  2176. }
  2177. }
  2178. declare module "babylonjs-gui/2D/controls/grid" {
  2179. import { Nullable } from "babylonjs/types";
  2180. import { Container } from "babylonjs-gui/2D/controls/container";
  2181. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  2182. import { Control } from "babylonjs-gui/2D/controls/control";
  2183. import { Measure } from "babylonjs-gui/2D/measure";
  2184. /**
  2185. * Class used to create a 2D grid container
  2186. */
  2187. export class Grid extends Container {
  2188. name?: string | undefined;
  2189. private _rowDefinitions;
  2190. private _columnDefinitions;
  2191. private _cells;
  2192. private _childControls;
  2193. /**
  2194. * Gets the number of columns
  2195. */
  2196. get columnCount(): number;
  2197. /**
  2198. * Gets the number of rows
  2199. */
  2200. get rowCount(): number;
  2201. /** Gets the list of children */
  2202. get children(): Control[];
  2203. /** Gets the list of cells (e.g. the containers) */
  2204. get cells(): {
  2205. [key: string]: Container;
  2206. };
  2207. /**
  2208. * Gets the definition of a specific row
  2209. * @param index defines the index of the row
  2210. * @returns the row definition
  2211. */
  2212. getRowDefinition(index: number): Nullable<ValueAndUnit>;
  2213. /**
  2214. * Gets the definition of a specific column
  2215. * @param index defines the index of the column
  2216. * @returns the column definition
  2217. */
  2218. getColumnDefinition(index: number): Nullable<ValueAndUnit>;
  2219. /**
  2220. * Adds a new row to the grid
  2221. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2222. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  2223. * @returns the current grid
  2224. */
  2225. addRowDefinition(height: number, isPixel?: boolean): Grid;
  2226. /**
  2227. * Adds a new column to the grid
  2228. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2229. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2230. * @returns the current grid
  2231. */
  2232. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  2233. /**
  2234. * Update a row definition
  2235. * @param index defines the index of the row to update
  2236. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2237. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  2238. * @returns the current grid
  2239. */
  2240. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  2241. /**
  2242. * Update a column definition
  2243. * @param index defines the index of the column to update
  2244. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2245. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2246. * @returns the current grid
  2247. */
  2248. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  2249. /**
  2250. * Gets the list of children stored in a specific cell
  2251. * @param row defines the row to check
  2252. * @param column defines the column to check
  2253. * @returns the list of controls
  2254. */
  2255. getChildrenAt(row: number, column: number): Nullable<Array<Control>>;
  2256. /**
  2257. * Gets a string representing the child cell info (row x column)
  2258. * @param child defines the control to get info from
  2259. * @returns a string containing the child cell info (row x column)
  2260. */
  2261. getChildCellInfo(child: Control): string;
  2262. private _removeCell;
  2263. private _offsetCell;
  2264. /**
  2265. * Remove a column definition at specified index
  2266. * @param index defines the index of the column to remove
  2267. * @returns the current grid
  2268. */
  2269. removeColumnDefinition(index: number): Grid;
  2270. /**
  2271. * Remove a row definition at specified index
  2272. * @param index defines the index of the row to remove
  2273. * @returns the current grid
  2274. */
  2275. removeRowDefinition(index: number): Grid;
  2276. /**
  2277. * Adds a new control to the current grid
  2278. * @param control defines the control to add
  2279. * @param row defines the row where to add the control (0 by default)
  2280. * @param column defines the column where to add the control (0 by default)
  2281. * @returns the current grid
  2282. */
  2283. addControl(control: Control, row?: number, column?: number): Grid;
  2284. /**
  2285. * Removes a control from the current container
  2286. * @param control defines the control to remove
  2287. * @returns the current container
  2288. */
  2289. removeControl(control: Control): Container;
  2290. /**
  2291. * Creates a new Grid
  2292. * @param name defines control name
  2293. */
  2294. constructor(name?: string | undefined);
  2295. protected _getTypeName(): string;
  2296. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  2297. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2298. _flagDescendantsAsMatrixDirty(): void;
  2299. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2300. /** Releases associated resources */
  2301. dispose(): void;
  2302. }
  2303. }
  2304. declare module "babylonjs-gui/2D/controls/colorpicker" {
  2305. import { Observable } from "babylonjs/Misc/observable";
  2306. import { Color3, Vector2 } from "babylonjs/Maths/math";
  2307. import { Control } from "babylonjs-gui/2D/controls/control";
  2308. import { Measure } from "babylonjs-gui/2D/measure";
  2309. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2310. /** Class used to create color pickers */
  2311. export class ColorPicker extends Control {
  2312. name?: string | undefined;
  2313. private static _Epsilon;
  2314. private _colorWheelCanvas;
  2315. private _value;
  2316. private _tmpColor;
  2317. private _pointerStartedOnSquare;
  2318. private _pointerStartedOnWheel;
  2319. private _squareLeft;
  2320. private _squareTop;
  2321. private _squareSize;
  2322. private _h;
  2323. private _s;
  2324. private _v;
  2325. private _lastPointerDownID;
  2326. /**
  2327. * Observable raised when the value changes
  2328. */
  2329. onValueChangedObservable: Observable<Color3>;
  2330. /** Gets or sets the color of the color picker */
  2331. get value(): Color3;
  2332. set value(value: Color3);
  2333. /**
  2334. * Gets or sets control width
  2335. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  2336. */
  2337. get width(): string | number;
  2338. set width(value: string | number);
  2339. /**
  2340. * Gets or sets control height
  2341. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  2342. */
  2343. get height(): string | number;
  2344. /** Gets or sets control height */
  2345. set height(value: string | number);
  2346. /** Gets or sets control size */
  2347. get size(): string | number;
  2348. set size(value: string | number);
  2349. /**
  2350. * Creates a new ColorPicker
  2351. * @param name defines the control name
  2352. */
  2353. constructor(name?: string | undefined);
  2354. protected _getTypeName(): string;
  2355. /** @hidden */
  2356. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2357. private _updateSquareProps;
  2358. private _drawGradientSquare;
  2359. private _drawCircle;
  2360. private _createColorWheelCanvas;
  2361. /** @hidden */
  2362. _draw(context: CanvasRenderingContext2D): void;
  2363. private _pointerIsDown;
  2364. private _updateValueFromPointer;
  2365. private _isPointOnSquare;
  2366. private _isPointOnWheel;
  2367. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2368. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number): void;
  2369. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2370. /**
  2371. * This function expands the color picker by creating a color picker dialog with manual
  2372. * color value input and the ability to save colors into an array to be used later in
  2373. * subsequent launches of the dialogue.
  2374. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  2375. * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.
  2376. * @returns picked color as a hex string and the saved colors array as hex strings.
  2377. */
  2378. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  2379. pickerWidth?: string;
  2380. pickerHeight?: string;
  2381. headerHeight?: string;
  2382. lastColor?: string;
  2383. swatchLimit?: number;
  2384. numSwatchesPerLine?: number;
  2385. savedColors?: Array<string>;
  2386. }): Promise<{
  2387. savedColors?: string[];
  2388. pickedColor: string;
  2389. }>;
  2390. }
  2391. }
  2392. declare module "babylonjs-gui/2D/controls/ellipse" {
  2393. import { Container } from "babylonjs-gui/2D/controls/container";
  2394. import { Measure } from "babylonjs-gui/2D/measure";
  2395. /** Class used to create 2D ellipse containers */
  2396. export class Ellipse extends Container {
  2397. name?: string | undefined;
  2398. private _thickness;
  2399. /** Gets or sets border thickness */
  2400. get thickness(): number;
  2401. set thickness(value: number);
  2402. /**
  2403. * Creates a new Ellipse
  2404. * @param name defines the control name
  2405. */
  2406. constructor(name?: string | undefined);
  2407. protected _getTypeName(): string;
  2408. protected _localDraw(context: CanvasRenderingContext2D): void;
  2409. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2410. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2411. }
  2412. }
  2413. declare module "babylonjs-gui/2D/controls/inputPassword" {
  2414. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  2415. /**
  2416. * Class used to create a password control
  2417. */
  2418. export class InputPassword extends InputText {
  2419. protected _beforeRenderText(text: string): string;
  2420. }
  2421. }
  2422. declare module "babylonjs-gui/2D/controls/line" {
  2423. import { Vector3 } from "babylonjs/Maths/math";
  2424. import { Scene } from "babylonjs/scene";
  2425. import { Control } from "babylonjs-gui/2D/controls/control";
  2426. import { Measure } from "babylonjs-gui/2D/measure";
  2427. /** Class used to render 2D lines */
  2428. export class Line extends Control {
  2429. name?: string | undefined;
  2430. private _lineWidth;
  2431. private _x1;
  2432. private _y1;
  2433. private _x2;
  2434. private _y2;
  2435. private _dash;
  2436. private _connectedControl;
  2437. private _connectedControlDirtyObserver;
  2438. /** Gets or sets the dash pattern */
  2439. get dash(): Array<number>;
  2440. set dash(value: Array<number>);
  2441. /** Gets or sets the control connected with the line end */
  2442. get connectedControl(): Control;
  2443. set connectedControl(value: Control);
  2444. /** Gets or sets start coordinates on X axis */
  2445. get x1(): string | number;
  2446. set x1(value: string | number);
  2447. /** Gets or sets start coordinates on Y axis */
  2448. get y1(): string | number;
  2449. set y1(value: string | number);
  2450. /** Gets or sets end coordinates on X axis */
  2451. get x2(): string | number;
  2452. set x2(value: string | number);
  2453. /** Gets or sets end coordinates on Y axis */
  2454. get y2(): string | number;
  2455. set y2(value: string | number);
  2456. /** Gets or sets line width */
  2457. get lineWidth(): number;
  2458. set lineWidth(value: number);
  2459. /** Gets or sets horizontal alignment */
  2460. set horizontalAlignment(value: number);
  2461. /** Gets or sets vertical alignment */
  2462. set verticalAlignment(value: number);
  2463. private get _effectiveX2();
  2464. private get _effectiveY2();
  2465. /**
  2466. * Creates a new Line
  2467. * @param name defines the control name
  2468. */
  2469. constructor(name?: string | undefined);
  2470. protected _getTypeName(): string;
  2471. _draw(context: CanvasRenderingContext2D): void;
  2472. _measure(): void;
  2473. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2474. /**
  2475. * Move one end of the line given 3D cartesian coordinates.
  2476. * @param position Targeted world position
  2477. * @param scene Scene
  2478. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2479. */
  2480. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  2481. /**
  2482. * Move one end of the line to a position in screen absolute space.
  2483. * @param projectedPosition Position in screen absolute space (X, Y)
  2484. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2485. */
  2486. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  2487. }
  2488. }
  2489. declare module "babylonjs-gui/2D/multiLinePoint" {
  2490. import { Nullable } from "babylonjs/types";
  2491. import { Vector2 } from "babylonjs/Maths/math";
  2492. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  2493. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  2494. import { Control } from "babylonjs-gui/2D/controls/control";
  2495. /**
  2496. * Class used to store a point for a MultiLine object.
  2497. * The point can be pure 2D coordinates, a mesh or a control
  2498. */
  2499. export class MultiLinePoint {
  2500. private _multiLine;
  2501. private _x;
  2502. private _y;
  2503. private _control;
  2504. private _mesh;
  2505. private _controlObserver;
  2506. private _meshObserver;
  2507. /** @hidden */
  2508. _point: Vector2;
  2509. /**
  2510. * Creates a new MultiLinePoint
  2511. * @param multiLine defines the source MultiLine object
  2512. */
  2513. constructor(multiLine: MultiLine);
  2514. /** Gets or sets x coordinate */
  2515. get x(): string | number;
  2516. set x(value: string | number);
  2517. /** Gets or sets y coordinate */
  2518. get y(): string | number;
  2519. set y(value: string | number);
  2520. /** Gets or sets the control associated with this point */
  2521. get control(): Nullable<Control>;
  2522. set control(value: Nullable<Control>);
  2523. /** Gets or sets the mesh associated with this point */
  2524. get mesh(): Nullable<AbstractMesh>;
  2525. set mesh(value: Nullable<AbstractMesh>);
  2526. /** Resets links */
  2527. resetLinks(): void;
  2528. /**
  2529. * Gets a translation vector
  2530. * @returns the translation vector
  2531. */
  2532. translate(): Vector2;
  2533. private _translatePoint;
  2534. /** Release associated resources */
  2535. dispose(): void;
  2536. }
  2537. }
  2538. declare module "babylonjs-gui/2D/controls/multiLine" {
  2539. import { Nullable } from "babylonjs/types";
  2540. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  2541. import { Control } from "babylonjs-gui/2D/controls/control";
  2542. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  2543. import { Measure } from "babylonjs-gui/2D/measure";
  2544. /**
  2545. * Class used to create multi line control
  2546. */
  2547. export class MultiLine extends Control {
  2548. name?: string | undefined;
  2549. private _lineWidth;
  2550. private _dash;
  2551. private _points;
  2552. private _minX;
  2553. private _minY;
  2554. private _maxX;
  2555. private _maxY;
  2556. /**
  2557. * Creates a new MultiLine
  2558. * @param name defines the control name
  2559. */
  2560. constructor(name?: string | undefined);
  2561. /** Gets or sets dash pattern */
  2562. get dash(): Array<number>;
  2563. set dash(value: Array<number>);
  2564. /**
  2565. * Gets point stored at specified index
  2566. * @param index defines the index to look for
  2567. * @returns the requested point if found
  2568. */
  2569. getAt(index: number): MultiLinePoint;
  2570. /** Function called when a point is updated */
  2571. onPointUpdate: () => void;
  2572. /**
  2573. * Adds new points to the point collection
  2574. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  2575. * @returns the list of created MultiLinePoint
  2576. */
  2577. add(...items: (AbstractMesh | Control | {
  2578. x: string | number;
  2579. y: string | number;
  2580. })[]): MultiLinePoint[];
  2581. /**
  2582. * Adds a new point to the point collection
  2583. * @param item defines the item (mesh, control or 2d coordiantes) to add
  2584. * @returns the created MultiLinePoint
  2585. */
  2586. push(item?: (AbstractMesh | Control | {
  2587. x: string | number;
  2588. y: string | number;
  2589. })): MultiLinePoint;
  2590. /**
  2591. * Remove a specific value or point from the active point collection
  2592. * @param value defines the value or point to remove
  2593. */
  2594. remove(value: number | MultiLinePoint): void;
  2595. /**
  2596. * Resets this object to initial state (no point)
  2597. */
  2598. reset(): void;
  2599. /**
  2600. * Resets all links
  2601. */
  2602. resetLinks(): void;
  2603. /** Gets or sets line width */
  2604. get lineWidth(): number;
  2605. set lineWidth(value: number);
  2606. set horizontalAlignment(value: number);
  2607. set verticalAlignment(value: number);
  2608. protected _getTypeName(): string;
  2609. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  2610. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2611. _measure(): void;
  2612. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2613. dispose(): void;
  2614. }
  2615. }
  2616. declare module "babylonjs-gui/2D/controls/radioButton" {
  2617. import { Observable } from "babylonjs/Misc/observable";
  2618. import { Vector2 } from "babylonjs/Maths/math";
  2619. import { Control } from "babylonjs-gui/2D/controls/control";
  2620. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2621. /**
  2622. * Class used to create radio button controls
  2623. */
  2624. export class RadioButton extends Control {
  2625. name?: string | undefined;
  2626. private _isChecked;
  2627. private _background;
  2628. private _checkSizeRatio;
  2629. private _thickness;
  2630. /** Gets or sets border thickness */
  2631. get thickness(): number;
  2632. set thickness(value: number);
  2633. /** Gets or sets group name */
  2634. group: string;
  2635. /** Observable raised when isChecked is changed */
  2636. onIsCheckedChangedObservable: Observable<boolean>;
  2637. /** Gets or sets a value indicating the ratio between overall size and check size */
  2638. get checkSizeRatio(): number;
  2639. set checkSizeRatio(value: number);
  2640. /** Gets or sets background color */
  2641. get background(): string;
  2642. set background(value: string);
  2643. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2644. get isChecked(): boolean;
  2645. set isChecked(value: boolean);
  2646. /**
  2647. * Creates a new RadioButton
  2648. * @param name defines the control name
  2649. */
  2650. constructor(name?: string | undefined);
  2651. protected _getTypeName(): string;
  2652. _draw(context: CanvasRenderingContext2D): void;
  2653. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2654. /**
  2655. * Utility function to easily create a radio button with a header
  2656. * @param title defines the label to use for the header
  2657. * @param group defines the group to use for the radio button
  2658. * @param isChecked defines the initial state of the radio button
  2659. * @param onValueChanged defines the callback to call when value changes
  2660. * @returns a StackPanel containing the radio button and a textBlock
  2661. */
  2662. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  2663. }
  2664. }
  2665. declare module "babylonjs-gui/2D/controls/sliders/baseSlider" {
  2666. import { Observable } from "babylonjs/Misc/observable";
  2667. import { Vector2 } from "babylonjs/Maths/math";
  2668. import { Control } from "babylonjs-gui/2D/controls/control";
  2669. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  2670. /**
  2671. * Class used to create slider controls
  2672. */
  2673. export class BaseSlider extends Control {
  2674. name?: string | undefined;
  2675. protected _thumbWidth: ValueAndUnit;
  2676. private _minimum;
  2677. private _maximum;
  2678. private _value;
  2679. private _isVertical;
  2680. protected _barOffset: ValueAndUnit;
  2681. private _isThumbClamped;
  2682. protected _displayThumb: boolean;
  2683. private _step;
  2684. private _lastPointerDownID;
  2685. protected _effectiveBarOffset: number;
  2686. protected _renderLeft: number;
  2687. protected _renderTop: number;
  2688. protected _renderWidth: number;
  2689. protected _renderHeight: number;
  2690. protected _backgroundBoxLength: number;
  2691. protected _backgroundBoxThickness: number;
  2692. protected _effectiveThumbThickness: number;
  2693. /** Observable raised when the sldier value changes */
  2694. onValueChangedObservable: Observable<number>;
  2695. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2696. get displayThumb(): boolean;
  2697. set displayThumb(value: boolean);
  2698. /** Gets or sets a step to apply to values (0 by default) */
  2699. get step(): number;
  2700. set step(value: number);
  2701. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2702. get barOffset(): string | number;
  2703. /** Gets main bar offset in pixels*/
  2704. get barOffsetInPixels(): number;
  2705. set barOffset(value: string | number);
  2706. /** Gets or sets thumb width */
  2707. get thumbWidth(): string | number;
  2708. /** Gets thumb width in pixels */
  2709. get thumbWidthInPixels(): number;
  2710. set thumbWidth(value: string | number);
  2711. /** Gets or sets minimum value */
  2712. get minimum(): number;
  2713. set minimum(value: number);
  2714. /** Gets or sets maximum value */
  2715. get maximum(): number;
  2716. set maximum(value: number);
  2717. /** Gets or sets current value */
  2718. get value(): number;
  2719. set value(value: number);
  2720. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2721. get isVertical(): boolean;
  2722. set isVertical(value: boolean);
  2723. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2724. get isThumbClamped(): boolean;
  2725. set isThumbClamped(value: boolean);
  2726. /**
  2727. * Creates a new BaseSlider
  2728. * @param name defines the control name
  2729. */
  2730. constructor(name?: string | undefined);
  2731. protected _getTypeName(): string;
  2732. protected _getThumbPosition(): number;
  2733. protected _getThumbThickness(type: string): number;
  2734. protected _prepareRenderingData(type: string): void;
  2735. private _pointerIsDown;
  2736. /** @hidden */
  2737. protected _updateValueFromPointer(x: number, y: number): void;
  2738. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2739. _onPointerMove(target: Control, coordinates: Vector2, pointerId: number): void;
  2740. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2741. }
  2742. }
  2743. declare module "babylonjs-gui/2D/controls/sliders/slider" {
  2744. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  2745. import { Nullable } from 'babylonjs/types';
  2746. import { Measure } from "babylonjs-gui/2D/measure";
  2747. /**
  2748. * Class used to create slider controls
  2749. */
  2750. export class Slider extends BaseSlider {
  2751. name?: string | undefined;
  2752. private _background;
  2753. private _borderColor;
  2754. private _isThumbCircle;
  2755. protected _displayValueBar: boolean;
  2756. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2757. get displayValueBar(): boolean;
  2758. set displayValueBar(value: boolean);
  2759. /** Gets or sets border color */
  2760. get borderColor(): string;
  2761. set borderColor(value: string);
  2762. /** Gets or sets background color */
  2763. get background(): string;
  2764. set background(value: string);
  2765. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2766. get isThumbCircle(): boolean;
  2767. set isThumbCircle(value: boolean);
  2768. /**
  2769. * Creates a new Slider
  2770. * @param name defines the control name
  2771. */
  2772. constructor(name?: string | undefined);
  2773. protected _getTypeName(): string;
  2774. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  2775. }
  2776. }
  2777. declare module "babylonjs-gui/2D/controls/selector" {
  2778. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  2779. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2780. /** Class used to create a RadioGroup
  2781. * which contains groups of radio buttons
  2782. */
  2783. export class SelectorGroup {
  2784. /** name of SelectorGroup */
  2785. name: string;
  2786. private _groupPanel;
  2787. private _selectors;
  2788. private _groupHeader;
  2789. /**
  2790. * Creates a new SelectorGroup
  2791. * @param name of group, used as a group heading
  2792. */
  2793. constructor(
  2794. /** name of SelectorGroup */
  2795. name: string);
  2796. /** Gets the groupPanel of the SelectorGroup */
  2797. get groupPanel(): StackPanel;
  2798. /** Gets the selectors array */
  2799. get selectors(): StackPanel[];
  2800. /** Gets and sets the group header */
  2801. get header(): string;
  2802. set header(label: string);
  2803. /** @hidden */
  2804. private _addGroupHeader;
  2805. /** @hidden*/
  2806. _getSelector(selectorNb: number): StackPanel | undefined;
  2807. /** Removes the selector at the given position
  2808. * @param selectorNb the position of the selector within the group
  2809. */
  2810. removeSelector(selectorNb: number): void;
  2811. }
  2812. /** Class used to create a CheckboxGroup
  2813. * which contains groups of checkbox buttons
  2814. */
  2815. export class CheckboxGroup extends SelectorGroup {
  2816. /** Adds a checkbox as a control
  2817. * @param text is the label for the selector
  2818. * @param func is the function called when the Selector is checked
  2819. * @param checked is true when Selector is checked
  2820. */
  2821. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  2822. /** @hidden */
  2823. _setSelectorLabel(selectorNb: number, label: string): void;
  2824. /** @hidden */
  2825. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2826. /** @hidden */
  2827. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2828. /** @hidden */
  2829. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2830. }
  2831. /** Class used to create a RadioGroup
  2832. * which contains groups of radio buttons
  2833. */
  2834. export class RadioGroup extends SelectorGroup {
  2835. private _selectNb;
  2836. /** Adds a radio button as a control
  2837. * @param label is the label for the selector
  2838. * @param func is the function called when the Selector is checked
  2839. * @param checked is true when Selector is checked
  2840. */
  2841. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  2842. /** @hidden */
  2843. _setSelectorLabel(selectorNb: number, label: string): void;
  2844. /** @hidden */
  2845. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2846. /** @hidden */
  2847. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2848. /** @hidden */
  2849. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2850. }
  2851. /** Class used to create a SliderGroup
  2852. * which contains groups of slider buttons
  2853. */
  2854. export class SliderGroup extends SelectorGroup {
  2855. /**
  2856. * Adds a slider to the SelectorGroup
  2857. * @param label is the label for the SliderBar
  2858. * @param func is the function called when the Slider moves
  2859. * @param unit is a string describing the units used, eg degrees or metres
  2860. * @param min is the minimum value for the Slider
  2861. * @param max is the maximum value for the Slider
  2862. * @param value is the start value for the Slider between min and max
  2863. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  2864. */
  2865. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  2866. /** @hidden */
  2867. _setSelectorLabel(selectorNb: number, label: string): void;
  2868. /** @hidden */
  2869. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2870. /** @hidden */
  2871. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2872. /** @hidden */
  2873. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2874. }
  2875. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  2876. * @see http://doc.babylonjs.com/how_to/selector
  2877. */
  2878. export class SelectionPanel extends Rectangle {
  2879. /** name of SelectionPanel */
  2880. name: string;
  2881. /** an array of SelectionGroups */
  2882. groups: SelectorGroup[];
  2883. private _panel;
  2884. private _buttonColor;
  2885. private _buttonBackground;
  2886. private _headerColor;
  2887. private _barColor;
  2888. private _barHeight;
  2889. private _spacerHeight;
  2890. private _labelColor;
  2891. private _groups;
  2892. private _bars;
  2893. /**
  2894. * Creates a new SelectionPanel
  2895. * @param name of SelectionPanel
  2896. * @param groups is an array of SelectionGroups
  2897. */
  2898. constructor(
  2899. /** name of SelectionPanel */
  2900. name: string,
  2901. /** an array of SelectionGroups */
  2902. groups?: SelectorGroup[]);
  2903. protected _getTypeName(): string;
  2904. /** Gets or sets the headerColor */
  2905. get headerColor(): string;
  2906. set headerColor(color: string);
  2907. private _setHeaderColor;
  2908. /** Gets or sets the button color */
  2909. get buttonColor(): string;
  2910. set buttonColor(color: string);
  2911. private _setbuttonColor;
  2912. /** Gets or sets the label color */
  2913. get labelColor(): string;
  2914. set labelColor(color: string);
  2915. private _setLabelColor;
  2916. /** Gets or sets the button background */
  2917. get buttonBackground(): string;
  2918. set buttonBackground(color: string);
  2919. private _setButtonBackground;
  2920. /** Gets or sets the color of separator bar */
  2921. get barColor(): string;
  2922. set barColor(color: string);
  2923. private _setBarColor;
  2924. /** Gets or sets the height of separator bar */
  2925. get barHeight(): string;
  2926. set barHeight(value: string);
  2927. private _setBarHeight;
  2928. /** Gets or sets the height of spacers*/
  2929. get spacerHeight(): string;
  2930. set spacerHeight(value: string);
  2931. private _setSpacerHeight;
  2932. /** Adds a bar between groups */
  2933. private _addSpacer;
  2934. /** Add a group to the selection panel
  2935. * @param group is the selector group to add
  2936. */
  2937. addGroup(group: SelectorGroup): void;
  2938. /** Remove the group from the given position
  2939. * @param groupNb is the position of the group in the list
  2940. */
  2941. removeGroup(groupNb: number): void;
  2942. /** Change a group header label
  2943. * @param label is the new group header label
  2944. * @param groupNb is the number of the group to relabel
  2945. * */
  2946. setHeaderName(label: string, groupNb: number): void;
  2947. /** Change selector label to the one given
  2948. * @param label is the new selector label
  2949. * @param groupNb is the number of the groupcontaining the selector
  2950. * @param selectorNb is the number of the selector within a group to relabel
  2951. * */
  2952. relabel(label: string, groupNb: number, selectorNb: number): void;
  2953. /** For a given group position remove the selector at the given position
  2954. * @param groupNb is the number of the group to remove the selector from
  2955. * @param selectorNb is the number of the selector within the group
  2956. */
  2957. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  2958. /** For a given group position of correct type add a checkbox button
  2959. * @param groupNb is the number of the group to remove the selector from
  2960. * @param label is the label for the selector
  2961. * @param func is the function called when the Selector is checked
  2962. * @param checked is true when Selector is checked
  2963. */
  2964. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2965. /** For a given group position of correct type add a radio button
  2966. * @param groupNb is the number of the group to remove the selector from
  2967. * @param label is the label for the selector
  2968. * @param func is the function called when the Selector is checked
  2969. * @param checked is true when Selector is checked
  2970. */
  2971. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2972. /**
  2973. * For a given slider group add a slider
  2974. * @param groupNb is the number of the group to add the slider to
  2975. * @param label is the label for the Slider
  2976. * @param func is the function called when the Slider moves
  2977. * @param unit is a string describing the units used, eg degrees or metres
  2978. * @param min is the minimum value for the Slider
  2979. * @param max is the maximum value for the Slider
  2980. * @param value is the start value for the Slider between min and max
  2981. * @param onVal is the function used to format the value displayed, eg radians to degrees
  2982. */
  2983. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  2984. }
  2985. }
  2986. declare module "babylonjs-gui/2D/controls/scrollViewers/scrollViewerWindow" {
  2987. import { Measure } from "babylonjs-gui/2D/measure";
  2988. import { Container } from "babylonjs-gui/2D/controls/container";
  2989. /**
  2990. * Class used to hold a the container for ScrollViewer
  2991. * @hidden
  2992. */
  2993. export class _ScrollViewerWindow extends Container {
  2994. parentClientWidth: number;
  2995. parentClientHeight: number;
  2996. private _freezeControls;
  2997. private _parentMeasure;
  2998. private _oldLeft;
  2999. private _oldTop;
  3000. get freezeControls(): boolean;
  3001. set freezeControls(value: boolean);
  3002. private _bucketWidth;
  3003. private _bucketHeight;
  3004. private _buckets;
  3005. private _bucketLen;
  3006. get bucketWidth(): number;
  3007. get bucketHeight(): number;
  3008. setBucketSizes(width: number, height: number): void;
  3009. private _useBuckets;
  3010. private _makeBuckets;
  3011. private _dispatchInBuckets;
  3012. private _updateMeasures;
  3013. private _updateChildrenMeasures;
  3014. /**
  3015. * Creates a new ScrollViewerWindow
  3016. * @param name of ScrollViewerWindow
  3017. */
  3018. constructor(name?: string);
  3019. protected _getTypeName(): string;
  3020. /** @hidden */
  3021. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3022. /** @hidden */
  3023. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3024. private _scrollChildren;
  3025. private _scrollChildrenWithBuckets;
  3026. /** @hidden */
  3027. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  3028. protected _postMeasure(): void;
  3029. }
  3030. }
  3031. declare module "babylonjs-gui/2D/controls/sliders/scrollBar" {
  3032. import { Vector2 } from "babylonjs/Maths/math";
  3033. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3034. import { Control } from "babylonjs-gui/2D/controls/control";
  3035. /**
  3036. * Class used to create slider controls
  3037. */
  3038. export class ScrollBar extends BaseSlider {
  3039. name?: string | undefined;
  3040. private _background;
  3041. private _borderColor;
  3042. private _tempMeasure;
  3043. /** Gets or sets border color */
  3044. get borderColor(): string;
  3045. set borderColor(value: string);
  3046. /** Gets or sets background color */
  3047. get background(): string;
  3048. set background(value: string);
  3049. /**
  3050. * Creates a new Slider
  3051. * @param name defines the control name
  3052. */
  3053. constructor(name?: string | undefined);
  3054. protected _getTypeName(): string;
  3055. protected _getThumbThickness(): number;
  3056. _draw(context: CanvasRenderingContext2D): void;
  3057. private _first;
  3058. private _originX;
  3059. private _originY;
  3060. /** @hidden */
  3061. protected _updateValueFromPointer(x: number, y: number): void;
  3062. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  3063. }
  3064. }
  3065. declare module "babylonjs-gui/2D/controls/sliders/imageScrollBar" {
  3066. import { Vector2 } from "babylonjs/Maths/math";
  3067. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3068. import { Control } from "babylonjs-gui/2D/controls/control";
  3069. import { Image } from "babylonjs-gui/2D/controls/image";
  3070. /**
  3071. * Class used to create slider controls
  3072. */
  3073. export class ImageScrollBar extends BaseSlider {
  3074. name?: string | undefined;
  3075. private _backgroundBaseImage;
  3076. private _backgroundImage;
  3077. private _thumbImage;
  3078. private _thumbBaseImage;
  3079. private _thumbLength;
  3080. private _thumbHeight;
  3081. private _barImageHeight;
  3082. private _tempMeasure;
  3083. /**
  3084. * Gets or sets the image used to render the background for horizontal bar
  3085. */
  3086. get backgroundImage(): Image;
  3087. set backgroundImage(value: Image);
  3088. /**
  3089. * Gets or sets the image used to render the thumb
  3090. */
  3091. get thumbImage(): Image;
  3092. set thumbImage(value: Image);
  3093. /**
  3094. * Gets or sets the length of the thumb
  3095. */
  3096. get thumbLength(): number;
  3097. set thumbLength(value: number);
  3098. /**
  3099. * Gets or sets the height of the thumb
  3100. */
  3101. get thumbHeight(): number;
  3102. set thumbHeight(value: number);
  3103. /**
  3104. * Gets or sets the height of the bar image
  3105. */
  3106. get barImageHeight(): number;
  3107. set barImageHeight(value: number);
  3108. /**
  3109. * Creates a new ImageScrollBar
  3110. * @param name defines the control name
  3111. */
  3112. constructor(name?: string | undefined);
  3113. protected _getTypeName(): string;
  3114. protected _getThumbThickness(): number;
  3115. _draw(context: CanvasRenderingContext2D): void;
  3116. private _first;
  3117. private _originX;
  3118. private _originY;
  3119. /** @hidden */
  3120. protected _updateValueFromPointer(x: number, y: number): void;
  3121. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  3122. }
  3123. }
  3124. declare module "babylonjs-gui/2D/controls/scrollViewers/scrollViewer" {
  3125. import { Nullable } from "babylonjs/types";
  3126. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  3127. import { Image } from "babylonjs-gui/2D/controls/image";
  3128. import { Control } from "babylonjs-gui/2D/controls/control";
  3129. import { Container } from "babylonjs-gui/2D/controls/container";
  3130. import { Measure } from "babylonjs-gui/2D/measure";
  3131. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3132. import { ScrollBar } from "babylonjs-gui/2D/controls/sliders/scrollBar";
  3133. import { ImageScrollBar } from "babylonjs-gui/2D/controls/sliders/imageScrollBar";
  3134. /**
  3135. * Class used to hold a viewer window and sliders in a grid
  3136. */
  3137. export class ScrollViewer extends Rectangle {
  3138. private _grid;
  3139. private _horizontalBarSpace;
  3140. private _verticalBarSpace;
  3141. private _dragSpace;
  3142. private _horizontalBar;
  3143. private _verticalBar;
  3144. private _barColor;
  3145. private _barBackground;
  3146. private _barImage;
  3147. private _horizontalBarImage;
  3148. private _verticalBarImage;
  3149. private _barBackgroundImage;
  3150. private _horizontalBarBackgroundImage;
  3151. private _verticalBarBackgroundImage;
  3152. private _barSize;
  3153. private _window;
  3154. private _pointerIsOver;
  3155. private _wheelPrecision;
  3156. private _onPointerObserver;
  3157. private _clientWidth;
  3158. private _clientHeight;
  3159. private _useImageBar;
  3160. private _thumbLength;
  3161. private _thumbHeight;
  3162. private _barImageHeight;
  3163. private _horizontalBarImageHeight;
  3164. private _verticalBarImageHeight;
  3165. /**
  3166. * Gets the horizontal scrollbar
  3167. */
  3168. get horizontalBar(): ScrollBar | ImageScrollBar;
  3169. /**
  3170. * Gets the vertical scrollbar
  3171. */
  3172. get verticalBar(): ScrollBar | ImageScrollBar;
  3173. /**
  3174. * Adds a new control to the current container
  3175. * @param control defines the control to add
  3176. * @returns the current container
  3177. */
  3178. addControl(control: Nullable<Control>): Container;
  3179. /**
  3180. * Removes a control from the current container
  3181. * @param control defines the control to remove
  3182. * @returns the current container
  3183. */
  3184. removeControl(control: Control): Container;
  3185. /** Gets the list of children */
  3186. get children(): Control[];
  3187. _flagDescendantsAsMatrixDirty(): void;
  3188. /**
  3189. * Freezes or unfreezes the controls in the window.
  3190. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  3191. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  3192. */
  3193. get freezeControls(): boolean;
  3194. set freezeControls(value: boolean);
  3195. /** Gets the bucket width */
  3196. get bucketWidth(): number;
  3197. /** Gets the bucket height */
  3198. get bucketHeight(): number;
  3199. /**
  3200. * Sets the bucket sizes.
  3201. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  3202. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  3203. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  3204. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  3205. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  3206. * used), that's why it is not enabled by default.
  3207. * @param width width of the bucket
  3208. * @param height height of the bucket
  3209. */
  3210. setBucketSizes(width: number, height: number): void;
  3211. private _forceHorizontalBar;
  3212. private _forceVerticalBar;
  3213. /**
  3214. * Forces the horizontal scroll bar to be displayed
  3215. */
  3216. get forceHorizontalBar(): boolean;
  3217. set forceHorizontalBar(value: boolean);
  3218. /**
  3219. * Forces the vertical scroll bar to be displayed
  3220. */
  3221. get forceVerticalBar(): boolean;
  3222. set forceVerticalBar(value: boolean);
  3223. /**
  3224. * Creates a new ScrollViewer
  3225. * @param name of ScrollViewer
  3226. */
  3227. constructor(name?: string, isImageBased?: boolean);
  3228. /** Reset the scroll viewer window to initial size */
  3229. resetWindow(): void;
  3230. protected _getTypeName(): string;
  3231. private _buildClientSizes;
  3232. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3233. protected _postMeasure(): void;
  3234. /**
  3235. * Gets or sets the mouse wheel precision
  3236. * from 0 to 1 with a default value of 0.05
  3237. * */
  3238. get wheelPrecision(): number;
  3239. set wheelPrecision(value: number);
  3240. /** Gets or sets the scroll bar container background color */
  3241. get scrollBackground(): string;
  3242. set scrollBackground(color: string);
  3243. /** Gets or sets the bar color */
  3244. get barColor(): string;
  3245. set barColor(color: string);
  3246. /** Gets or sets the bar image */
  3247. get thumbImage(): Image;
  3248. set thumbImage(value: Image);
  3249. /** Gets or sets the horizontal bar image */
  3250. get horizontalThumbImage(): Image;
  3251. set horizontalThumbImage(value: Image);
  3252. /** Gets or sets the vertical bar image */
  3253. get verticalThumbImage(): Image;
  3254. set verticalThumbImage(value: Image);
  3255. /** Gets or sets the size of the bar */
  3256. get barSize(): number;
  3257. set barSize(value: number);
  3258. /** Gets or sets the length of the thumb */
  3259. get thumbLength(): number;
  3260. set thumbLength(value: number);
  3261. /** Gets or sets the height of the thumb */
  3262. get thumbHeight(): number;
  3263. set thumbHeight(value: number);
  3264. /** Gets or sets the height of the bar image */
  3265. get barImageHeight(): number;
  3266. set barImageHeight(value: number);
  3267. /** Gets or sets the height of the horizontal bar image */
  3268. get horizontalBarImageHeight(): number;
  3269. set horizontalBarImageHeight(value: number);
  3270. /** Gets or sets the height of the vertical bar image */
  3271. get verticalBarImageHeight(): number;
  3272. set verticalBarImageHeight(value: number);
  3273. /** Gets or sets the bar background */
  3274. get barBackground(): string;
  3275. set barBackground(color: string);
  3276. /** Gets or sets the bar background image */
  3277. get barImage(): Image;
  3278. set barImage(value: Image);
  3279. /** Gets or sets the horizontal bar background image */
  3280. get horizontalBarImage(): Image;
  3281. set horizontalBarImage(value: Image);
  3282. /** Gets or sets the vertical bar background image */
  3283. get verticalBarImage(): Image;
  3284. set verticalBarImage(value: Image);
  3285. private _setWindowPosition;
  3286. /** @hidden */
  3287. private _updateScroller;
  3288. _link(host: AdvancedDynamicTexture): void;
  3289. /** @hidden */
  3290. private _addBar;
  3291. /** @hidden */
  3292. private _attachWheel;
  3293. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  3294. /** Releases associated resources */
  3295. dispose(): void;
  3296. }
  3297. }
  3298. declare module "babylonjs-gui/2D/controls/displayGrid" {
  3299. import { Control } from "babylonjs-gui/2D/controls/control";
  3300. import { Nullable } from 'babylonjs/types';
  3301. import { Measure } from "babylonjs-gui/2D/measure";
  3302. /** Class used to render a grid */
  3303. export class DisplayGrid extends Control {
  3304. name?: string | undefined;
  3305. private _cellWidth;
  3306. private _cellHeight;
  3307. private _minorLineTickness;
  3308. private _minorLineColor;
  3309. private _majorLineTickness;
  3310. private _majorLineColor;
  3311. private _majorLineFrequency;
  3312. private _background;
  3313. private _displayMajorLines;
  3314. private _displayMinorLines;
  3315. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  3316. get displayMinorLines(): boolean;
  3317. set displayMinorLines(value: boolean);
  3318. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  3319. get displayMajorLines(): boolean;
  3320. set displayMajorLines(value: boolean);
  3321. /** Gets or sets background color (Black by default) */
  3322. get background(): string;
  3323. set background(value: string);
  3324. /** Gets or sets the width of each cell (20 by default) */
  3325. get cellWidth(): number;
  3326. set cellWidth(value: number);
  3327. /** Gets or sets the height of each cell (20 by default) */
  3328. get cellHeight(): number;
  3329. set cellHeight(value: number);
  3330. /** Gets or sets the tickness of minor lines (1 by default) */
  3331. get minorLineTickness(): number;
  3332. set minorLineTickness(value: number);
  3333. /** Gets or sets the color of minor lines (DarkGray by default) */
  3334. get minorLineColor(): string;
  3335. set minorLineColor(value: string);
  3336. /** Gets or sets the tickness of major lines (2 by default) */
  3337. get majorLineTickness(): number;
  3338. set majorLineTickness(value: number);
  3339. /** Gets or sets the color of major lines (White by default) */
  3340. get majorLineColor(): string;
  3341. set majorLineColor(value: string);
  3342. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  3343. get majorLineFrequency(): number;
  3344. set majorLineFrequency(value: number);
  3345. /**
  3346. * Creates a new GridDisplayRectangle
  3347. * @param name defines the control name
  3348. */
  3349. constructor(name?: string | undefined);
  3350. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  3351. protected _getTypeName(): string;
  3352. }
  3353. }
  3354. declare module "babylonjs-gui/2D/controls/sliders/imageBasedSlider" {
  3355. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3356. import { Measure } from "babylonjs-gui/2D/measure";
  3357. import { Image } from "babylonjs-gui/2D/controls/image";
  3358. import { Nullable } from 'babylonjs/types';
  3359. /**
  3360. * Class used to create slider controls based on images
  3361. */
  3362. export class ImageBasedSlider extends BaseSlider {
  3363. name?: string | undefined;
  3364. private _backgroundImage;
  3365. private _thumbImage;
  3366. private _valueBarImage;
  3367. private _tempMeasure;
  3368. get displayThumb(): boolean;
  3369. set displayThumb(value: boolean);
  3370. /**
  3371. * Gets or sets the image used to render the background
  3372. */
  3373. get backgroundImage(): Image;
  3374. set backgroundImage(value: Image);
  3375. /**
  3376. * Gets or sets the image used to render the value bar
  3377. */
  3378. get valueBarImage(): Image;
  3379. set valueBarImage(value: Image);
  3380. /**
  3381. * Gets or sets the image used to render the thumb
  3382. */
  3383. get thumbImage(): Image;
  3384. set thumbImage(value: Image);
  3385. /**
  3386. * Creates a new ImageBasedSlider
  3387. * @param name defines the control name
  3388. */
  3389. constructor(name?: string | undefined);
  3390. protected _getTypeName(): string;
  3391. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  3392. }
  3393. }
  3394. declare module "babylonjs-gui/2D/controls/statics" {
  3395. /**
  3396. * Forcing an export so that this code will execute
  3397. * @hidden
  3398. */
  3399. const name = "Statics";
  3400. export { name };
  3401. }
  3402. declare module "babylonjs-gui/2D/controls/index" {
  3403. export * from "babylonjs-gui/2D/controls/button";
  3404. export * from "babylonjs-gui/2D/controls/checkbox";
  3405. export * from "babylonjs-gui/2D/controls/colorpicker";
  3406. export * from "babylonjs-gui/2D/controls/container";
  3407. export * from "babylonjs-gui/2D/controls/control";
  3408. export * from "babylonjs-gui/2D/controls/ellipse";
  3409. export * from "babylonjs-gui/2D/controls/grid";
  3410. export * from "babylonjs-gui/2D/controls/image";
  3411. export * from "babylonjs-gui/2D/controls/inputText";
  3412. export * from "babylonjs-gui/2D/controls/inputPassword";
  3413. export * from "babylonjs-gui/2D/controls/line";
  3414. export * from "babylonjs-gui/2D/controls/multiLine";
  3415. export * from "babylonjs-gui/2D/controls/radioButton";
  3416. export * from "babylonjs-gui/2D/controls/stackPanel";
  3417. export * from "babylonjs-gui/2D/controls/selector";
  3418. export * from "babylonjs-gui/2D/controls/scrollViewers/scrollViewer";
  3419. export * from "babylonjs-gui/2D/controls/textBlock";
  3420. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  3421. export * from "babylonjs-gui/2D/controls/rectangle";
  3422. export * from "babylonjs-gui/2D/controls/displayGrid";
  3423. export * from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3424. export * from "babylonjs-gui/2D/controls/sliders/slider";
  3425. export * from "babylonjs-gui/2D/controls/sliders/imageBasedSlider";
  3426. export * from "babylonjs-gui/2D/controls/sliders/scrollBar";
  3427. export * from "babylonjs-gui/2D/controls/sliders/imageScrollBar";
  3428. export * from "babylonjs-gui/2D/controls/statics";
  3429. }
  3430. declare module "babylonjs-gui/2D/adtInstrumentation" {
  3431. import { PerfCounter } from "babylonjs/Misc/perfCounter";
  3432. import { IDisposable } from "babylonjs/scene";
  3433. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3434. /**
  3435. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  3436. */
  3437. export class AdvancedDynamicTextureInstrumentation implements IDisposable {
  3438. /**
  3439. * Define the instrumented AdvancedDynamicTexture.
  3440. */
  3441. texture: AdvancedDynamicTexture;
  3442. private _captureRenderTime;
  3443. private _renderTime;
  3444. private _captureLayoutTime;
  3445. private _layoutTime;
  3446. private _onBeginRenderObserver;
  3447. private _onEndRenderObserver;
  3448. private _onBeginLayoutObserver;
  3449. private _onEndLayoutObserver;
  3450. /**
  3451. * Gets the perf counter used to capture render time
  3452. */
  3453. get renderTimeCounter(): PerfCounter;
  3454. /**
  3455. * Gets the perf counter used to capture layout time
  3456. */
  3457. get layoutTimeCounter(): PerfCounter;
  3458. /**
  3459. * Enable or disable the render time capture
  3460. */
  3461. get captureRenderTime(): boolean;
  3462. set captureRenderTime(value: boolean);
  3463. /**
  3464. * Enable or disable the layout time capture
  3465. */
  3466. get captureLayoutTime(): boolean;
  3467. set captureLayoutTime(value: boolean);
  3468. /**
  3469. * Instantiates a new advanced dynamic texture instrumentation.
  3470. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  3471. * @param texture Defines the AdvancedDynamicTexture to instrument
  3472. */
  3473. constructor(
  3474. /**
  3475. * Define the instrumented AdvancedDynamicTexture.
  3476. */
  3477. texture: AdvancedDynamicTexture);
  3478. /**
  3479. * Dispose and release associated resources.
  3480. */
  3481. dispose(): void;
  3482. }
  3483. }
  3484. declare module "babylonjs-gui/2D/xmlLoader" {
  3485. /**
  3486. * Class used to load GUI via XML.
  3487. */
  3488. export class XmlLoader {
  3489. private _nodes;
  3490. private _nodeTypes;
  3491. private _isLoaded;
  3492. private _objectAttributes;
  3493. private _parentClass;
  3494. /**
  3495. * Create a new xml loader
  3496. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  3497. */
  3498. constructor(parentClass?: null);
  3499. private _getChainElement;
  3500. private _getClassAttribute;
  3501. private _createGuiElement;
  3502. private _parseGrid;
  3503. private _parseElement;
  3504. private _prepareSourceElement;
  3505. private _parseElementsFromSource;
  3506. private _parseXml;
  3507. /**
  3508. * Gets if the loading has finished.
  3509. * @returns whether the loading has finished or not
  3510. */
  3511. isLoaded(): boolean;
  3512. /**
  3513. * Gets a loaded node / control by id.
  3514. * @param id the Controls id set in the xml
  3515. * @returns element of type Control
  3516. */
  3517. getNodeById(id: string): any;
  3518. /**
  3519. * Gets all loaded nodes / controls
  3520. * @returns Array of controls
  3521. */
  3522. getNodes(): any;
  3523. /**
  3524. * Initiates the xml layout loading
  3525. * @param xmlFile defines the xml layout to load
  3526. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  3527. * @param callback defines the callback called on layout load.
  3528. */
  3529. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  3530. }
  3531. }
  3532. declare module "babylonjs-gui/2D/index" {
  3533. export * from "babylonjs-gui/2D/controls/index";
  3534. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  3535. export * from "babylonjs-gui/2D/adtInstrumentation";
  3536. export * from "babylonjs-gui/2D/math2D";
  3537. export * from "babylonjs-gui/2D/measure";
  3538. export * from "babylonjs-gui/2D/multiLinePoint";
  3539. export * from "babylonjs-gui/2D/style";
  3540. export * from "babylonjs-gui/2D/valueAndUnit";
  3541. export * from "babylonjs-gui/2D/xmlLoader";
  3542. }
  3543. declare module "babylonjs-gui/3D/controls/container3D" {
  3544. import { Nullable } from "babylonjs/types";
  3545. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3546. import { Scene } from "babylonjs/scene";
  3547. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3548. /**
  3549. * Class used to create containers for controls
  3550. */
  3551. export class Container3D extends Control3D {
  3552. private _blockLayout;
  3553. /**
  3554. * Gets the list of child controls
  3555. */
  3556. protected _children: Control3D[];
  3557. /**
  3558. * Gets the list of child controls
  3559. */
  3560. get children(): Array<Control3D>;
  3561. /**
  3562. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  3563. * This is helpful to optimize layout operation when adding multiple children in a row
  3564. */
  3565. get blockLayout(): boolean;
  3566. set blockLayout(value: boolean);
  3567. /**
  3568. * Creates a new container
  3569. * @param name defines the container name
  3570. */
  3571. constructor(name?: string);
  3572. /**
  3573. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  3574. * @returns the current container
  3575. */
  3576. updateLayout(): Container3D;
  3577. /**
  3578. * Gets a boolean indicating if the given control is in the children of this control
  3579. * @param control defines the control to check
  3580. * @returns true if the control is in the child list
  3581. */
  3582. containsControl(control: Control3D): boolean;
  3583. /**
  3584. * Adds a control to the children of this control
  3585. * @param control defines the control to add
  3586. * @returns the current container
  3587. */
  3588. addControl(control: Control3D): Container3D;
  3589. /**
  3590. * This function will be called everytime a new control is added
  3591. */
  3592. protected _arrangeChildren(): void;
  3593. protected _createNode(scene: Scene): Nullable<TransformNode>;
  3594. /**
  3595. * Removes a control from the children of this control
  3596. * @param control defines the control to remove
  3597. * @returns the current container
  3598. */
  3599. removeControl(control: Control3D): Container3D;
  3600. protected _getTypeName(): string;
  3601. /**
  3602. * Releases all associated resources
  3603. */
  3604. dispose(): void;
  3605. /** Control rotation will remain unchanged */
  3606. static readonly UNSET_ORIENTATION: number;
  3607. /** Control will rotate to make it look at sphere central axis */
  3608. static readonly FACEORIGIN_ORIENTATION: number;
  3609. /** Control will rotate to make it look back at sphere central axis */
  3610. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  3611. /** Control will rotate to look at z axis (0, 0, 1) */
  3612. static readonly FACEFORWARD_ORIENTATION: number;
  3613. /** Control will rotate to look at negative z axis (0, 0, -1) */
  3614. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  3615. }
  3616. }
  3617. declare module "babylonjs-gui/3D/gui3DManager" {
  3618. import { Nullable } from "babylonjs/types";
  3619. import { Observable } from "babylonjs/Misc/observable";
  3620. import { Vector3 } from "babylonjs/Maths/math";
  3621. import { Material } from "babylonjs/Materials/material";
  3622. import { UtilityLayerRenderer } from "babylonjs/Rendering/utilityLayerRenderer";
  3623. import { IDisposable, Scene } from "babylonjs/scene";
  3624. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3625. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3626. /**
  3627. * Class used to manage 3D user interface
  3628. * @see http://doc.babylonjs.com/how_to/gui3d
  3629. */
  3630. export class GUI3DManager implements IDisposable {
  3631. private _scene;
  3632. private _sceneDisposeObserver;
  3633. private _utilityLayer;
  3634. private _rootContainer;
  3635. private _pointerObserver;
  3636. private _pointerOutObserver;
  3637. /** @hidden */
  3638. _lastPickedControl: Control3D;
  3639. /** @hidden */
  3640. _lastControlOver: {
  3641. [pointerId: number]: Control3D;
  3642. };
  3643. /** @hidden */
  3644. _lastControlDown: {
  3645. [pointerId: number]: Control3D;
  3646. };
  3647. /**
  3648. * Observable raised when the point picked by the pointer events changed
  3649. */
  3650. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  3651. /** @hidden */
  3652. _sharedMaterials: {
  3653. [key: string]: Material;
  3654. };
  3655. /** Gets the hosting scene */
  3656. get scene(): Scene;
  3657. /** Gets associated utility layer */
  3658. get utilityLayer(): Nullable<UtilityLayerRenderer>;
  3659. /**
  3660. * Creates a new GUI3DManager
  3661. * @param scene
  3662. */
  3663. constructor(scene?: Scene);
  3664. private _handlePointerOut;
  3665. private _doPicking;
  3666. /**
  3667. * Gets the root container
  3668. */
  3669. get rootContainer(): Container3D;
  3670. /**
  3671. * Gets a boolean indicating if the given control is in the root child list
  3672. * @param control defines the control to check
  3673. * @returns true if the control is in the root child list
  3674. */
  3675. containsControl(control: Control3D): boolean;
  3676. /**
  3677. * Adds a control to the root child list
  3678. * @param control defines the control to add
  3679. * @returns the current manager
  3680. */
  3681. addControl(control: Control3D): GUI3DManager;
  3682. /**
  3683. * Removes a control from the root child list
  3684. * @param control defines the control to remove
  3685. * @returns the current container
  3686. */
  3687. removeControl(control: Control3D): GUI3DManager;
  3688. /**
  3689. * Releases all associated resources
  3690. */
  3691. dispose(): void;
  3692. }
  3693. }
  3694. declare module "babylonjs-gui/3D/vector3WithInfo" {
  3695. import { Vector3 } from "babylonjs/Maths/math";
  3696. /**
  3697. * Class used to transport Vector3 information for pointer events
  3698. */
  3699. export class Vector3WithInfo extends Vector3 {
  3700. /** defines the current mouse button index */
  3701. buttonIndex: number;
  3702. /**
  3703. * Creates a new Vector3WithInfo
  3704. * @param source defines the vector3 data to transport
  3705. * @param buttonIndex defines the current mouse button index
  3706. */
  3707. constructor(source: Vector3,
  3708. /** defines the current mouse button index */
  3709. buttonIndex?: number);
  3710. }
  3711. }
  3712. declare module "babylonjs-gui/3D/controls/control3D" {
  3713. import { Nullable } from "babylonjs/types";
  3714. import { Observable } from "babylonjs/Misc/observable";
  3715. import { Vector3 } from "babylonjs/Maths/math";
  3716. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3717. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  3718. import { IBehaviorAware, Behavior } from "babylonjs/Behaviors/behavior";
  3719. import { IDisposable, Scene } from "babylonjs/scene";
  3720. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  3721. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  3722. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3723. /**
  3724. * Class used as base class for controls
  3725. */
  3726. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  3727. /** Defines the control name */
  3728. name?: string | undefined;
  3729. /** @hidden */
  3730. _host: GUI3DManager;
  3731. private _node;
  3732. private _downCount;
  3733. private _enterCount;
  3734. private _downPointerIds;
  3735. private _isVisible;
  3736. /** Gets or sets the control position in world space */
  3737. get position(): Vector3;
  3738. set position(value: Vector3);
  3739. /** Gets or sets the control scaling in world space */
  3740. get scaling(): Vector3;
  3741. set scaling(value: Vector3);
  3742. /** Callback used to start pointer enter animation */
  3743. pointerEnterAnimation: () => void;
  3744. /** Callback used to start pointer out animation */
  3745. pointerOutAnimation: () => void;
  3746. /** Callback used to start pointer down animation */
  3747. pointerDownAnimation: () => void;
  3748. /** Callback used to start pointer up animation */
  3749. pointerUpAnimation: () => void;
  3750. /**
  3751. * An event triggered when the pointer move over the control
  3752. */
  3753. onPointerMoveObservable: Observable<Vector3>;
  3754. /**
  3755. * An event triggered when the pointer move out of the control
  3756. */
  3757. onPointerOutObservable: Observable<Control3D>;
  3758. /**
  3759. * An event triggered when the pointer taps the control
  3760. */
  3761. onPointerDownObservable: Observable<Vector3WithInfo>;
  3762. /**
  3763. * An event triggered when pointer is up
  3764. */
  3765. onPointerUpObservable: Observable<Vector3WithInfo>;
  3766. /**
  3767. * An event triggered when a control is clicked on (with a mouse)
  3768. */
  3769. onPointerClickObservable: Observable<Vector3WithInfo>;
  3770. /**
  3771. * An event triggered when pointer enters the control
  3772. */
  3773. onPointerEnterObservable: Observable<Control3D>;
  3774. /**
  3775. * Gets or sets the parent container
  3776. */
  3777. parent: Nullable<Container3D>;
  3778. private _behaviors;
  3779. /**
  3780. * Gets the list of attached behaviors
  3781. * @see http://doc.babylonjs.com/features/behaviour
  3782. */
  3783. get behaviors(): Behavior<Control3D>[];
  3784. /**
  3785. * Attach a behavior to the control
  3786. * @see http://doc.babylonjs.com/features/behaviour
  3787. * @param behavior defines the behavior to attach
  3788. * @returns the current control
  3789. */
  3790. addBehavior(behavior: Behavior<Control3D>): Control3D;
  3791. /**
  3792. * Remove an attached behavior
  3793. * @see http://doc.babylonjs.com/features/behaviour
  3794. * @param behavior defines the behavior to attach
  3795. * @returns the current control
  3796. */
  3797. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  3798. /**
  3799. * Gets an attached behavior by name
  3800. * @param name defines the name of the behavior to look for
  3801. * @see http://doc.babylonjs.com/features/behaviour
  3802. * @returns null if behavior was not found else the requested behavior
  3803. */
  3804. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  3805. /** Gets or sets a boolean indicating if the control is visible */
  3806. get isVisible(): boolean;
  3807. set isVisible(value: boolean);
  3808. /**
  3809. * Creates a new control
  3810. * @param name defines the control name
  3811. */
  3812. constructor(
  3813. /** Defines the control name */
  3814. name?: string | undefined);
  3815. /**
  3816. * Gets a string representing the class name
  3817. */
  3818. get typeName(): string;
  3819. /**
  3820. * Get the current class name of the control.
  3821. * @returns current class name
  3822. */
  3823. getClassName(): string;
  3824. protected _getTypeName(): string;
  3825. /**
  3826. * Gets the transform node used by this control
  3827. */
  3828. get node(): Nullable<TransformNode>;
  3829. /**
  3830. * Gets the mesh used to render this control
  3831. */
  3832. get mesh(): Nullable<AbstractMesh>;
  3833. /**
  3834. * Link the control as child of the given node
  3835. * @param node defines the node to link to. Use null to unlink the control
  3836. * @returns the current control
  3837. */
  3838. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  3839. /** @hidden **/
  3840. _prepareNode(scene: Scene): void;
  3841. /**
  3842. * Node creation.
  3843. * Can be overriden by children
  3844. * @param scene defines the scene where the node must be attached
  3845. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  3846. */
  3847. protected _createNode(scene: Scene): Nullable<TransformNode>;
  3848. /**
  3849. * Affect a material to the given mesh
  3850. * @param mesh defines the mesh which will represent the control
  3851. */
  3852. protected _affectMaterial(mesh: AbstractMesh): void;
  3853. /** @hidden */
  3854. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  3855. /** @hidden */
  3856. _onPointerEnter(target: Control3D): boolean;
  3857. /** @hidden */
  3858. _onPointerOut(target: Control3D): void;
  3859. /** @hidden */
  3860. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  3861. /** @hidden */
  3862. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3863. /** @hidden */
  3864. forcePointerUp(pointerId?: Nullable<number>): void;
  3865. /** @hidden */
  3866. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  3867. /** @hidden */
  3868. _disposeNode(): void;
  3869. /**
  3870. * Releases all associated resources
  3871. */
  3872. dispose(): void;
  3873. }
  3874. }
  3875. declare module "babylonjs-gui/3D/controls/abstractButton3D" {
  3876. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3877. import { Scene } from "babylonjs/scene";
  3878. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3879. /**
  3880. * Class used as a root to all buttons
  3881. */
  3882. export class AbstractButton3D extends Control3D {
  3883. /**
  3884. * Creates a new button
  3885. * @param name defines the control name
  3886. */
  3887. constructor(name?: string);
  3888. protected _getTypeName(): string;
  3889. protected _createNode(scene: Scene): TransformNode;
  3890. }
  3891. }
  3892. declare module "babylonjs-gui/3D/controls/button3D" {
  3893. import { int } from "babylonjs/types";
  3894. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3895. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  3896. import { Material } from "babylonjs/Materials/material";
  3897. import { Scene } from "babylonjs/scene";
  3898. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  3899. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3900. import { Control } from "babylonjs-gui/2D/controls/control";
  3901. /**
  3902. * Class used to create a button in 3D
  3903. */
  3904. export class Button3D extends AbstractButton3D {
  3905. /** @hidden */
  3906. protected _currentMaterial: Material;
  3907. private _facadeTexture;
  3908. private _content;
  3909. private _contentResolution;
  3910. private _contentScaleRatio;
  3911. /**
  3912. * Gets or sets the texture resolution used to render content (512 by default)
  3913. */
  3914. get contentResolution(): int;
  3915. set contentResolution(value: int);
  3916. /**
  3917. * Gets or sets the texture scale ratio used to render content (2 by default)
  3918. */
  3919. get contentScaleRatio(): number;
  3920. set contentScaleRatio(value: number);
  3921. protected _disposeFacadeTexture(): void;
  3922. protected _resetContent(): void;
  3923. /**
  3924. * Creates a new button
  3925. * @param name defines the control name
  3926. */
  3927. constructor(name?: string);
  3928. /**
  3929. * Gets or sets the GUI 2D content used to display the button's facade
  3930. */
  3931. get content(): Control;
  3932. set content(value: Control);
  3933. /**
  3934. * Apply the facade texture (created from the content property).
  3935. * This function can be overloaded by child classes
  3936. * @param facadeTexture defines the AdvancedDynamicTexture to use
  3937. */
  3938. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  3939. protected _getTypeName(): string;
  3940. protected _createNode(scene: Scene): TransformNode;
  3941. protected _affectMaterial(mesh: AbstractMesh): void;
  3942. /**
  3943. * Releases all associated resources
  3944. */
  3945. dispose(): void;
  3946. }
  3947. }
  3948. declare module "babylonjs-gui/3D/controls/volumeBasedPanel" {
  3949. import { Vector3 } from "babylonjs/Maths/math.vector";
  3950. import { int } from "babylonjs/types";
  3951. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3952. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3953. /**
  3954. * Abstract class used to create a container panel deployed on the surface of a volume
  3955. */
  3956. export abstract class VolumeBasedPanel extends Container3D {
  3957. private _columns;
  3958. private _rows;
  3959. private _rowThenColum;
  3960. private _orientation;
  3961. protected _cellWidth: number;
  3962. protected _cellHeight: number;
  3963. /**
  3964. * Gets or sets the distance between elements
  3965. */
  3966. margin: number;
  3967. /**
  3968. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  3969. * | Value | Type | Description |
  3970. * | ----- | ----------------------------------- | ----------- |
  3971. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  3972. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  3973. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  3974. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  3975. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  3976. */
  3977. get orientation(): number;
  3978. set orientation(value: number);
  3979. /**
  3980. * Gets or sets the number of columns requested (10 by default).
  3981. * The panel will automatically compute the number of rows based on number of child controls.
  3982. */
  3983. get columns(): int;
  3984. set columns(value: int);
  3985. /**
  3986. * Gets or sets a the number of rows requested.
  3987. * The panel will automatically compute the number of columns based on number of child controls.
  3988. */
  3989. get rows(): int;
  3990. set rows(value: int);
  3991. /**
  3992. * Creates new VolumeBasedPanel
  3993. */
  3994. constructor();
  3995. protected _arrangeChildren(): void;
  3996. /** Child classes must implement this function to provide correct control positioning */
  3997. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  3998. /** Child classes can implement this function to provide additional processing */
  3999. protected _finalProcessing(): void;
  4000. }
  4001. }
  4002. declare module "babylonjs-gui/3D/controls/cylinderPanel" {
  4003. import { Vector3 } from "babylonjs/Maths/math.vector";
  4004. import { float } from "babylonjs/types";
  4005. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4006. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4007. /**
  4008. * Class used to create a container panel deployed on the surface of a cylinder
  4009. */
  4010. export class CylinderPanel extends VolumeBasedPanel {
  4011. private _radius;
  4012. /**
  4013. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  4014. */
  4015. get radius(): float;
  4016. set radius(value: float);
  4017. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4018. private _cylindricalMapping;
  4019. }
  4020. }
  4021. declare module "babylonjs-gui/3D/materials/shaders/fluent.vertex" {
  4022. /** @hidden */
  4023. export var fluentVertexShader: {
  4024. name: string;
  4025. shader: string;
  4026. };
  4027. }
  4028. declare module "babylonjs-gui/3D/materials/shaders/fluent.fragment" {
  4029. /** @hidden */
  4030. export var fluentPixelShader: {
  4031. name: string;
  4032. shader: string;
  4033. };
  4034. }
  4035. declare module "babylonjs-gui/3D/materials/fluentMaterial" {
  4036. import { Nullable } from "babylonjs/types";
  4037. import { Color3, Vector3, Color4, Matrix } from "babylonjs/Maths/math";
  4038. import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
  4039. import { MaterialDefines } from "babylonjs/Materials/materialDefines";
  4040. import { PushMaterial } from "babylonjs/Materials/pushMaterial";
  4041. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4042. import { SubMesh } from "babylonjs/Meshes/subMesh";
  4043. import { Mesh } from "babylonjs/Meshes/mesh";
  4044. import { Scene } from "babylonjs/scene";
  4045. import "babylonjs-gui/3D/materials/shaders/fluent.vertex";
  4046. import "babylonjs-gui/3D/materials/shaders/fluent.fragment";
  4047. /** @hidden */
  4048. export class FluentMaterialDefines extends MaterialDefines {
  4049. INNERGLOW: boolean;
  4050. BORDER: boolean;
  4051. HOVERLIGHT: boolean;
  4052. TEXTURE: boolean;
  4053. constructor();
  4054. }
  4055. /**
  4056. * Class used to render controls with fluent desgin
  4057. */
  4058. export class FluentMaterial extends PushMaterial {
  4059. /**
  4060. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  4061. */
  4062. innerGlowColorIntensity: number;
  4063. /**
  4064. * Gets or sets the inner glow color (white by default)
  4065. */
  4066. innerGlowColor: Color3;
  4067. /**
  4068. * Gets or sets alpha value (default is 1.0)
  4069. */
  4070. alpha: number;
  4071. /**
  4072. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  4073. */
  4074. albedoColor: Color3;
  4075. /**
  4076. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  4077. */
  4078. renderBorders: boolean;
  4079. /**
  4080. * Gets or sets border width (default is 0.5)
  4081. */
  4082. borderWidth: number;
  4083. /**
  4084. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  4085. */
  4086. edgeSmoothingValue: number;
  4087. /**
  4088. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  4089. */
  4090. borderMinValue: number;
  4091. /**
  4092. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  4093. */
  4094. renderHoverLight: boolean;
  4095. /**
  4096. * Gets or sets the radius used to render the hover light (default is 1.0)
  4097. */
  4098. hoverRadius: number;
  4099. /**
  4100. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  4101. */
  4102. hoverColor: Color4;
  4103. /**
  4104. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  4105. */
  4106. hoverPosition: Vector3;
  4107. private _albedoTexture;
  4108. /** Gets or sets the texture to use for albedo color */
  4109. albedoTexture: Nullable<BaseTexture>;
  4110. /**
  4111. * Creates a new Fluent material
  4112. * @param name defines the name of the material
  4113. * @param scene defines the hosting scene
  4114. */
  4115. constructor(name: string, scene: Scene);
  4116. needAlphaBlending(): boolean;
  4117. needAlphaTesting(): boolean;
  4118. getAlphaTestTexture(): Nullable<BaseTexture>;
  4119. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  4120. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  4121. getActiveTextures(): BaseTexture[];
  4122. hasTexture(texture: BaseTexture): boolean;
  4123. dispose(forceDisposeEffect?: boolean): void;
  4124. clone(name: string): FluentMaterial;
  4125. serialize(): any;
  4126. getClassName(): string;
  4127. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  4128. }
  4129. }
  4130. declare module "babylonjs-gui/3D/controls/holographicButton" {
  4131. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  4132. import { Nullable } from "babylonjs/types";
  4133. import { StandardMaterial } from "babylonjs/Materials/standardMaterial";
  4134. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4135. import { Mesh } from "babylonjs/Meshes/mesh";
  4136. import { Scene } from "babylonjs/scene";
  4137. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  4138. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  4139. /**
  4140. * Class used to create a holographic button in 3D
  4141. */
  4142. export class HolographicButton extends Button3D {
  4143. private _backPlate;
  4144. private _textPlate;
  4145. private _frontPlate;
  4146. private _text;
  4147. private _imageUrl;
  4148. private _shareMaterials;
  4149. private _frontMaterial;
  4150. private _backMaterial;
  4151. private _plateMaterial;
  4152. private _pickedPointObserver;
  4153. private _tooltipFade;
  4154. private _tooltipTextBlock;
  4155. private _tooltipTexture;
  4156. private _tooltipMesh;
  4157. private _tooltipHoverObserver;
  4158. private _tooltipOutObserver;
  4159. private _disposeTooltip;
  4160. /**
  4161. * Rendering ground id of all the mesh in the button
  4162. */
  4163. set renderingGroupId(id: number);
  4164. get renderingGroupId(): number;
  4165. /**
  4166. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4167. */
  4168. set tooltipText(text: Nullable<string>);
  4169. get tooltipText(): Nullable<string>;
  4170. /**
  4171. * Gets or sets text for the button
  4172. */
  4173. get text(): string;
  4174. set text(value: string);
  4175. /**
  4176. * Gets or sets the image url for the button
  4177. */
  4178. get imageUrl(): string;
  4179. set imageUrl(value: string);
  4180. /**
  4181. * Gets the back material used by this button
  4182. */
  4183. get backMaterial(): FluentMaterial;
  4184. /**
  4185. * Gets the front material used by this button
  4186. */
  4187. get frontMaterial(): FluentMaterial;
  4188. /**
  4189. * Gets the plate material used by this button
  4190. */
  4191. get plateMaterial(): StandardMaterial;
  4192. /**
  4193. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4194. */
  4195. get shareMaterials(): boolean;
  4196. /**
  4197. * Creates a new button
  4198. * @param name defines the control name
  4199. */
  4200. constructor(name?: string, shareMaterials?: boolean);
  4201. protected _getTypeName(): string;
  4202. private _rebuildContent;
  4203. protected _createNode(scene: Scene): TransformNode;
  4204. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4205. private _createBackMaterial;
  4206. private _createFrontMaterial;
  4207. private _createPlateMaterial;
  4208. protected _affectMaterial(mesh: Mesh): void;
  4209. /**
  4210. * Releases all associated resources
  4211. */
  4212. dispose(): void;
  4213. }
  4214. }
  4215. declare module "babylonjs-gui/3D/controls/meshButton3D" {
  4216. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4217. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4218. import { Mesh } from "babylonjs/Meshes/mesh";
  4219. import { Scene } from "babylonjs/scene";
  4220. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  4221. /**
  4222. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  4223. */
  4224. export class MeshButton3D extends Button3D {
  4225. /** @hidden */
  4226. protected _currentMesh: Mesh;
  4227. /**
  4228. * Creates a new 3D button based on a mesh
  4229. * @param mesh mesh to become a 3D button
  4230. * @param name defines the control name
  4231. */
  4232. constructor(mesh: Mesh, name?: string);
  4233. protected _getTypeName(): string;
  4234. protected _createNode(scene: Scene): TransformNode;
  4235. protected _affectMaterial(mesh: AbstractMesh): void;
  4236. }
  4237. }
  4238. declare module "babylonjs-gui/3D/controls/planePanel" {
  4239. import { Vector3 } from "babylonjs/Maths/math";
  4240. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4241. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4242. /**
  4243. * Class used to create a container panel deployed on the surface of a plane
  4244. */
  4245. export class PlanePanel extends VolumeBasedPanel {
  4246. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4247. }
  4248. }
  4249. declare module "babylonjs-gui/3D/controls/scatterPanel" {
  4250. import { Vector3 } from "babylonjs/Maths/math";
  4251. import { float } from "babylonjs/types";
  4252. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4253. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4254. /**
  4255. * Class used to create a container panel where items get randomized planar mapping
  4256. */
  4257. export class ScatterPanel extends VolumeBasedPanel {
  4258. private _iteration;
  4259. /**
  4260. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  4261. */
  4262. get iteration(): float;
  4263. set iteration(value: float);
  4264. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4265. private _scatterMapping;
  4266. protected _finalProcessing(): void;
  4267. }
  4268. }
  4269. declare module "babylonjs-gui/3D/controls/spherePanel" {
  4270. import { Vector3 } from "babylonjs/Maths/math";
  4271. import { float } from "babylonjs/types";
  4272. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4273. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4274. /**
  4275. * Class used to create a container panel deployed on the surface of a sphere
  4276. */
  4277. export class SpherePanel extends VolumeBasedPanel {
  4278. private _radius;
  4279. /**
  4280. * Gets or sets the radius of the sphere where to project controls (5 by default)
  4281. */
  4282. get radius(): float;
  4283. set radius(value: float);
  4284. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4285. private _sphericalMapping;
  4286. }
  4287. }
  4288. declare module "babylonjs-gui/3D/controls/stackPanel3D" {
  4289. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  4290. /**
  4291. * Class used to create a stack panel in 3D on XY plane
  4292. */
  4293. export class StackPanel3D extends Container3D {
  4294. private _isVertical;
  4295. /**
  4296. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  4297. */
  4298. get isVertical(): boolean;
  4299. set isVertical(value: boolean);
  4300. /**
  4301. * Gets or sets the distance between elements
  4302. */
  4303. margin: number;
  4304. /**
  4305. * Creates new StackPanel
  4306. * @param isVertical
  4307. */
  4308. constructor(isVertical?: boolean);
  4309. protected _arrangeChildren(): void;
  4310. }
  4311. }
  4312. declare module "babylonjs-gui/3D/controls/index" {
  4313. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  4314. export * from "babylonjs-gui/3D/controls/button3D";
  4315. export * from "babylonjs-gui/3D/controls/container3D";
  4316. export * from "babylonjs-gui/3D/controls/control3D";
  4317. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  4318. export * from "babylonjs-gui/3D/controls/holographicButton";
  4319. export * from "babylonjs-gui/3D/controls/meshButton3D";
  4320. export * from "babylonjs-gui/3D/controls/planePanel";
  4321. export * from "babylonjs-gui/3D/controls/scatterPanel";
  4322. export * from "babylonjs-gui/3D/controls/spherePanel";
  4323. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  4324. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4325. }
  4326. declare module "babylonjs-gui/3D/materials/index" {
  4327. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  4328. }
  4329. declare module "babylonjs-gui/3D/index" {
  4330. export * from "babylonjs-gui/3D/controls/index";
  4331. export * from "babylonjs-gui/3D/materials/index";
  4332. export * from "babylonjs-gui/3D/gui3DManager";
  4333. export * from "babylonjs-gui/3D/vector3WithInfo";
  4334. }
  4335. declare module "babylonjs-gui/index" {
  4336. export * from "babylonjs-gui/2D/index";
  4337. export * from "babylonjs-gui/3D/index";
  4338. }
  4339. declare module "babylonjs-gui/legacy/legacy" {
  4340. export * from "babylonjs-gui/index";
  4341. }
  4342. declare module "babylonjs-gui" {
  4343. export * from "babylonjs-gui/legacy/legacy";
  4344. }
  4345. declare module BABYLON.GUI {
  4346. /**
  4347. * Class used to specific a value and its associated unit
  4348. */
  4349. export class ValueAndUnit {
  4350. /** defines the unit to store */
  4351. unit: number;
  4352. /** defines a boolean indicating if the value can be negative */
  4353. negativeValueAllowed: boolean;
  4354. private _value;
  4355. private _originalUnit;
  4356. /**
  4357. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  4358. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4359. */
  4360. ignoreAdaptiveScaling: boolean;
  4361. /**
  4362. * Creates a new ValueAndUnit
  4363. * @param value defines the value to store
  4364. * @param unit defines the unit to store
  4365. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  4366. */
  4367. constructor(value: number,
  4368. /** defines the unit to store */
  4369. unit?: number,
  4370. /** defines a boolean indicating if the value can be negative */
  4371. negativeValueAllowed?: boolean);
  4372. /** Gets a boolean indicating if the value is a percentage */
  4373. get isPercentage(): boolean;
  4374. /** Gets a boolean indicating if the value is store as pixel */
  4375. get isPixel(): boolean;
  4376. /** Gets direct internal value */
  4377. get internalValue(): number;
  4378. /**
  4379. * Gets value as pixel
  4380. * @param host defines the root host
  4381. * @param refValue defines the reference value for percentages
  4382. * @returns the value as pixel
  4383. */
  4384. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  4385. /**
  4386. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  4387. * @param value defines the value to store
  4388. * @param unit defines the unit to store
  4389. * @returns the current ValueAndUnit
  4390. */
  4391. updateInPlace(value: number, unit?: number): ValueAndUnit;
  4392. /**
  4393. * Gets the value accordingly to its unit
  4394. * @param host defines the root host
  4395. * @returns the value
  4396. */
  4397. getValue(host: AdvancedDynamicTexture): number;
  4398. /**
  4399. * Gets a string representation of the value
  4400. * @param host defines the root host
  4401. * @param decimals defines an optional number of decimals to display
  4402. * @returns a string
  4403. */
  4404. toString(host: AdvancedDynamicTexture, decimals?: number): string;
  4405. /**
  4406. * Store a value parsed from a string
  4407. * @param source defines the source string
  4408. * @returns true if the value was successfully parsed
  4409. */
  4410. fromString(source: string | number): boolean;
  4411. private static _Regex;
  4412. private static _UNITMODE_PERCENTAGE;
  4413. private static _UNITMODE_PIXEL;
  4414. /** UNITMODE_PERCENTAGE */
  4415. static get UNITMODE_PERCENTAGE(): number;
  4416. /** UNITMODE_PIXEL */
  4417. static get UNITMODE_PIXEL(): number;
  4418. }
  4419. }
  4420. declare module BABYLON.GUI {
  4421. /**
  4422. * Define a style used by control to automatically setup properties based on a template.
  4423. * Only support font related properties so far
  4424. */
  4425. export class Style implements BABYLON.IDisposable {
  4426. private _fontFamily;
  4427. private _fontStyle;
  4428. private _fontWeight;
  4429. /** @hidden */
  4430. _host: AdvancedDynamicTexture;
  4431. /** @hidden */
  4432. _fontSize: ValueAndUnit;
  4433. /**
  4434. * BABYLON.Observable raised when the style values are changed
  4435. */
  4436. onChangedObservable: BABYLON.Observable<Style>;
  4437. /**
  4438. * Creates a new style object
  4439. * @param host defines the AdvancedDynamicTexture which hosts this style
  4440. */
  4441. constructor(host: AdvancedDynamicTexture);
  4442. /**
  4443. * Gets or sets the font size
  4444. */
  4445. get fontSize(): string | number;
  4446. set fontSize(value: string | number);
  4447. /**
  4448. * Gets or sets the font family
  4449. */
  4450. get fontFamily(): string;
  4451. set fontFamily(value: string);
  4452. /**
  4453. * Gets or sets the font style
  4454. */
  4455. get fontStyle(): string;
  4456. set fontStyle(value: string);
  4457. /** Gets or sets font weight */
  4458. get fontWeight(): string;
  4459. set fontWeight(value: string);
  4460. /** Dispose all associated resources */
  4461. dispose(): void;
  4462. }
  4463. }
  4464. declare module BABYLON.GUI {
  4465. /**
  4466. * Class used to transport BABYLON.Vector2 information for pointer events
  4467. */
  4468. export class Vector2WithInfo extends BABYLON.Vector2 {
  4469. /** defines the current mouse button index */
  4470. buttonIndex: number;
  4471. /**
  4472. * Creates a new Vector2WithInfo
  4473. * @param source defines the vector2 data to transport
  4474. * @param buttonIndex defines the current mouse button index
  4475. */
  4476. constructor(source: BABYLON.Vector2,
  4477. /** defines the current mouse button index */
  4478. buttonIndex?: number);
  4479. }
  4480. /** Class used to provide 2D matrix features */
  4481. export class Matrix2D {
  4482. /** Gets the internal array of 6 floats used to store matrix data */
  4483. m: Float32Array;
  4484. /**
  4485. * Creates a new matrix
  4486. * @param m00 defines value for (0, 0)
  4487. * @param m01 defines value for (0, 1)
  4488. * @param m10 defines value for (1, 0)
  4489. * @param m11 defines value for (1, 1)
  4490. * @param m20 defines value for (2, 0)
  4491. * @param m21 defines value for (2, 1)
  4492. */
  4493. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  4494. /**
  4495. * Fills the matrix from direct values
  4496. * @param m00 defines value for (0, 0)
  4497. * @param m01 defines value for (0, 1)
  4498. * @param m10 defines value for (1, 0)
  4499. * @param m11 defines value for (1, 1)
  4500. * @param m20 defines value for (2, 0)
  4501. * @param m21 defines value for (2, 1)
  4502. * @returns the current modified matrix
  4503. */
  4504. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  4505. /**
  4506. * Gets matrix determinant
  4507. * @returns the determinant
  4508. */
  4509. determinant(): number;
  4510. /**
  4511. * Inverses the matrix and stores it in a target matrix
  4512. * @param result defines the target matrix
  4513. * @returns the current matrix
  4514. */
  4515. invertToRef(result: Matrix2D): Matrix2D;
  4516. /**
  4517. * Multiplies the current matrix with another one
  4518. * @param other defines the second operand
  4519. * @param result defines the target matrix
  4520. * @returns the current matrix
  4521. */
  4522. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  4523. /**
  4524. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  4525. * @param x defines the x coordinate to transform
  4526. * @param y defines the x coordinate to transform
  4527. * @param result defines the target vector2
  4528. * @returns the current matrix
  4529. */
  4530. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  4531. /**
  4532. * Creates an identity matrix
  4533. * @returns a new matrix
  4534. */
  4535. static Identity(): Matrix2D;
  4536. /**
  4537. * Creates a translation matrix and stores it in a target matrix
  4538. * @param x defines the x coordinate of the translation
  4539. * @param y defines the y coordinate of the translation
  4540. * @param result defines the target matrix
  4541. */
  4542. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  4543. /**
  4544. * Creates a scaling matrix and stores it in a target matrix
  4545. * @param x defines the x coordinate of the scaling
  4546. * @param y defines the y coordinate of the scaling
  4547. * @param result defines the target matrix
  4548. */
  4549. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  4550. /**
  4551. * Creates a rotation matrix and stores it in a target matrix
  4552. * @param angle defines the rotation angle
  4553. * @param result defines the target matrix
  4554. */
  4555. static RotationToRef(angle: number, result: Matrix2D): void;
  4556. private static _TempPreTranslationMatrix;
  4557. private static _TempPostTranslationMatrix;
  4558. private static _TempRotationMatrix;
  4559. private static _TempScalingMatrix;
  4560. private static _TempCompose0;
  4561. private static _TempCompose1;
  4562. private static _TempCompose2;
  4563. /**
  4564. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  4565. * @param tx defines the x coordinate of the translation
  4566. * @param ty defines the y coordinate of the translation
  4567. * @param angle defines the rotation angle
  4568. * @param scaleX defines the x coordinate of the scaling
  4569. * @param scaleY defines the y coordinate of the scaling
  4570. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  4571. * @param result defines the target matrix
  4572. */
  4573. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  4574. }
  4575. }
  4576. declare module BABYLON.GUI {
  4577. /**
  4578. * Class used to store 2D control sizes
  4579. */
  4580. export class Measure {
  4581. /** defines left coordinate */
  4582. left: number;
  4583. /** defines top coordinate */
  4584. top: number;
  4585. /** defines width dimension */
  4586. width: number;
  4587. /** defines height dimension */
  4588. height: number;
  4589. /**
  4590. * Creates a new measure
  4591. * @param left defines left coordinate
  4592. * @param top defines top coordinate
  4593. * @param width defines width dimension
  4594. * @param height defines height dimension
  4595. */
  4596. constructor(
  4597. /** defines left coordinate */
  4598. left: number,
  4599. /** defines top coordinate */
  4600. top: number,
  4601. /** defines width dimension */
  4602. width: number,
  4603. /** defines height dimension */
  4604. height: number);
  4605. /**
  4606. * Copy from another measure
  4607. * @param other defines the other measure to copy from
  4608. */
  4609. copyFrom(other: Measure): void;
  4610. /**
  4611. * Copy from a group of 4 floats
  4612. * @param left defines left coordinate
  4613. * @param top defines top coordinate
  4614. * @param width defines width dimension
  4615. * @param height defines height dimension
  4616. */
  4617. copyFromFloats(left: number, top: number, width: number, height: number): void;
  4618. /**
  4619. * Computes the axis aligned bounding box measure for two given measures
  4620. * @param a Input measure
  4621. * @param b Input measure
  4622. * @param result the resulting bounding measure
  4623. */
  4624. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  4625. /**
  4626. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  4627. * @param transform the matrix to transform the measure before computing the AABB
  4628. * @param result the resulting AABB
  4629. */
  4630. transformToRef(transform: Matrix2D, result: Measure): void;
  4631. /**
  4632. * Check equality between this measure and another one
  4633. * @param other defines the other measures
  4634. * @returns true if both measures are equals
  4635. */
  4636. isEqualsTo(other: Measure): boolean;
  4637. /**
  4638. * Creates an empty measure
  4639. * @returns a new measure
  4640. */
  4641. static Empty(): Measure;
  4642. }
  4643. }
  4644. declare module BABYLON.GUI {
  4645. /**
  4646. * Interface used to define a control that can receive focus
  4647. */
  4648. export interface IFocusableControl {
  4649. /**
  4650. * Function called when the control receives the focus
  4651. */
  4652. onFocus(): void;
  4653. /**
  4654. * Function called when the control loses the focus
  4655. */
  4656. onBlur(): void;
  4657. /**
  4658. * Function called to let the control handle keyboard events
  4659. * @param evt defines the current keyboard event
  4660. */
  4661. processKeyboard(evt: KeyboardEvent): void;
  4662. /**
  4663. * Function called to get the list of controls that should not steal the focus from this control
  4664. * @returns an array of controls
  4665. */
  4666. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4667. }
  4668. /**
  4669. * Class used to create texture to support 2D GUI elements
  4670. * @see http://doc.babylonjs.com/how_to/gui
  4671. */
  4672. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  4673. private _isDirty;
  4674. private _renderObserver;
  4675. private _resizeObserver;
  4676. private _preKeyboardObserver;
  4677. private _pointerMoveObserver;
  4678. private _pointerObserver;
  4679. private _canvasPointerOutObserver;
  4680. private _background;
  4681. /** @hidden */
  4682. _rootContainer: Container;
  4683. /** @hidden */
  4684. _lastPickedControl: Control;
  4685. /** @hidden */
  4686. _lastControlOver: {
  4687. [pointerId: number]: Control;
  4688. };
  4689. /** @hidden */
  4690. _lastControlDown: {
  4691. [pointerId: number]: Control;
  4692. };
  4693. /** @hidden */
  4694. _capturingControl: {
  4695. [pointerId: number]: Control;
  4696. };
  4697. /** @hidden */
  4698. _shouldBlockPointer: boolean;
  4699. /** @hidden */
  4700. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  4701. /** @hidden */
  4702. _linkedControls: Control[];
  4703. private _isFullscreen;
  4704. private _fullscreenViewport;
  4705. private _idealWidth;
  4706. private _idealHeight;
  4707. private _useSmallestIdeal;
  4708. private _renderAtIdealSize;
  4709. private _focusedControl;
  4710. private _blockNextFocusCheck;
  4711. private _renderScale;
  4712. private _rootElement;
  4713. private _cursorChanged;
  4714. /** @hidden */
  4715. _numLayoutCalls: number;
  4716. /** Gets the number of layout calls made the last time the ADT has been rendered */
  4717. get numLayoutCalls(): number;
  4718. /** @hidden */
  4719. _numRenderCalls: number;
  4720. /** Gets the number of render calls made the last time the ADT has been rendered */
  4721. get numRenderCalls(): number;
  4722. /**
  4723. * Define type to string to ensure compatibility across browsers
  4724. * Safari doesn't support DataTransfer constructor
  4725. */
  4726. private _clipboardData;
  4727. /**
  4728. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  4729. */
  4730. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  4731. /**
  4732. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  4733. */
  4734. onControlPickedObservable: BABYLON.Observable<Control>;
  4735. /**
  4736. * BABYLON.Observable event triggered before layout is evaluated
  4737. */
  4738. onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4739. /**
  4740. * BABYLON.Observable event triggered after the layout was evaluated
  4741. */
  4742. onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4743. /**
  4744. * BABYLON.Observable event triggered before the texture is rendered
  4745. */
  4746. onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4747. /**
  4748. * BABYLON.Observable event triggered after the texture was rendered
  4749. */
  4750. onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4751. /**
  4752. * Gets or sets a boolean defining if alpha is stored as premultiplied
  4753. */
  4754. premulAlpha: boolean;
  4755. /**
  4756. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  4757. * Useful when you want more antialiasing
  4758. */
  4759. get renderScale(): number;
  4760. set renderScale(value: number);
  4761. /** Gets or sets the background color */
  4762. get background(): string;
  4763. set background(value: string);
  4764. /**
  4765. * Gets or sets the ideal width used to design controls.
  4766. * The GUI will then rescale everything accordingly
  4767. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4768. */
  4769. get idealWidth(): number;
  4770. set idealWidth(value: number);
  4771. /**
  4772. * Gets or sets the ideal height used to design controls.
  4773. * The GUI will then rescale everything accordingly
  4774. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4775. */
  4776. get idealHeight(): number;
  4777. set idealHeight(value: number);
  4778. /**
  4779. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  4780. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4781. */
  4782. get useSmallestIdeal(): boolean;
  4783. set useSmallestIdeal(value: boolean);
  4784. /**
  4785. * Gets or sets a boolean indicating if adaptive scaling must be used
  4786. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4787. */
  4788. get renderAtIdealSize(): boolean;
  4789. set renderAtIdealSize(value: boolean);
  4790. /**
  4791. * Gets the ratio used when in "ideal mode"
  4792. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4793. * */
  4794. get idealRatio(): number;
  4795. /**
  4796. * Gets the underlying layer used to render the texture when in fullscreen mode
  4797. */
  4798. get layer(): BABYLON.Nullable<BABYLON.Layer>;
  4799. /**
  4800. * Gets the root container control
  4801. */
  4802. get rootContainer(): Container;
  4803. /**
  4804. * Returns an array containing the root container.
  4805. * This is mostly used to let the Inspector introspects the ADT
  4806. * @returns an array containing the rootContainer
  4807. */
  4808. getChildren(): Array<Container>;
  4809. /**
  4810. * Will return all controls that are inside this texture
  4811. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  4812. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  4813. * @return all child controls
  4814. */
  4815. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  4816. /**
  4817. * Gets or sets the current focused control
  4818. */
  4819. get focusedControl(): BABYLON.Nullable<IFocusableControl>;
  4820. set focusedControl(control: BABYLON.Nullable<IFocusableControl>);
  4821. /**
  4822. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  4823. */
  4824. get isForeground(): boolean;
  4825. set isForeground(value: boolean);
  4826. /**
  4827. * Gets or set information about clipboardData
  4828. */
  4829. get clipboardData(): string;
  4830. set clipboardData(value: string);
  4831. /**
  4832. * Creates a new AdvancedDynamicTexture
  4833. * @param name defines the name of the texture
  4834. * @param width defines the width of the texture
  4835. * @param height defines the height of the texture
  4836. * @param scene defines the hosting scene
  4837. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  4838. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  4839. */
  4840. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  4841. /**
  4842. * Get the current class name of the texture useful for serialization or dynamic coding.
  4843. * @returns "AdvancedDynamicTexture"
  4844. */
  4845. getClassName(): string;
  4846. /**
  4847. * Function used to execute a function on all controls
  4848. * @param func defines the function to execute
  4849. * @param container defines the container where controls belong. If null the root container will be used
  4850. */
  4851. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  4852. private _useInvalidateRectOptimization;
  4853. /**
  4854. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  4855. */
  4856. get useInvalidateRectOptimization(): boolean;
  4857. set useInvalidateRectOptimization(value: boolean);
  4858. private _invalidatedRectangle;
  4859. /**
  4860. * Invalidates a rectangle area on the gui texture
  4861. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  4862. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  4863. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  4864. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  4865. */
  4866. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  4867. /**
  4868. * Marks the texture as dirty forcing a complete update
  4869. */
  4870. markAsDirty(): void;
  4871. /**
  4872. * Helper function used to create a new style
  4873. * @returns a new style
  4874. * @see http://doc.babylonjs.com/how_to/gui#styles
  4875. */
  4876. createStyle(): Style;
  4877. /**
  4878. * Adds a new control to the root container
  4879. * @param control defines the control to add
  4880. * @returns the current texture
  4881. */
  4882. addControl(control: Control): AdvancedDynamicTexture;
  4883. /**
  4884. * Removes a control from the root container
  4885. * @param control defines the control to remove
  4886. * @returns the current texture
  4887. */
  4888. removeControl(control: Control): AdvancedDynamicTexture;
  4889. /**
  4890. * Release all resources
  4891. */
  4892. dispose(): void;
  4893. private _onResize;
  4894. /** @hidden */
  4895. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  4896. /**
  4897. * Get screen coordinates for a vector3
  4898. * @param position defines the position to project
  4899. * @param worldMatrix defines the world matrix to use
  4900. * @returns the projected position
  4901. */
  4902. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  4903. private _checkUpdate;
  4904. private _clearMeasure;
  4905. private _render;
  4906. /** @hidden */
  4907. _changeCursor(cursor: string): void;
  4908. /** @hidden */
  4909. _registerLastControlDown(control: Control, pointerId: number): void;
  4910. private _doPicking;
  4911. /** @hidden */
  4912. _cleanControlAfterRemovalFromList(list: {
  4913. [pointerId: number]: Control;
  4914. }, control: Control): void;
  4915. /** @hidden */
  4916. _cleanControlAfterRemoval(control: Control): void;
  4917. /** Attach to all scene events required to support pointer events */
  4918. attach(): void;
  4919. /** @hidden */
  4920. private onClipboardCopy;
  4921. /** @hidden */
  4922. private onClipboardCut;
  4923. /** @hidden */
  4924. private onClipboardPaste;
  4925. /**
  4926. * Register the clipboard Events onto the canvas
  4927. */
  4928. registerClipboardEvents(): void;
  4929. /**
  4930. * Unregister the clipboard Events from the canvas
  4931. */
  4932. unRegisterClipboardEvents(): void;
  4933. /**
  4934. * Connect the texture to a hosting mesh to enable interactions
  4935. * @param mesh defines the mesh to attach to
  4936. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  4937. */
  4938. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  4939. /**
  4940. * Move the focus to a specific control
  4941. * @param control defines the control which will receive the focus
  4942. */
  4943. moveFocusToControl(control: IFocusableControl): void;
  4944. private _manageFocus;
  4945. private _attachToOnPointerOut;
  4946. /**
  4947. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  4948. * @param mesh defines the mesh which will receive the texture
  4949. * @param width defines the texture width (1024 by default)
  4950. * @param height defines the texture height (1024 by default)
  4951. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  4952. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  4953. * @returns a new AdvancedDynamicTexture
  4954. */
  4955. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  4956. /**
  4957. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  4958. * In this mode the texture will rely on a layer for its rendering.
  4959. * This allows it to be treated like any other layer.
  4960. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  4961. * LayerMask is set through advancedTexture.layer.layerMask
  4962. * @param name defines name for the texture
  4963. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  4964. * @param scene defines the hsoting scene
  4965. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  4966. * @returns a new AdvancedDynamicTexture
  4967. */
  4968. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  4969. }
  4970. }
  4971. declare module BABYLON.GUI {
  4972. /**
  4973. * Root class used for all 2D controls
  4974. * @see http://doc.babylonjs.com/how_to/gui#controls
  4975. */
  4976. export class Control {
  4977. /** defines the name of the control */
  4978. name?: string | undefined;
  4979. /**
  4980. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  4981. */
  4982. static AllowAlphaInheritance: boolean;
  4983. private _alpha;
  4984. private _alphaSet;
  4985. private _zIndex;
  4986. /** @hidden */
  4987. _host: AdvancedDynamicTexture;
  4988. /** Gets or sets the control parent */
  4989. parent: BABYLON.Nullable<Container>;
  4990. /** @hidden */
  4991. _currentMeasure: Measure;
  4992. private _fontFamily;
  4993. private _fontStyle;
  4994. private _fontWeight;
  4995. private _fontSize;
  4996. private _font;
  4997. /** @hidden */
  4998. _width: ValueAndUnit;
  4999. /** @hidden */
  5000. _height: ValueAndUnit;
  5001. /** @hidden */
  5002. protected _fontOffset: {
  5003. ascent: number;
  5004. height: number;
  5005. descent: number;
  5006. };
  5007. private _color;
  5008. private _style;
  5009. private _styleObserver;
  5010. /** @hidden */
  5011. protected _horizontalAlignment: number;
  5012. /** @hidden */
  5013. protected _verticalAlignment: number;
  5014. /** @hidden */
  5015. protected _isDirty: boolean;
  5016. /** @hidden */
  5017. protected _wasDirty: boolean;
  5018. /** @hidden */
  5019. _tempParentMeasure: Measure;
  5020. /** @hidden */
  5021. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  5022. /** @hidden */
  5023. protected _cachedParentMeasure: Measure;
  5024. private _paddingLeft;
  5025. private _paddingRight;
  5026. private _paddingTop;
  5027. private _paddingBottom;
  5028. /** @hidden */
  5029. _left: ValueAndUnit;
  5030. /** @hidden */
  5031. _top: ValueAndUnit;
  5032. private _scaleX;
  5033. private _scaleY;
  5034. private _rotation;
  5035. private _transformCenterX;
  5036. private _transformCenterY;
  5037. /** @hidden */
  5038. _transformMatrix: Matrix2D;
  5039. /** @hidden */
  5040. protected _invertTransformMatrix: Matrix2D;
  5041. /** @hidden */
  5042. protected _transformedPosition: BABYLON.Vector2;
  5043. private _isMatrixDirty;
  5044. private _cachedOffsetX;
  5045. private _cachedOffsetY;
  5046. private _isVisible;
  5047. private _isHighlighted;
  5048. /** @hidden */
  5049. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  5050. private _fontSet;
  5051. private _dummyVector2;
  5052. private _downCount;
  5053. private _enterCount;
  5054. private _doNotRender;
  5055. private _downPointerIds;
  5056. protected _isEnabled: boolean;
  5057. protected _disabledColor: string;
  5058. /** @hidden */
  5059. protected _rebuildLayout: boolean;
  5060. /** @hidden */
  5061. _customData: any;
  5062. /** @hidden */
  5063. _isClipped: boolean;
  5064. /** @hidden */
  5065. _automaticSize: boolean;
  5066. /** @hidden */
  5067. _tag: any;
  5068. /**
  5069. * Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
  5070. */
  5071. uniqueId: number;
  5072. /**
  5073. * Gets or sets an object used to store user defined information for the node
  5074. */
  5075. metadata: any;
  5076. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  5077. isHitTestVisible: boolean;
  5078. /** Gets or sets a boolean indicating if the control can block pointer events */
  5079. isPointerBlocker: boolean;
  5080. /** Gets or sets a boolean indicating if the control can be focusable */
  5081. isFocusInvisible: boolean;
  5082. /**
  5083. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  5084. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  5085. */
  5086. clipChildren: boolean;
  5087. /**
  5088. * Gets or sets a boolean indicating that control content must be clipped
  5089. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  5090. */
  5091. clipContent: boolean;
  5092. /**
  5093. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  5094. */
  5095. useBitmapCache: boolean;
  5096. private _cacheData;
  5097. private _shadowOffsetX;
  5098. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  5099. get shadowOffsetX(): number;
  5100. set shadowOffsetX(value: number);
  5101. private _shadowOffsetY;
  5102. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  5103. get shadowOffsetY(): number;
  5104. set shadowOffsetY(value: number);
  5105. private _shadowBlur;
  5106. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  5107. get shadowBlur(): number;
  5108. set shadowBlur(value: number);
  5109. private _shadowColor;
  5110. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  5111. get shadowColor(): string;
  5112. set shadowColor(value: string);
  5113. /** Gets or sets the cursor to use when the control is hovered */
  5114. hoverCursor: string;
  5115. /** @hidden */
  5116. protected _linkOffsetX: ValueAndUnit;
  5117. /** @hidden */
  5118. protected _linkOffsetY: ValueAndUnit;
  5119. /** Gets the control type name */
  5120. get typeName(): string;
  5121. /**
  5122. * Get the current class name of the control.
  5123. * @returns current class name
  5124. */
  5125. getClassName(): string;
  5126. /**
  5127. * An event triggered when the pointer move over the control.
  5128. */
  5129. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  5130. /**
  5131. * An event triggered when the pointer move out of the control.
  5132. */
  5133. onPointerOutObservable: BABYLON.Observable<Control>;
  5134. /**
  5135. * An event triggered when the pointer taps the control
  5136. */
  5137. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  5138. /**
  5139. * An event triggered when pointer up
  5140. */
  5141. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  5142. /**
  5143. * An event triggered when a control is clicked on
  5144. */
  5145. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  5146. /**
  5147. * An event triggered when pointer enters the control
  5148. */
  5149. onPointerEnterObservable: BABYLON.Observable<Control>;
  5150. /**
  5151. * An event triggered when the control is marked as dirty
  5152. */
  5153. onDirtyObservable: BABYLON.Observable<Control>;
  5154. /**
  5155. * An event triggered before drawing the control
  5156. */
  5157. onBeforeDrawObservable: BABYLON.Observable<Control>;
  5158. /**
  5159. * An event triggered after the control was drawn
  5160. */
  5161. onAfterDrawObservable: BABYLON.Observable<Control>;
  5162. /**
  5163. * Get the hosting AdvancedDynamicTexture
  5164. */
  5165. get host(): AdvancedDynamicTexture;
  5166. /** Gets or set information about font offsets (used to render and align text) */
  5167. get fontOffset(): {
  5168. ascent: number;
  5169. height: number;
  5170. descent: number;
  5171. };
  5172. set fontOffset(offset: {
  5173. ascent: number;
  5174. height: number;
  5175. descent: number;
  5176. });
  5177. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  5178. get alpha(): number;
  5179. set alpha(value: number);
  5180. /**
  5181. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  5182. */
  5183. get isHighlighted(): boolean;
  5184. set isHighlighted(value: boolean);
  5185. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  5186. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5187. */
  5188. get scaleX(): number;
  5189. set scaleX(value: number);
  5190. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  5191. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5192. */
  5193. get scaleY(): number;
  5194. set scaleY(value: number);
  5195. /** Gets or sets the rotation angle (0 by default)
  5196. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5197. */
  5198. get rotation(): number;
  5199. set rotation(value: number);
  5200. /** Gets or sets the transformation center on Y axis (0 by default)
  5201. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5202. */
  5203. get transformCenterY(): number;
  5204. set transformCenterY(value: number);
  5205. /** Gets or sets the transformation center on X axis (0 by default)
  5206. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5207. */
  5208. get transformCenterX(): number;
  5209. set transformCenterX(value: number);
  5210. /**
  5211. * Gets or sets the horizontal alignment
  5212. * @see http://doc.babylonjs.com/how_to/gui#alignments
  5213. */
  5214. get horizontalAlignment(): number;
  5215. set horizontalAlignment(value: number);
  5216. /**
  5217. * Gets or sets the vertical alignment
  5218. * @see http://doc.babylonjs.com/how_to/gui#alignments
  5219. */
  5220. get verticalAlignment(): number;
  5221. set verticalAlignment(value: number);
  5222. /**
  5223. * Gets or sets control width
  5224. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5225. */
  5226. get width(): string | number;
  5227. set width(value: string | number);
  5228. /**
  5229. * Gets or sets the control width in pixel
  5230. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5231. */
  5232. get widthInPixels(): number;
  5233. set widthInPixels(value: number);
  5234. /**
  5235. * Gets or sets control height
  5236. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5237. */
  5238. get height(): string | number;
  5239. set height(value: string | number);
  5240. /**
  5241. * Gets or sets control height in pixel
  5242. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5243. */
  5244. get heightInPixels(): number;
  5245. set heightInPixels(value: number);
  5246. /** Gets or set font family */
  5247. get fontFamily(): string;
  5248. set fontFamily(value: string);
  5249. /** Gets or sets font style */
  5250. get fontStyle(): string;
  5251. set fontStyle(value: string);
  5252. /** Gets or sets font weight */
  5253. get fontWeight(): string;
  5254. set fontWeight(value: string);
  5255. /**
  5256. * Gets or sets style
  5257. * @see http://doc.babylonjs.com/how_to/gui#styles
  5258. */
  5259. get style(): BABYLON.Nullable<Style>;
  5260. set style(value: BABYLON.Nullable<Style>);
  5261. /** @hidden */
  5262. get _isFontSizeInPercentage(): boolean;
  5263. /** Gets or sets font size in pixels */
  5264. get fontSizeInPixels(): number;
  5265. set fontSizeInPixels(value: number);
  5266. /** Gets or sets font size */
  5267. get fontSize(): string | number;
  5268. set fontSize(value: string | number);
  5269. /** Gets or sets foreground color */
  5270. get color(): string;
  5271. set color(value: string);
  5272. /** Gets or sets z index which is used to reorder controls on the z axis */
  5273. get zIndex(): number;
  5274. set zIndex(value: number);
  5275. /** Gets or sets a boolean indicating if the control can be rendered */
  5276. get notRenderable(): boolean;
  5277. set notRenderable(value: boolean);
  5278. /** Gets or sets a boolean indicating if the control is visible */
  5279. get isVisible(): boolean;
  5280. set isVisible(value: boolean);
  5281. /** Gets a boolean indicating that the control needs to update its rendering */
  5282. get isDirty(): boolean;
  5283. /**
  5284. * Gets the current linked mesh (or null if none)
  5285. */
  5286. get linkedMesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  5287. /**
  5288. * Gets or sets a value indicating the padding to use on the left of the control
  5289. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5290. */
  5291. get paddingLeft(): string | number;
  5292. set paddingLeft(value: string | number);
  5293. /**
  5294. * Gets or sets a value indicating the padding in pixels to use on the left of the control
  5295. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5296. */
  5297. get paddingLeftInPixels(): number;
  5298. set paddingLeftInPixels(value: number);
  5299. /**
  5300. * Gets or sets a value indicating the padding to use on the right of the control
  5301. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5302. */
  5303. get paddingRight(): string | number;
  5304. set paddingRight(value: string | number);
  5305. /**
  5306. * Gets or sets a value indicating the padding in pixels to use on the right of the control
  5307. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5308. */
  5309. get paddingRightInPixels(): number;
  5310. set paddingRightInPixels(value: number);
  5311. /**
  5312. * Gets or sets a value indicating the padding to use on the top of the control
  5313. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5314. */
  5315. get paddingTop(): string | number;
  5316. set paddingTop(value: string | number);
  5317. /**
  5318. * Gets or sets a value indicating the padding in pixels to use on the top of the control
  5319. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5320. */
  5321. get paddingTopInPixels(): number;
  5322. set paddingTopInPixels(value: number);
  5323. /**
  5324. * Gets or sets a value indicating the padding to use on the bottom of the control
  5325. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5326. */
  5327. get paddingBottom(): string | number;
  5328. set paddingBottom(value: string | number);
  5329. /**
  5330. * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
  5331. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5332. */
  5333. get paddingBottomInPixels(): number;
  5334. set paddingBottomInPixels(value: number);
  5335. /**
  5336. * Gets or sets a value indicating the left coordinate of the control
  5337. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5338. */
  5339. get left(): string | number;
  5340. set left(value: string | number);
  5341. /**
  5342. * Gets or sets a value indicating the left coordinate in pixels of the control
  5343. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5344. */
  5345. get leftInPixels(): number;
  5346. set leftInPixels(value: number);
  5347. /**
  5348. * Gets or sets a value indicating the top coordinate of the control
  5349. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5350. */
  5351. get top(): string | number;
  5352. set top(value: string | number);
  5353. /**
  5354. * Gets or sets a value indicating the top coordinate in pixels of the control
  5355. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5356. */
  5357. get topInPixels(): number;
  5358. set topInPixels(value: number);
  5359. /**
  5360. * Gets or sets a value indicating the offset on X axis to the linked mesh
  5361. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5362. */
  5363. get linkOffsetX(): string | number;
  5364. set linkOffsetX(value: string | number);
  5365. /**
  5366. * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
  5367. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5368. */
  5369. get linkOffsetXInPixels(): number;
  5370. set linkOffsetXInPixels(value: number);
  5371. /**
  5372. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  5373. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5374. */
  5375. get linkOffsetY(): string | number;
  5376. set linkOffsetY(value: string | number);
  5377. /**
  5378. * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
  5379. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5380. */
  5381. get linkOffsetYInPixels(): number;
  5382. set linkOffsetYInPixels(value: number);
  5383. /** Gets the center coordinate on X axis */
  5384. get centerX(): number;
  5385. /** Gets the center coordinate on Y axis */
  5386. get centerY(): number;
  5387. /** Gets or sets if control is Enabled*/
  5388. get isEnabled(): boolean;
  5389. set isEnabled(value: boolean);
  5390. /** Gets or sets background color of control if it's disabled*/
  5391. get disabledColor(): string;
  5392. set disabledColor(value: string);
  5393. /**
  5394. * Creates a new control
  5395. * @param name defines the name of the control
  5396. */
  5397. constructor(
  5398. /** defines the name of the control */
  5399. name?: string | undefined);
  5400. /** @hidden */
  5401. protected _getTypeName(): string;
  5402. /**
  5403. * Gets the first ascendant in the hierarchy of the given type
  5404. * @param className defines the required type
  5405. * @returns the ascendant or null if not found
  5406. */
  5407. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  5408. /** @hidden */
  5409. _resetFontCache(): void;
  5410. /**
  5411. * Determines if a container is an ascendant of the current control
  5412. * @param container defines the container to look for
  5413. * @returns true if the container is one of the ascendant of the control
  5414. */
  5415. isAscendant(container: Control): boolean;
  5416. /**
  5417. * Gets coordinates in local control space
  5418. * @param globalCoordinates defines the coordinates to transform
  5419. * @returns the new coordinates in local space
  5420. */
  5421. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  5422. /**
  5423. * Gets coordinates in local control space
  5424. * @param globalCoordinates defines the coordinates to transform
  5425. * @param result defines the target vector2 where to store the result
  5426. * @returns the current control
  5427. */
  5428. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  5429. /**
  5430. * Gets coordinates in parent local control space
  5431. * @param globalCoordinates defines the coordinates to transform
  5432. * @returns the new coordinates in parent local space
  5433. */
  5434. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  5435. /**
  5436. * Move the current control to a vector3 position projected onto the screen.
  5437. * @param position defines the target position
  5438. * @param scene defines the hosting scene
  5439. */
  5440. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  5441. /**
  5442. * Will store all controls that have this control as ascendant in a given array
  5443. * @param results defines the array where to store the descendants
  5444. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  5445. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  5446. */
  5447. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  5448. /**
  5449. * Will return all controls that have this control as ascendant
  5450. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  5451. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  5452. * @return all child controls
  5453. */
  5454. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  5455. /**
  5456. * Link current control with a target mesh
  5457. * @param mesh defines the mesh to link with
  5458. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5459. */
  5460. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  5461. /** @hidden */
  5462. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  5463. /** @hidden */
  5464. _offsetLeft(offset: number): void;
  5465. /** @hidden */
  5466. _offsetTop(offset: number): void;
  5467. /** @hidden */
  5468. _markMatrixAsDirty(): void;
  5469. /** @hidden */
  5470. _flagDescendantsAsMatrixDirty(): void;
  5471. /** @hidden */
  5472. _intersectsRect(rect: Measure): boolean;
  5473. /** @hidden */
  5474. protected invalidateRect(): void;
  5475. /** @hidden */
  5476. _markAsDirty(force?: boolean): void;
  5477. /** @hidden */
  5478. _markAllAsDirty(): void;
  5479. /** @hidden */
  5480. _link(host: AdvancedDynamicTexture): void;
  5481. /** @hidden */
  5482. protected _transform(context?: CanvasRenderingContext2D): void;
  5483. /** @hidden */
  5484. _renderHighlight(context: CanvasRenderingContext2D): void;
  5485. /** @hidden */
  5486. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  5487. /** @hidden */
  5488. protected _applyStates(context: CanvasRenderingContext2D): void;
  5489. /** @hidden */
  5490. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  5491. /** @hidden */
  5492. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5493. protected _evaluateClippingState(parentMeasure: Measure): void;
  5494. /** @hidden */
  5495. _measure(): void;
  5496. /** @hidden */
  5497. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5498. /** @hidden */
  5499. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5500. /** @hidden */
  5501. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5502. /** @hidden */
  5503. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  5504. private static _ClipMeasure;
  5505. private _tmpMeasureA;
  5506. private _clip;
  5507. /** @hidden */
  5508. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): boolean;
  5509. /** @hidden */
  5510. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  5511. /**
  5512. * Tests if a given coordinates belong to the current control
  5513. * @param x defines x coordinate to test
  5514. * @param y defines y coordinate to test
  5515. * @returns true if the coordinates are inside the control
  5516. */
  5517. contains(x: number, y: number): boolean;
  5518. /** @hidden */
  5519. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  5520. /** @hidden */
  5521. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  5522. /** @hidden */
  5523. _onPointerEnter(target: Control): boolean;
  5524. /** @hidden */
  5525. _onPointerOut(target: Control, force?: boolean): void;
  5526. /** @hidden */
  5527. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  5528. /** @hidden */
  5529. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5530. /** @hidden */
  5531. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  5532. /** @hidden */
  5533. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  5534. private _prepareFont;
  5535. /** Releases associated resources */
  5536. dispose(): void;
  5537. private static _HORIZONTAL_ALIGNMENT_LEFT;
  5538. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  5539. private static _HORIZONTAL_ALIGNMENT_CENTER;
  5540. private static _VERTICAL_ALIGNMENT_TOP;
  5541. private static _VERTICAL_ALIGNMENT_BOTTOM;
  5542. private static _VERTICAL_ALIGNMENT_CENTER;
  5543. /** HORIZONTAL_ALIGNMENT_LEFT */
  5544. static get HORIZONTAL_ALIGNMENT_LEFT(): number;
  5545. /** HORIZONTAL_ALIGNMENT_RIGHT */
  5546. static get HORIZONTAL_ALIGNMENT_RIGHT(): number;
  5547. /** HORIZONTAL_ALIGNMENT_CENTER */
  5548. static get HORIZONTAL_ALIGNMENT_CENTER(): number;
  5549. /** VERTICAL_ALIGNMENT_TOP */
  5550. static get VERTICAL_ALIGNMENT_TOP(): number;
  5551. /** VERTICAL_ALIGNMENT_BOTTOM */
  5552. static get VERTICAL_ALIGNMENT_BOTTOM(): number;
  5553. /** VERTICAL_ALIGNMENT_CENTER */
  5554. static get VERTICAL_ALIGNMENT_CENTER(): number;
  5555. private static _FontHeightSizes;
  5556. /** @hidden */
  5557. static _GetFontOffset(font: string): {
  5558. ascent: number;
  5559. height: number;
  5560. descent: number;
  5561. };
  5562. /**
  5563. * Creates a stack panel that can be used to render headers
  5564. * @param control defines the control to associate with the header
  5565. * @param text defines the text of the header
  5566. * @param size defines the size of the header
  5567. * @param options defines options used to configure the header
  5568. * @returns a new StackPanel
  5569. * @ignore
  5570. * @hidden
  5571. */
  5572. static AddHeader: (control: Control, text: string, size: string | number, options: {
  5573. isHorizontal: boolean;
  5574. controlFirst: boolean;
  5575. }) => any;
  5576. /** @hidden */
  5577. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  5578. }
  5579. }
  5580. declare module BABYLON.GUI {
  5581. /**
  5582. * Root class for 2D containers
  5583. * @see http://doc.babylonjs.com/how_to/gui#containers
  5584. */
  5585. export class Container extends Control {
  5586. name?: string | undefined;
  5587. /** @hidden */
  5588. _children: Control[];
  5589. /** @hidden */
  5590. protected _measureForChildren: Measure;
  5591. /** @hidden */
  5592. protected _background: string;
  5593. /** @hidden */
  5594. protected _adaptWidthToChildren: boolean;
  5595. /** @hidden */
  5596. protected _adaptHeightToChildren: boolean;
  5597. /**
  5598. * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
  5599. */
  5600. logLayoutCycleErrors: boolean;
  5601. /**
  5602. * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
  5603. */
  5604. maxLayoutCycle: number;
  5605. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  5606. get adaptHeightToChildren(): boolean;
  5607. set adaptHeightToChildren(value: boolean);
  5608. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  5609. get adaptWidthToChildren(): boolean;
  5610. set adaptWidthToChildren(value: boolean);
  5611. /** Gets or sets background color */
  5612. get background(): string;
  5613. set background(value: string);
  5614. /** Gets the list of children */
  5615. get children(): Control[];
  5616. /**
  5617. * Creates a new Container
  5618. * @param name defines the name of the container
  5619. */
  5620. constructor(name?: string | undefined);
  5621. protected _getTypeName(): string;
  5622. _flagDescendantsAsMatrixDirty(): void;
  5623. /**
  5624. * Gets a child using its name
  5625. * @param name defines the child name to look for
  5626. * @returns the child control if found
  5627. */
  5628. getChildByName(name: string): BABYLON.Nullable<Control>;
  5629. /**
  5630. * Gets a child using its type and its name
  5631. * @param name defines the child name to look for
  5632. * @param type defines the child type to look for
  5633. * @returns the child control if found
  5634. */
  5635. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  5636. /**
  5637. * Search for a specific control in children
  5638. * @param control defines the control to look for
  5639. * @returns true if the control is in child list
  5640. */
  5641. containsControl(control: Control): boolean;
  5642. /**
  5643. * Adds a new control to the current container
  5644. * @param control defines the control to add
  5645. * @returns the current container
  5646. */
  5647. addControl(control: BABYLON.Nullable<Control>): Container;
  5648. /**
  5649. * Removes all controls from the current container
  5650. * @returns the current container
  5651. */
  5652. clearControls(): Container;
  5653. /**
  5654. * Removes a control from the current container
  5655. * @param control defines the control to remove
  5656. * @returns the current container
  5657. */
  5658. removeControl(control: Control): Container;
  5659. /** @hidden */
  5660. _reOrderControl(control: Control): void;
  5661. /** @hidden */
  5662. _offsetLeft(offset: number): void;
  5663. /** @hidden */
  5664. _offsetTop(offset: number): void;
  5665. /** @hidden */
  5666. _markAllAsDirty(): void;
  5667. /** @hidden */
  5668. protected _localDraw(context: CanvasRenderingContext2D): void;
  5669. /** @hidden */
  5670. _link(host: AdvancedDynamicTexture): void;
  5671. /** @hidden */
  5672. protected _beforeLayout(): void;
  5673. /** @hidden */
  5674. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5675. /** @hidden */
  5676. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  5677. protected _postMeasure(): void;
  5678. /** @hidden */
  5679. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  5680. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  5681. /** @hidden */
  5682. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  5683. /** @hidden */
  5684. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5685. /** Releases associated resources */
  5686. dispose(): void;
  5687. }
  5688. }
  5689. declare module BABYLON.GUI {
  5690. /** Class used to create rectangle container */
  5691. export class Rectangle extends Container {
  5692. name?: string | undefined;
  5693. private _thickness;
  5694. private _cornerRadius;
  5695. /** Gets or sets border thickness */
  5696. get thickness(): number;
  5697. set thickness(value: number);
  5698. /** Gets or sets the corner radius angle */
  5699. get cornerRadius(): number;
  5700. set cornerRadius(value: number);
  5701. /**
  5702. * Creates a new Rectangle
  5703. * @param name defines the control name
  5704. */
  5705. constructor(name?: string | undefined);
  5706. protected _getTypeName(): string;
  5707. protected _localDraw(context: CanvasRenderingContext2D): void;
  5708. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5709. private _drawRoundedRect;
  5710. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  5711. }
  5712. }
  5713. declare module BABYLON.GUI {
  5714. /**
  5715. * Enum that determines the text-wrapping mode to use.
  5716. */
  5717. export enum TextWrapping {
  5718. /**
  5719. * Clip the text when it's larger than Control.width; this is the default mode.
  5720. */
  5721. Clip = 0,
  5722. /**
  5723. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  5724. */
  5725. WordWrap = 1,
  5726. /**
  5727. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  5728. */
  5729. Ellipsis = 2
  5730. }
  5731. /**
  5732. * Class used to create text block control
  5733. */
  5734. export class TextBlock extends Control {
  5735. /**
  5736. * Defines the name of the control
  5737. */
  5738. name?: string | undefined;
  5739. private _text;
  5740. private _textWrapping;
  5741. private _textHorizontalAlignment;
  5742. private _textVerticalAlignment;
  5743. private _lines;
  5744. private _resizeToFit;
  5745. private _lineSpacing;
  5746. private _outlineWidth;
  5747. private _outlineColor;
  5748. /**
  5749. * An event triggered after the text is changed
  5750. */
  5751. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  5752. /**
  5753. * An event triggered after the text was broken up into lines
  5754. */
  5755. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  5756. /**
  5757. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  5758. */
  5759. get lines(): any[];
  5760. /**
  5761. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  5762. */
  5763. get resizeToFit(): boolean;
  5764. /**
  5765. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  5766. */
  5767. set resizeToFit(value: boolean);
  5768. /**
  5769. * Gets or sets a boolean indicating if text must be wrapped
  5770. */
  5771. get textWrapping(): TextWrapping | boolean;
  5772. /**
  5773. * Gets or sets a boolean indicating if text must be wrapped
  5774. */
  5775. set textWrapping(value: TextWrapping | boolean);
  5776. /**
  5777. * Gets or sets text to display
  5778. */
  5779. get text(): string;
  5780. /**
  5781. * Gets or sets text to display
  5782. */
  5783. set text(value: string);
  5784. /**
  5785. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  5786. */
  5787. get textHorizontalAlignment(): number;
  5788. /**
  5789. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  5790. */
  5791. set textHorizontalAlignment(value: number);
  5792. /**
  5793. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  5794. */
  5795. get textVerticalAlignment(): number;
  5796. /**
  5797. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  5798. */
  5799. set textVerticalAlignment(value: number);
  5800. /**
  5801. * Gets or sets line spacing value
  5802. */
  5803. set lineSpacing(value: string | number);
  5804. /**
  5805. * Gets or sets line spacing value
  5806. */
  5807. get lineSpacing(): string | number;
  5808. /**
  5809. * Gets or sets outlineWidth of the text to display
  5810. */
  5811. get outlineWidth(): number;
  5812. /**
  5813. * Gets or sets outlineWidth of the text to display
  5814. */
  5815. set outlineWidth(value: number);
  5816. /**
  5817. * Gets or sets outlineColor of the text to display
  5818. */
  5819. get outlineColor(): string;
  5820. /**
  5821. * Gets or sets outlineColor of the text to display
  5822. */
  5823. set outlineColor(value: string);
  5824. /**
  5825. * Creates a new TextBlock object
  5826. * @param name defines the name of the control
  5827. * @param text defines the text to display (emptry string by default)
  5828. */
  5829. constructor(
  5830. /**
  5831. * Defines the name of the control
  5832. */
  5833. name?: string | undefined, text?: string);
  5834. protected _getTypeName(): string;
  5835. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5836. private _drawText;
  5837. /** @hidden */
  5838. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  5839. protected _applyStates(context: CanvasRenderingContext2D): void;
  5840. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  5841. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  5842. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  5843. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  5844. protected _renderLines(context: CanvasRenderingContext2D): void;
  5845. /**
  5846. * Given a width constraint applied on the text block, find the expected height
  5847. * @returns expected height
  5848. */
  5849. computeExpectedHeight(): number;
  5850. dispose(): void;
  5851. }
  5852. }
  5853. declare module BABYLON.GUI {
  5854. /**
  5855. * Class used to create 2D images
  5856. */
  5857. export class Image extends Control {
  5858. name?: string | undefined;
  5859. private _workingCanvas;
  5860. private _domImage;
  5861. private _imageWidth;
  5862. private _imageHeight;
  5863. private _loaded;
  5864. private _stretch;
  5865. private _source;
  5866. private _autoScale;
  5867. private _sourceLeft;
  5868. private _sourceTop;
  5869. private _sourceWidth;
  5870. private _sourceHeight;
  5871. private _cellWidth;
  5872. private _cellHeight;
  5873. private _cellId;
  5874. private _populateNinePatchSlicesFromImage;
  5875. private _sliceLeft;
  5876. private _sliceRight;
  5877. private _sliceTop;
  5878. private _sliceBottom;
  5879. private _detectPointerOnOpaqueOnly;
  5880. /**
  5881. * BABYLON.Observable notified when the content is loaded
  5882. */
  5883. onImageLoadedObservable: BABYLON.Observable<Image>;
  5884. /**
  5885. * BABYLON.Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed
  5886. */
  5887. onSVGAttributesComputedObservable: BABYLON.Observable<Image>;
  5888. /**
  5889. * Gets a boolean indicating that the content is loaded
  5890. */
  5891. get isLoaded(): boolean;
  5892. /**
  5893. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  5894. */
  5895. get populateNinePatchSlicesFromImage(): boolean;
  5896. set populateNinePatchSlicesFromImage(value: boolean);
  5897. /**
  5898. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  5899. * Beware using this as this will comsume more memory as the image has to be stored twice
  5900. */
  5901. get detectPointerOnOpaqueOnly(): boolean;
  5902. set detectPointerOnOpaqueOnly(value: boolean);
  5903. /**
  5904. * Gets or sets the left value for slicing (9-patch)
  5905. */
  5906. get sliceLeft(): number;
  5907. set sliceLeft(value: number);
  5908. /**
  5909. * Gets or sets the right value for slicing (9-patch)
  5910. */
  5911. get sliceRight(): number;
  5912. set sliceRight(value: number);
  5913. /**
  5914. * Gets or sets the top value for slicing (9-patch)
  5915. */
  5916. get sliceTop(): number;
  5917. set sliceTop(value: number);
  5918. /**
  5919. * Gets or sets the bottom value for slicing (9-patch)
  5920. */
  5921. get sliceBottom(): number;
  5922. set sliceBottom(value: number);
  5923. /**
  5924. * Gets or sets the left coordinate in the source image
  5925. */
  5926. get sourceLeft(): number;
  5927. set sourceLeft(value: number);
  5928. /**
  5929. * Gets or sets the top coordinate in the source image
  5930. */
  5931. get sourceTop(): number;
  5932. set sourceTop(value: number);
  5933. /**
  5934. * Gets or sets the width to capture in the source image
  5935. */
  5936. get sourceWidth(): number;
  5937. set sourceWidth(value: number);
  5938. /**
  5939. * Gets or sets the height to capture in the source image
  5940. */
  5941. get sourceHeight(): number;
  5942. set sourceHeight(value: number);
  5943. /**
  5944. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  5945. * @see http://doc.babylonjs.com/how_to/gui#image
  5946. */
  5947. get autoScale(): boolean;
  5948. set autoScale(value: boolean);
  5949. /** Gets or sets the streching mode used by the image */
  5950. get stretch(): number;
  5951. set stretch(value: number);
  5952. /** @hidden */
  5953. _rotate90(n: number): Image;
  5954. /**
  5955. * Gets or sets the internal DOM image used to render the control
  5956. */
  5957. set domImage(value: HTMLImageElement);
  5958. get domImage(): HTMLImageElement;
  5959. private _onImageLoaded;
  5960. private _extractNinePatchSliceDataFromImage;
  5961. /**
  5962. * Gets or sets image source url
  5963. */
  5964. set source(value: BABYLON.Nullable<string>);
  5965. /**
  5966. * Checks for svg document with icon id present
  5967. */
  5968. private _svgCheck;
  5969. /**
  5970. * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically
  5971. * given external svg file and icon id
  5972. */
  5973. private _getSVGAttribs;
  5974. /**
  5975. * Gets or sets the cell width to use when animation sheet is enabled
  5976. * @see http://doc.babylonjs.com/how_to/gui#image
  5977. */
  5978. get cellWidth(): number;
  5979. set cellWidth(value: number);
  5980. /**
  5981. * Gets or sets the cell height to use when animation sheet is enabled
  5982. * @see http://doc.babylonjs.com/how_to/gui#image
  5983. */
  5984. get cellHeight(): number;
  5985. set cellHeight(value: number);
  5986. /**
  5987. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  5988. * @see http://doc.babylonjs.com/how_to/gui#image
  5989. */
  5990. get cellId(): number;
  5991. set cellId(value: number);
  5992. /**
  5993. * Creates a new Image
  5994. * @param name defines the control name
  5995. * @param url defines the image url
  5996. */
  5997. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  5998. /**
  5999. * Tests if a given coordinates belong to the current control
  6000. * @param x defines x coordinate to test
  6001. * @param y defines y coordinate to test
  6002. * @returns true if the coordinates are inside the control
  6003. */
  6004. contains(x: number, y: number): boolean;
  6005. protected _getTypeName(): string;
  6006. /** Force the control to synchronize with its content */
  6007. synchronizeSizeWithContent(): void;
  6008. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6009. private _prepareWorkingCanvasForOpaqueDetection;
  6010. private _drawImage;
  6011. _draw(context: CanvasRenderingContext2D): void;
  6012. private _renderCornerPatch;
  6013. private _renderNinePatch;
  6014. dispose(): void;
  6015. /** STRETCH_NONE */
  6016. static readonly STRETCH_NONE: number;
  6017. /** STRETCH_FILL */
  6018. static readonly STRETCH_FILL: number;
  6019. /** STRETCH_UNIFORM */
  6020. static readonly STRETCH_UNIFORM: number;
  6021. /** STRETCH_EXTEND */
  6022. static readonly STRETCH_EXTEND: number;
  6023. /** NINE_PATCH */
  6024. static readonly STRETCH_NINE_PATCH: number;
  6025. }
  6026. }
  6027. declare module BABYLON.GUI {
  6028. /**
  6029. * Class used to create 2D buttons
  6030. */
  6031. export class Button extends Rectangle {
  6032. name?: string | undefined;
  6033. /**
  6034. * Function called to generate a pointer enter animation
  6035. */
  6036. pointerEnterAnimation: () => void;
  6037. /**
  6038. * Function called to generate a pointer out animation
  6039. */
  6040. pointerOutAnimation: () => void;
  6041. /**
  6042. * Function called to generate a pointer down animation
  6043. */
  6044. pointerDownAnimation: () => void;
  6045. /**
  6046. * Function called to generate a pointer up animation
  6047. */
  6048. pointerUpAnimation: () => void;
  6049. /**
  6050. * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
  6051. */
  6052. delegatePickingToChildren: boolean;
  6053. private _image;
  6054. /**
  6055. * Returns the image part of the button (if any)
  6056. */
  6057. get image(): BABYLON.Nullable<Image>;
  6058. private _textBlock;
  6059. /**
  6060. * Returns the image part of the button (if any)
  6061. */
  6062. get textBlock(): BABYLON.Nullable<TextBlock>;
  6063. /**
  6064. * Creates a new Button
  6065. * @param name defines the name of the button
  6066. */
  6067. constructor(name?: string | undefined);
  6068. protected _getTypeName(): string;
  6069. /** @hidden */
  6070. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  6071. /** @hidden */
  6072. _onPointerEnter(target: Control): boolean;
  6073. /** @hidden */
  6074. _onPointerOut(target: Control, force?: boolean): void;
  6075. /** @hidden */
  6076. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6077. /** @hidden */
  6078. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6079. /**
  6080. * Creates a new button made with an image and a text
  6081. * @param name defines the name of the button
  6082. * @param text defines the text of the button
  6083. * @param imageUrl defines the url of the image
  6084. * @returns a new Button
  6085. */
  6086. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  6087. /**
  6088. * Creates a new button made with an image
  6089. * @param name defines the name of the button
  6090. * @param imageUrl defines the url of the image
  6091. * @returns a new Button
  6092. */
  6093. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  6094. /**
  6095. * Creates a new button made with a text
  6096. * @param name defines the name of the button
  6097. * @param text defines the text of the button
  6098. * @returns a new Button
  6099. */
  6100. static CreateSimpleButton(name: string, text: string): Button;
  6101. /**
  6102. * Creates a new button made with an image and a centered text
  6103. * @param name defines the name of the button
  6104. * @param text defines the text of the button
  6105. * @param imageUrl defines the url of the image
  6106. * @returns a new Button
  6107. */
  6108. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  6109. }
  6110. }
  6111. declare module BABYLON.GUI {
  6112. /**
  6113. * Class used to create a 2D stack panel container
  6114. */
  6115. export class StackPanel extends Container {
  6116. name?: string | undefined;
  6117. private _isVertical;
  6118. private _manualWidth;
  6119. private _manualHeight;
  6120. private _doNotTrackManualChanges;
  6121. /**
  6122. * Gets or sets a boolean indicating that layou warnings should be ignored
  6123. */
  6124. ignoreLayoutWarnings: boolean;
  6125. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  6126. get isVertical(): boolean;
  6127. set isVertical(value: boolean);
  6128. /**
  6129. * Gets or sets panel width.
  6130. * This value should not be set when in horizontal mode as it will be computed automatically
  6131. */
  6132. set width(value: string | number);
  6133. get width(): string | number;
  6134. /**
  6135. * Gets or sets panel height.
  6136. * This value should not be set when in vertical mode as it will be computed automatically
  6137. */
  6138. set height(value: string | number);
  6139. get height(): string | number;
  6140. /**
  6141. * Creates a new StackPanel
  6142. * @param name defines control name
  6143. */
  6144. constructor(name?: string | undefined);
  6145. protected _getTypeName(): string;
  6146. /** @hidden */
  6147. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6148. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6149. protected _postMeasure(): void;
  6150. }
  6151. }
  6152. declare module BABYLON.GUI {
  6153. /**
  6154. * Class used to represent a 2D checkbox
  6155. */
  6156. export class Checkbox extends Control {
  6157. name?: string | undefined;
  6158. private _isChecked;
  6159. private _background;
  6160. private _checkSizeRatio;
  6161. private _thickness;
  6162. /** Gets or sets border thickness */
  6163. get thickness(): number;
  6164. set thickness(value: number);
  6165. /**
  6166. * BABYLON.Observable raised when isChecked property changes
  6167. */
  6168. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  6169. /** Gets or sets a value indicating the ratio between overall size and check size */
  6170. get checkSizeRatio(): number;
  6171. set checkSizeRatio(value: number);
  6172. /** Gets or sets background color */
  6173. get background(): string;
  6174. set background(value: string);
  6175. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  6176. get isChecked(): boolean;
  6177. set isChecked(value: boolean);
  6178. /**
  6179. * Creates a new CheckBox
  6180. * @param name defines the control name
  6181. */
  6182. constructor(name?: string | undefined);
  6183. protected _getTypeName(): string;
  6184. /** @hidden */
  6185. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6186. /** @hidden */
  6187. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6188. /**
  6189. * Utility function to easily create a checkbox with a header
  6190. * @param title defines the label to use for the header
  6191. * @param onValueChanged defines the callback to call when value changes
  6192. * @returns a StackPanel containing the checkbox and a textBlock
  6193. */
  6194. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  6195. }
  6196. }
  6197. declare module BABYLON.GUI {
  6198. /**
  6199. * Class used to store key control properties
  6200. */
  6201. export class KeyPropertySet {
  6202. /** Width */
  6203. width?: string;
  6204. /** Height */
  6205. height?: string;
  6206. /** Left padding */
  6207. paddingLeft?: string;
  6208. /** Right padding */
  6209. paddingRight?: string;
  6210. /** Top padding */
  6211. paddingTop?: string;
  6212. /** Bottom padding */
  6213. paddingBottom?: string;
  6214. /** Foreground color */
  6215. color?: string;
  6216. /** Background color */
  6217. background?: string;
  6218. }
  6219. /**
  6220. * Class used to create virtual keyboard
  6221. */
  6222. export class VirtualKeyboard extends StackPanel {
  6223. /** BABYLON.Observable raised when a key is pressed */
  6224. onKeyPressObservable: BABYLON.Observable<string>;
  6225. /** Gets or sets default key button width */
  6226. defaultButtonWidth: string;
  6227. /** Gets or sets default key button height */
  6228. defaultButtonHeight: string;
  6229. /** Gets or sets default key button left padding */
  6230. defaultButtonPaddingLeft: string;
  6231. /** Gets or sets default key button right padding */
  6232. defaultButtonPaddingRight: string;
  6233. /** Gets or sets default key button top padding */
  6234. defaultButtonPaddingTop: string;
  6235. /** Gets or sets default key button bottom padding */
  6236. defaultButtonPaddingBottom: string;
  6237. /** Gets or sets default key button foreground color */
  6238. defaultButtonColor: string;
  6239. /** Gets or sets default key button background color */
  6240. defaultButtonBackground: string;
  6241. /** Gets or sets shift button foreground color */
  6242. shiftButtonColor: string;
  6243. /** Gets or sets shift button thickness*/
  6244. selectedShiftThickness: number;
  6245. /** Gets shift key state */
  6246. shiftState: number;
  6247. protected _getTypeName(): string;
  6248. private _createKey;
  6249. /**
  6250. * Adds a new row of keys
  6251. * @param keys defines the list of keys to add
  6252. * @param propertySets defines the associated property sets
  6253. */
  6254. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  6255. /**
  6256. * Set the shift key to a specific state
  6257. * @param shiftState defines the new shift state
  6258. */
  6259. applyShiftState(shiftState: number): void;
  6260. private _currentlyConnectedInputText;
  6261. private _connectedInputTexts;
  6262. private _onKeyPressObserver;
  6263. /** Gets the input text control currently attached to the keyboard */
  6264. get connectedInputText(): BABYLON.Nullable<InputText>;
  6265. /**
  6266. * Connects the keyboard with an input text control
  6267. *
  6268. * @param input defines the target control
  6269. */
  6270. connect(input: InputText): void;
  6271. /**
  6272. * Disconnects the keyboard from connected InputText controls
  6273. *
  6274. * @param input optionally defines a target control, otherwise all are disconnected
  6275. */
  6276. disconnect(input?: InputText): void;
  6277. private _removeConnectedInputObservables;
  6278. /**
  6279. * Release all resources
  6280. */
  6281. dispose(): void;
  6282. /**
  6283. * Creates a new keyboard using a default layout
  6284. *
  6285. * @param name defines control name
  6286. * @returns a new VirtualKeyboard
  6287. */
  6288. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  6289. }
  6290. }
  6291. declare module BABYLON.GUI {
  6292. /**
  6293. * Class used to create input text control
  6294. */
  6295. export class InputText extends Control implements IFocusableControl {
  6296. name?: string | undefined;
  6297. private _text;
  6298. private _placeholderText;
  6299. private _background;
  6300. private _focusedBackground;
  6301. private _focusedColor;
  6302. private _placeholderColor;
  6303. private _thickness;
  6304. private _margin;
  6305. private _autoStretchWidth;
  6306. private _maxWidth;
  6307. private _isFocused;
  6308. private _blinkTimeout;
  6309. private _blinkIsEven;
  6310. private _cursorOffset;
  6311. private _scrollLeft;
  6312. private _textWidth;
  6313. private _clickedCoordinate;
  6314. private _deadKey;
  6315. private _addKey;
  6316. private _currentKey;
  6317. private _isTextHighlightOn;
  6318. private _textHighlightColor;
  6319. private _highligherOpacity;
  6320. private _highlightedText;
  6321. private _startHighlightIndex;
  6322. private _endHighlightIndex;
  6323. private _cursorIndex;
  6324. private _onFocusSelectAll;
  6325. private _isPointerDown;
  6326. private _onClipboardObserver;
  6327. private _onPointerDblTapObserver;
  6328. /** @hidden */
  6329. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  6330. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  6331. promptMessage: string;
  6332. /** Force disable prompt on mobile device */
  6333. disableMobilePrompt: boolean;
  6334. /** BABYLON.Observable raised when the text changes */
  6335. onTextChangedObservable: BABYLON.Observable<InputText>;
  6336. /** BABYLON.Observable raised just before an entered character is to be added */
  6337. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  6338. /** BABYLON.Observable raised when the control gets the focus */
  6339. onFocusObservable: BABYLON.Observable<InputText>;
  6340. /** BABYLON.Observable raised when the control loses the focus */
  6341. onBlurObservable: BABYLON.Observable<InputText>;
  6342. /**Observable raised when the text is highlighted */
  6343. onTextHighlightObservable: BABYLON.Observable<InputText>;
  6344. /**Observable raised when copy event is triggered */
  6345. onTextCopyObservable: BABYLON.Observable<InputText>;
  6346. /** BABYLON.Observable raised when cut event is triggered */
  6347. onTextCutObservable: BABYLON.Observable<InputText>;
  6348. /** BABYLON.Observable raised when paste event is triggered */
  6349. onTextPasteObservable: BABYLON.Observable<InputText>;
  6350. /** BABYLON.Observable raised when a key event was processed */
  6351. onKeyboardEventProcessedObservable: BABYLON.Observable<KeyboardEvent>;
  6352. /** Gets or sets the maximum width allowed by the control */
  6353. get maxWidth(): string | number;
  6354. /** Gets the maximum width allowed by the control in pixels */
  6355. get maxWidthInPixels(): number;
  6356. set maxWidth(value: string | number);
  6357. /** Gets or sets the text highlighter transparency; default: 0.4 */
  6358. get highligherOpacity(): number;
  6359. set highligherOpacity(value: number);
  6360. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  6361. get onFocusSelectAll(): boolean;
  6362. set onFocusSelectAll(value: boolean);
  6363. /** Gets or sets the text hightlight color */
  6364. get textHighlightColor(): string;
  6365. set textHighlightColor(value: string);
  6366. /** Gets or sets control margin */
  6367. get margin(): string;
  6368. /** Gets control margin in pixels */
  6369. get marginInPixels(): number;
  6370. set margin(value: string);
  6371. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  6372. get autoStretchWidth(): boolean;
  6373. set autoStretchWidth(value: boolean);
  6374. /** Gets or sets border thickness */
  6375. get thickness(): number;
  6376. set thickness(value: number);
  6377. /** Gets or sets the background color when focused */
  6378. get focusedBackground(): string;
  6379. set focusedBackground(value: string);
  6380. /** Gets or sets the background color when focused */
  6381. get focusedColor(): string;
  6382. set focusedColor(value: string);
  6383. /** Gets or sets the background color */
  6384. get background(): string;
  6385. set background(value: string);
  6386. /** Gets or sets the placeholder color */
  6387. get placeholderColor(): string;
  6388. set placeholderColor(value: string);
  6389. /** Gets or sets the text displayed when the control is empty */
  6390. get placeholderText(): string;
  6391. set placeholderText(value: string);
  6392. /** Gets or sets the dead key flag */
  6393. get deadKey(): boolean;
  6394. set deadKey(flag: boolean);
  6395. /** Gets or sets the highlight text */
  6396. get highlightedText(): string;
  6397. set highlightedText(text: string);
  6398. /** Gets or sets if the current key should be added */
  6399. get addKey(): boolean;
  6400. set addKey(flag: boolean);
  6401. /** Gets or sets the value of the current key being entered */
  6402. get currentKey(): string;
  6403. set currentKey(key: string);
  6404. /** Gets or sets the text displayed in the control */
  6405. get text(): string;
  6406. set text(value: string);
  6407. /** Gets or sets control width */
  6408. get width(): string | number;
  6409. set width(value: string | number);
  6410. /**
  6411. * Creates a new InputText
  6412. * @param name defines the control name
  6413. * @param text defines the text of the control
  6414. */
  6415. constructor(name?: string | undefined, text?: string);
  6416. /** @hidden */
  6417. onBlur(): void;
  6418. /** @hidden */
  6419. onFocus(): void;
  6420. protected _getTypeName(): string;
  6421. /**
  6422. * Function called to get the list of controls that should not steal the focus from this control
  6423. * @returns an array of controls
  6424. */
  6425. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  6426. /** @hidden */
  6427. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  6428. /** @hidden */
  6429. private _updateValueFromCursorIndex;
  6430. /** @hidden */
  6431. private _processDblClick;
  6432. /** @hidden */
  6433. private _selectAllText;
  6434. /**
  6435. * Handles the keyboard event
  6436. * @param evt Defines the KeyboardEvent
  6437. */
  6438. processKeyboard(evt: KeyboardEvent): void;
  6439. /** @hidden */
  6440. private _onCopyText;
  6441. /** @hidden */
  6442. private _onCutText;
  6443. /** @hidden */
  6444. private _onPasteText;
  6445. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6446. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6447. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  6448. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6449. protected _beforeRenderText(text: string): string;
  6450. dispose(): void;
  6451. }
  6452. }
  6453. declare module BABYLON.GUI {
  6454. /**
  6455. * Class used to create a 2D grid container
  6456. */
  6457. export class Grid extends Container {
  6458. name?: string | undefined;
  6459. private _rowDefinitions;
  6460. private _columnDefinitions;
  6461. private _cells;
  6462. private _childControls;
  6463. /**
  6464. * Gets the number of columns
  6465. */
  6466. get columnCount(): number;
  6467. /**
  6468. * Gets the number of rows
  6469. */
  6470. get rowCount(): number;
  6471. /** Gets the list of children */
  6472. get children(): Control[];
  6473. /** Gets the list of cells (e.g. the containers) */
  6474. get cells(): {
  6475. [key: string]: Container;
  6476. };
  6477. /**
  6478. * Gets the definition of a specific row
  6479. * @param index defines the index of the row
  6480. * @returns the row definition
  6481. */
  6482. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  6483. /**
  6484. * Gets the definition of a specific column
  6485. * @param index defines the index of the column
  6486. * @returns the column definition
  6487. */
  6488. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  6489. /**
  6490. * Adds a new row to the grid
  6491. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  6492. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  6493. * @returns the current grid
  6494. */
  6495. addRowDefinition(height: number, isPixel?: boolean): Grid;
  6496. /**
  6497. * Adds a new column to the grid
  6498. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  6499. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  6500. * @returns the current grid
  6501. */
  6502. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  6503. /**
  6504. * Update a row definition
  6505. * @param index defines the index of the row to update
  6506. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  6507. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  6508. * @returns the current grid
  6509. */
  6510. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  6511. /**
  6512. * Update a column definition
  6513. * @param index defines the index of the column to update
  6514. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  6515. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  6516. * @returns the current grid
  6517. */
  6518. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  6519. /**
  6520. * Gets the list of children stored in a specific cell
  6521. * @param row defines the row to check
  6522. * @param column defines the column to check
  6523. * @returns the list of controls
  6524. */
  6525. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  6526. /**
  6527. * Gets a string representing the child cell info (row x column)
  6528. * @param child defines the control to get info from
  6529. * @returns a string containing the child cell info (row x column)
  6530. */
  6531. getChildCellInfo(child: Control): string;
  6532. private _removeCell;
  6533. private _offsetCell;
  6534. /**
  6535. * Remove a column definition at specified index
  6536. * @param index defines the index of the column to remove
  6537. * @returns the current grid
  6538. */
  6539. removeColumnDefinition(index: number): Grid;
  6540. /**
  6541. * Remove a row definition at specified index
  6542. * @param index defines the index of the row to remove
  6543. * @returns the current grid
  6544. */
  6545. removeRowDefinition(index: number): Grid;
  6546. /**
  6547. * Adds a new control to the current grid
  6548. * @param control defines the control to add
  6549. * @param row defines the row where to add the control (0 by default)
  6550. * @param column defines the column where to add the control (0 by default)
  6551. * @returns the current grid
  6552. */
  6553. addControl(control: Control, row?: number, column?: number): Grid;
  6554. /**
  6555. * Removes a control from the current container
  6556. * @param control defines the control to remove
  6557. * @returns the current container
  6558. */
  6559. removeControl(control: Control): Container;
  6560. /**
  6561. * Creates a new Grid
  6562. * @param name defines control name
  6563. */
  6564. constructor(name?: string | undefined);
  6565. protected _getTypeName(): string;
  6566. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  6567. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6568. _flagDescendantsAsMatrixDirty(): void;
  6569. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  6570. /** Releases associated resources */
  6571. dispose(): void;
  6572. }
  6573. }
  6574. declare module BABYLON.GUI {
  6575. /** Class used to create color pickers */
  6576. export class ColorPicker extends Control {
  6577. name?: string | undefined;
  6578. private static _Epsilon;
  6579. private _colorWheelCanvas;
  6580. private _value;
  6581. private _tmpColor;
  6582. private _pointerStartedOnSquare;
  6583. private _pointerStartedOnWheel;
  6584. private _squareLeft;
  6585. private _squareTop;
  6586. private _squareSize;
  6587. private _h;
  6588. private _s;
  6589. private _v;
  6590. private _lastPointerDownID;
  6591. /**
  6592. * BABYLON.Observable raised when the value changes
  6593. */
  6594. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  6595. /** Gets or sets the color of the color picker */
  6596. get value(): BABYLON.Color3;
  6597. set value(value: BABYLON.Color3);
  6598. /**
  6599. * Gets or sets control width
  6600. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  6601. */
  6602. get width(): string | number;
  6603. set width(value: string | number);
  6604. /**
  6605. * Gets or sets control height
  6606. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  6607. */
  6608. get height(): string | number;
  6609. /** Gets or sets control height */
  6610. set height(value: string | number);
  6611. /** Gets or sets control size */
  6612. get size(): string | number;
  6613. set size(value: string | number);
  6614. /**
  6615. * Creates a new ColorPicker
  6616. * @param name defines the control name
  6617. */
  6618. constructor(name?: string | undefined);
  6619. protected _getTypeName(): string;
  6620. /** @hidden */
  6621. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6622. private _updateSquareProps;
  6623. private _drawGradientSquare;
  6624. private _drawCircle;
  6625. private _createColorWheelCanvas;
  6626. /** @hidden */
  6627. _draw(context: CanvasRenderingContext2D): void;
  6628. private _pointerIsDown;
  6629. private _updateValueFromPointer;
  6630. private _isPointOnSquare;
  6631. private _isPointOnWheel;
  6632. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6633. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  6634. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6635. /**
  6636. * This function expands the color picker by creating a color picker dialog with manual
  6637. * color value input and the ability to save colors into an array to be used later in
  6638. * subsequent launches of the dialogue.
  6639. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  6640. * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.
  6641. * @returns picked color as a hex string and the saved colors array as hex strings.
  6642. */
  6643. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  6644. pickerWidth?: string;
  6645. pickerHeight?: string;
  6646. headerHeight?: string;
  6647. lastColor?: string;
  6648. swatchLimit?: number;
  6649. numSwatchesPerLine?: number;
  6650. savedColors?: Array<string>;
  6651. }): Promise<{
  6652. savedColors?: string[];
  6653. pickedColor: string;
  6654. }>;
  6655. }
  6656. }
  6657. declare module BABYLON.GUI {
  6658. /** Class used to create 2D ellipse containers */
  6659. export class Ellipse extends Container {
  6660. name?: string | undefined;
  6661. private _thickness;
  6662. /** Gets or sets border thickness */
  6663. get thickness(): number;
  6664. set thickness(value: number);
  6665. /**
  6666. * Creates a new Ellipse
  6667. * @param name defines the control name
  6668. */
  6669. constructor(name?: string | undefined);
  6670. protected _getTypeName(): string;
  6671. protected _localDraw(context: CanvasRenderingContext2D): void;
  6672. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6673. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  6674. }
  6675. }
  6676. declare module BABYLON.GUI {
  6677. /**
  6678. * Class used to create a password control
  6679. */
  6680. export class InputPassword extends InputText {
  6681. protected _beforeRenderText(text: string): string;
  6682. }
  6683. }
  6684. declare module BABYLON.GUI {
  6685. /** Class used to render 2D lines */
  6686. export class Line extends Control {
  6687. name?: string | undefined;
  6688. private _lineWidth;
  6689. private _x1;
  6690. private _y1;
  6691. private _x2;
  6692. private _y2;
  6693. private _dash;
  6694. private _connectedControl;
  6695. private _connectedControlDirtyObserver;
  6696. /** Gets or sets the dash pattern */
  6697. get dash(): Array<number>;
  6698. set dash(value: Array<number>);
  6699. /** Gets or sets the control connected with the line end */
  6700. get connectedControl(): Control;
  6701. set connectedControl(value: Control);
  6702. /** Gets or sets start coordinates on X axis */
  6703. get x1(): string | number;
  6704. set x1(value: string | number);
  6705. /** Gets or sets start coordinates on Y axis */
  6706. get y1(): string | number;
  6707. set y1(value: string | number);
  6708. /** Gets or sets end coordinates on X axis */
  6709. get x2(): string | number;
  6710. set x2(value: string | number);
  6711. /** Gets or sets end coordinates on Y axis */
  6712. get y2(): string | number;
  6713. set y2(value: string | number);
  6714. /** Gets or sets line width */
  6715. get lineWidth(): number;
  6716. set lineWidth(value: number);
  6717. /** Gets or sets horizontal alignment */
  6718. set horizontalAlignment(value: number);
  6719. /** Gets or sets vertical alignment */
  6720. set verticalAlignment(value: number);
  6721. private get _effectiveX2();
  6722. private get _effectiveY2();
  6723. /**
  6724. * Creates a new Line
  6725. * @param name defines the control name
  6726. */
  6727. constructor(name?: string | undefined);
  6728. protected _getTypeName(): string;
  6729. _draw(context: CanvasRenderingContext2D): void;
  6730. _measure(): void;
  6731. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6732. /**
  6733. * Move one end of the line given 3D cartesian coordinates.
  6734. * @param position Targeted world position
  6735. * @param scene BABYLON.Scene
  6736. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  6737. */
  6738. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  6739. /**
  6740. * Move one end of the line to a position in screen absolute space.
  6741. * @param projectedPosition Position in screen absolute space (X, Y)
  6742. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  6743. */
  6744. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  6745. }
  6746. }
  6747. declare module BABYLON.GUI {
  6748. /**
  6749. * Class used to store a point for a MultiLine object.
  6750. * The point can be pure 2D coordinates, a mesh or a control
  6751. */
  6752. export class MultiLinePoint {
  6753. private _multiLine;
  6754. private _x;
  6755. private _y;
  6756. private _control;
  6757. private _mesh;
  6758. private _controlObserver;
  6759. private _meshObserver;
  6760. /** @hidden */
  6761. _point: BABYLON.Vector2;
  6762. /**
  6763. * Creates a new MultiLinePoint
  6764. * @param multiLine defines the source MultiLine object
  6765. */
  6766. constructor(multiLine: MultiLine);
  6767. /** Gets or sets x coordinate */
  6768. get x(): string | number;
  6769. set x(value: string | number);
  6770. /** Gets or sets y coordinate */
  6771. get y(): string | number;
  6772. set y(value: string | number);
  6773. /** Gets or sets the control associated with this point */
  6774. get control(): BABYLON.Nullable<Control>;
  6775. set control(value: BABYLON.Nullable<Control>);
  6776. /** Gets or sets the mesh associated with this point */
  6777. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  6778. set mesh(value: BABYLON.Nullable<BABYLON.AbstractMesh>);
  6779. /** Resets links */
  6780. resetLinks(): void;
  6781. /**
  6782. * Gets a translation vector
  6783. * @returns the translation vector
  6784. */
  6785. translate(): BABYLON.Vector2;
  6786. private _translatePoint;
  6787. /** Release associated resources */
  6788. dispose(): void;
  6789. }
  6790. }
  6791. declare module BABYLON.GUI {
  6792. /**
  6793. * Class used to create multi line control
  6794. */
  6795. export class MultiLine extends Control {
  6796. name?: string | undefined;
  6797. private _lineWidth;
  6798. private _dash;
  6799. private _points;
  6800. private _minX;
  6801. private _minY;
  6802. private _maxX;
  6803. private _maxY;
  6804. /**
  6805. * Creates a new MultiLine
  6806. * @param name defines the control name
  6807. */
  6808. constructor(name?: string | undefined);
  6809. /** Gets or sets dash pattern */
  6810. get dash(): Array<number>;
  6811. set dash(value: Array<number>);
  6812. /**
  6813. * Gets point stored at specified index
  6814. * @param index defines the index to look for
  6815. * @returns the requested point if found
  6816. */
  6817. getAt(index: number): MultiLinePoint;
  6818. /** Function called when a point is updated */
  6819. onPointUpdate: () => void;
  6820. /**
  6821. * Adds new points to the point collection
  6822. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  6823. * @returns the list of created MultiLinePoint
  6824. */
  6825. add(...items: (AbstractMesh | Control | {
  6826. x: string | number;
  6827. y: string | number;
  6828. })[]): MultiLinePoint[];
  6829. /**
  6830. * Adds a new point to the point collection
  6831. * @param item defines the item (mesh, control or 2d coordiantes) to add
  6832. * @returns the created MultiLinePoint
  6833. */
  6834. push(item?: (AbstractMesh | Control | {
  6835. x: string | number;
  6836. y: string | number;
  6837. })): MultiLinePoint;
  6838. /**
  6839. * Remove a specific value or point from the active point collection
  6840. * @param value defines the value or point to remove
  6841. */
  6842. remove(value: number | MultiLinePoint): void;
  6843. /**
  6844. * Resets this object to initial state (no point)
  6845. */
  6846. reset(): void;
  6847. /**
  6848. * Resets all links
  6849. */
  6850. resetLinks(): void;
  6851. /** Gets or sets line width */
  6852. get lineWidth(): number;
  6853. set lineWidth(value: number);
  6854. set horizontalAlignment(value: number);
  6855. set verticalAlignment(value: number);
  6856. protected _getTypeName(): string;
  6857. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6858. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6859. _measure(): void;
  6860. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6861. dispose(): void;
  6862. }
  6863. }
  6864. declare module BABYLON.GUI {
  6865. /**
  6866. * Class used to create radio button controls
  6867. */
  6868. export class RadioButton extends Control {
  6869. name?: string | undefined;
  6870. private _isChecked;
  6871. private _background;
  6872. private _checkSizeRatio;
  6873. private _thickness;
  6874. /** Gets or sets border thickness */
  6875. get thickness(): number;
  6876. set thickness(value: number);
  6877. /** Gets or sets group name */
  6878. group: string;
  6879. /** BABYLON.Observable raised when isChecked is changed */
  6880. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  6881. /** Gets or sets a value indicating the ratio between overall size and check size */
  6882. get checkSizeRatio(): number;
  6883. set checkSizeRatio(value: number);
  6884. /** Gets or sets background color */
  6885. get background(): string;
  6886. set background(value: string);
  6887. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  6888. get isChecked(): boolean;
  6889. set isChecked(value: boolean);
  6890. /**
  6891. * Creates a new RadioButton
  6892. * @param name defines the control name
  6893. */
  6894. constructor(name?: string | undefined);
  6895. protected _getTypeName(): string;
  6896. _draw(context: CanvasRenderingContext2D): void;
  6897. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6898. /**
  6899. * Utility function to easily create a radio button with a header
  6900. * @param title defines the label to use for the header
  6901. * @param group defines the group to use for the radio button
  6902. * @param isChecked defines the initial state of the radio button
  6903. * @param onValueChanged defines the callback to call when value changes
  6904. * @returns a StackPanel containing the radio button and a textBlock
  6905. */
  6906. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  6907. }
  6908. }
  6909. declare module BABYLON.GUI {
  6910. /**
  6911. * Class used to create slider controls
  6912. */
  6913. export class BaseSlider extends Control {
  6914. name?: string | undefined;
  6915. protected _thumbWidth: ValueAndUnit;
  6916. private _minimum;
  6917. private _maximum;
  6918. private _value;
  6919. private _isVertical;
  6920. protected _barOffset: ValueAndUnit;
  6921. private _isThumbClamped;
  6922. protected _displayThumb: boolean;
  6923. private _step;
  6924. private _lastPointerDownID;
  6925. protected _effectiveBarOffset: number;
  6926. protected _renderLeft: number;
  6927. protected _renderTop: number;
  6928. protected _renderWidth: number;
  6929. protected _renderHeight: number;
  6930. protected _backgroundBoxLength: number;
  6931. protected _backgroundBoxThickness: number;
  6932. protected _effectiveThumbThickness: number;
  6933. /** BABYLON.Observable raised when the sldier value changes */
  6934. onValueChangedObservable: BABYLON.Observable<number>;
  6935. /** Gets or sets a boolean indicating if the thumb must be rendered */
  6936. get displayThumb(): boolean;
  6937. set displayThumb(value: boolean);
  6938. /** Gets or sets a step to apply to values (0 by default) */
  6939. get step(): number;
  6940. set step(value: number);
  6941. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  6942. get barOffset(): string | number;
  6943. /** Gets main bar offset in pixels*/
  6944. get barOffsetInPixels(): number;
  6945. set barOffset(value: string | number);
  6946. /** Gets or sets thumb width */
  6947. get thumbWidth(): string | number;
  6948. /** Gets thumb width in pixels */
  6949. get thumbWidthInPixels(): number;
  6950. set thumbWidth(value: string | number);
  6951. /** Gets or sets minimum value */
  6952. get minimum(): number;
  6953. set minimum(value: number);
  6954. /** Gets or sets maximum value */
  6955. get maximum(): number;
  6956. set maximum(value: number);
  6957. /** Gets or sets current value */
  6958. get value(): number;
  6959. set value(value: number);
  6960. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  6961. get isVertical(): boolean;
  6962. set isVertical(value: boolean);
  6963. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  6964. get isThumbClamped(): boolean;
  6965. set isThumbClamped(value: boolean);
  6966. /**
  6967. * Creates a new BaseSlider
  6968. * @param name defines the control name
  6969. */
  6970. constructor(name?: string | undefined);
  6971. protected _getTypeName(): string;
  6972. protected _getThumbPosition(): number;
  6973. protected _getThumbThickness(type: string): number;
  6974. protected _prepareRenderingData(type: string): void;
  6975. private _pointerIsDown;
  6976. /** @hidden */
  6977. protected _updateValueFromPointer(x: number, y: number): void;
  6978. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6979. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  6980. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6981. }
  6982. }
  6983. declare module BABYLON.GUI {
  6984. /**
  6985. * Class used to create slider controls
  6986. */
  6987. export class Slider extends BaseSlider {
  6988. name?: string | undefined;
  6989. private _background;
  6990. private _borderColor;
  6991. private _isThumbCircle;
  6992. protected _displayValueBar: boolean;
  6993. /** Gets or sets a boolean indicating if the value bar must be rendered */
  6994. get displayValueBar(): boolean;
  6995. set displayValueBar(value: boolean);
  6996. /** Gets or sets border color */
  6997. get borderColor(): string;
  6998. set borderColor(value: string);
  6999. /** Gets or sets background color */
  7000. get background(): string;
  7001. set background(value: string);
  7002. /** Gets or sets a boolean indicating if the thumb should be round or square */
  7003. get isThumbCircle(): boolean;
  7004. set isThumbCircle(value: boolean);
  7005. /**
  7006. * Creates a new Slider
  7007. * @param name defines the control name
  7008. */
  7009. constructor(name?: string | undefined);
  7010. protected _getTypeName(): string;
  7011. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7012. }
  7013. }
  7014. declare module BABYLON.GUI {
  7015. /** Class used to create a RadioGroup
  7016. * which contains groups of radio buttons
  7017. */
  7018. export class SelectorGroup {
  7019. /** name of SelectorGroup */
  7020. name: string;
  7021. private _groupPanel;
  7022. private _selectors;
  7023. private _groupHeader;
  7024. /**
  7025. * Creates a new SelectorGroup
  7026. * @param name of group, used as a group heading
  7027. */
  7028. constructor(
  7029. /** name of SelectorGroup */
  7030. name: string);
  7031. /** Gets the groupPanel of the SelectorGroup */
  7032. get groupPanel(): StackPanel;
  7033. /** Gets the selectors array */
  7034. get selectors(): StackPanel[];
  7035. /** Gets and sets the group header */
  7036. get header(): string;
  7037. set header(label: string);
  7038. /** @hidden */
  7039. private _addGroupHeader;
  7040. /** @hidden*/
  7041. _getSelector(selectorNb: number): StackPanel | undefined;
  7042. /** Removes the selector at the given position
  7043. * @param selectorNb the position of the selector within the group
  7044. */
  7045. removeSelector(selectorNb: number): void;
  7046. }
  7047. /** Class used to create a CheckboxGroup
  7048. * which contains groups of checkbox buttons
  7049. */
  7050. export class CheckboxGroup extends SelectorGroup {
  7051. /** Adds a checkbox as a control
  7052. * @param text is the label for the selector
  7053. * @param func is the function called when the Selector is checked
  7054. * @param checked is true when Selector is checked
  7055. */
  7056. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  7057. /** @hidden */
  7058. _setSelectorLabel(selectorNb: number, label: string): void;
  7059. /** @hidden */
  7060. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7061. /** @hidden */
  7062. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7063. /** @hidden */
  7064. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7065. }
  7066. /** Class used to create a RadioGroup
  7067. * which contains groups of radio buttons
  7068. */
  7069. export class RadioGroup extends SelectorGroup {
  7070. private _selectNb;
  7071. /** Adds a radio button as a control
  7072. * @param label is the label for the selector
  7073. * @param func is the function called when the Selector is checked
  7074. * @param checked is true when Selector is checked
  7075. */
  7076. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  7077. /** @hidden */
  7078. _setSelectorLabel(selectorNb: number, label: string): void;
  7079. /** @hidden */
  7080. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7081. /** @hidden */
  7082. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7083. /** @hidden */
  7084. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7085. }
  7086. /** Class used to create a SliderGroup
  7087. * which contains groups of slider buttons
  7088. */
  7089. export class SliderGroup extends SelectorGroup {
  7090. /**
  7091. * Adds a slider to the SelectorGroup
  7092. * @param label is the label for the SliderBar
  7093. * @param func is the function called when the Slider moves
  7094. * @param unit is a string describing the units used, eg degrees or metres
  7095. * @param min is the minimum value for the Slider
  7096. * @param max is the maximum value for the Slider
  7097. * @param value is the start value for the Slider between min and max
  7098. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  7099. */
  7100. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  7101. /** @hidden */
  7102. _setSelectorLabel(selectorNb: number, label: string): void;
  7103. /** @hidden */
  7104. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7105. /** @hidden */
  7106. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7107. /** @hidden */
  7108. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7109. }
  7110. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  7111. * @see http://doc.babylonjs.com/how_to/selector
  7112. */
  7113. export class SelectionPanel extends Rectangle {
  7114. /** name of SelectionPanel */
  7115. name: string;
  7116. /** an array of SelectionGroups */
  7117. groups: SelectorGroup[];
  7118. private _panel;
  7119. private _buttonColor;
  7120. private _buttonBackground;
  7121. private _headerColor;
  7122. private _barColor;
  7123. private _barHeight;
  7124. private _spacerHeight;
  7125. private _labelColor;
  7126. private _groups;
  7127. private _bars;
  7128. /**
  7129. * Creates a new SelectionPanel
  7130. * @param name of SelectionPanel
  7131. * @param groups is an array of SelectionGroups
  7132. */
  7133. constructor(
  7134. /** name of SelectionPanel */
  7135. name: string,
  7136. /** an array of SelectionGroups */
  7137. groups?: SelectorGroup[]);
  7138. protected _getTypeName(): string;
  7139. /** Gets or sets the headerColor */
  7140. get headerColor(): string;
  7141. set headerColor(color: string);
  7142. private _setHeaderColor;
  7143. /** Gets or sets the button color */
  7144. get buttonColor(): string;
  7145. set buttonColor(color: string);
  7146. private _setbuttonColor;
  7147. /** Gets or sets the label color */
  7148. get labelColor(): string;
  7149. set labelColor(color: string);
  7150. private _setLabelColor;
  7151. /** Gets or sets the button background */
  7152. get buttonBackground(): string;
  7153. set buttonBackground(color: string);
  7154. private _setButtonBackground;
  7155. /** Gets or sets the color of separator bar */
  7156. get barColor(): string;
  7157. set barColor(color: string);
  7158. private _setBarColor;
  7159. /** Gets or sets the height of separator bar */
  7160. get barHeight(): string;
  7161. set barHeight(value: string);
  7162. private _setBarHeight;
  7163. /** Gets or sets the height of spacers*/
  7164. get spacerHeight(): string;
  7165. set spacerHeight(value: string);
  7166. private _setSpacerHeight;
  7167. /** Adds a bar between groups */
  7168. private _addSpacer;
  7169. /** Add a group to the selection panel
  7170. * @param group is the selector group to add
  7171. */
  7172. addGroup(group: SelectorGroup): void;
  7173. /** Remove the group from the given position
  7174. * @param groupNb is the position of the group in the list
  7175. */
  7176. removeGroup(groupNb: number): void;
  7177. /** Change a group header label
  7178. * @param label is the new group header label
  7179. * @param groupNb is the number of the group to relabel
  7180. * */
  7181. setHeaderName(label: string, groupNb: number): void;
  7182. /** Change selector label to the one given
  7183. * @param label is the new selector label
  7184. * @param groupNb is the number of the groupcontaining the selector
  7185. * @param selectorNb is the number of the selector within a group to relabel
  7186. * */
  7187. relabel(label: string, groupNb: number, selectorNb: number): void;
  7188. /** For a given group position remove the selector at the given position
  7189. * @param groupNb is the number of the group to remove the selector from
  7190. * @param selectorNb is the number of the selector within the group
  7191. */
  7192. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  7193. /** For a given group position of correct type add a checkbox button
  7194. * @param groupNb is the number of the group to remove the selector from
  7195. * @param label is the label for the selector
  7196. * @param func is the function called when the Selector is checked
  7197. * @param checked is true when Selector is checked
  7198. */
  7199. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  7200. /** For a given group position of correct type add a radio button
  7201. * @param groupNb is the number of the group to remove the selector from
  7202. * @param label is the label for the selector
  7203. * @param func is the function called when the Selector is checked
  7204. * @param checked is true when Selector is checked
  7205. */
  7206. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  7207. /**
  7208. * For a given slider group add a slider
  7209. * @param groupNb is the number of the group to add the slider to
  7210. * @param label is the label for the Slider
  7211. * @param func is the function called when the Slider moves
  7212. * @param unit is a string describing the units used, eg degrees or metres
  7213. * @param min is the minimum value for the Slider
  7214. * @param max is the maximum value for the Slider
  7215. * @param value is the start value for the Slider between min and max
  7216. * @param onVal is the function used to format the value displayed, eg radians to degrees
  7217. */
  7218. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  7219. }
  7220. }
  7221. declare module BABYLON.GUI {
  7222. /**
  7223. * Class used to hold a the container for ScrollViewer
  7224. * @hidden
  7225. */
  7226. export class _ScrollViewerWindow extends Container {
  7227. parentClientWidth: number;
  7228. parentClientHeight: number;
  7229. private _freezeControls;
  7230. private _parentMeasure;
  7231. private _oldLeft;
  7232. private _oldTop;
  7233. get freezeControls(): boolean;
  7234. set freezeControls(value: boolean);
  7235. private _bucketWidth;
  7236. private _bucketHeight;
  7237. private _buckets;
  7238. private _bucketLen;
  7239. get bucketWidth(): number;
  7240. get bucketHeight(): number;
  7241. setBucketSizes(width: number, height: number): void;
  7242. private _useBuckets;
  7243. private _makeBuckets;
  7244. private _dispatchInBuckets;
  7245. private _updateMeasures;
  7246. private _updateChildrenMeasures;
  7247. /**
  7248. * Creates a new ScrollViewerWindow
  7249. * @param name of ScrollViewerWindow
  7250. */
  7251. constructor(name?: string);
  7252. protected _getTypeName(): string;
  7253. /** @hidden */
  7254. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7255. /** @hidden */
  7256. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  7257. private _scrollChildren;
  7258. private _scrollChildrenWithBuckets;
  7259. /** @hidden */
  7260. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  7261. protected _postMeasure(): void;
  7262. }
  7263. }
  7264. declare module BABYLON.GUI {
  7265. /**
  7266. * Class used to create slider controls
  7267. */
  7268. export class ScrollBar extends BaseSlider {
  7269. name?: string | undefined;
  7270. private _background;
  7271. private _borderColor;
  7272. private _tempMeasure;
  7273. /** Gets or sets border color */
  7274. get borderColor(): string;
  7275. set borderColor(value: string);
  7276. /** Gets or sets background color */
  7277. get background(): string;
  7278. set background(value: string);
  7279. /**
  7280. * Creates a new Slider
  7281. * @param name defines the control name
  7282. */
  7283. constructor(name?: string | undefined);
  7284. protected _getTypeName(): string;
  7285. protected _getThumbThickness(): number;
  7286. _draw(context: CanvasRenderingContext2D): void;
  7287. private _first;
  7288. private _originX;
  7289. private _originY;
  7290. /** @hidden */
  7291. protected _updateValueFromPointer(x: number, y: number): void;
  7292. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  7293. }
  7294. }
  7295. declare module BABYLON.GUI {
  7296. /**
  7297. * Class used to create slider controls
  7298. */
  7299. export class ImageScrollBar extends BaseSlider {
  7300. name?: string | undefined;
  7301. private _backgroundBaseImage;
  7302. private _backgroundImage;
  7303. private _thumbImage;
  7304. private _thumbBaseImage;
  7305. private _thumbLength;
  7306. private _thumbHeight;
  7307. private _barImageHeight;
  7308. private _tempMeasure;
  7309. /**
  7310. * Gets or sets the image used to render the background for horizontal bar
  7311. */
  7312. get backgroundImage(): Image;
  7313. set backgroundImage(value: Image);
  7314. /**
  7315. * Gets or sets the image used to render the thumb
  7316. */
  7317. get thumbImage(): Image;
  7318. set thumbImage(value: Image);
  7319. /**
  7320. * Gets or sets the length of the thumb
  7321. */
  7322. get thumbLength(): number;
  7323. set thumbLength(value: number);
  7324. /**
  7325. * Gets or sets the height of the thumb
  7326. */
  7327. get thumbHeight(): number;
  7328. set thumbHeight(value: number);
  7329. /**
  7330. * Gets or sets the height of the bar image
  7331. */
  7332. get barImageHeight(): number;
  7333. set barImageHeight(value: number);
  7334. /**
  7335. * Creates a new ImageScrollBar
  7336. * @param name defines the control name
  7337. */
  7338. constructor(name?: string | undefined);
  7339. protected _getTypeName(): string;
  7340. protected _getThumbThickness(): number;
  7341. _draw(context: CanvasRenderingContext2D): void;
  7342. private _first;
  7343. private _originX;
  7344. private _originY;
  7345. /** @hidden */
  7346. protected _updateValueFromPointer(x: number, y: number): void;
  7347. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  7348. }
  7349. }
  7350. declare module BABYLON.GUI {
  7351. /**
  7352. * Class used to hold a viewer window and sliders in a grid
  7353. */
  7354. export class ScrollViewer extends Rectangle {
  7355. private _grid;
  7356. private _horizontalBarSpace;
  7357. private _verticalBarSpace;
  7358. private _dragSpace;
  7359. private _horizontalBar;
  7360. private _verticalBar;
  7361. private _barColor;
  7362. private _barBackground;
  7363. private _barImage;
  7364. private _horizontalBarImage;
  7365. private _verticalBarImage;
  7366. private _barBackgroundImage;
  7367. private _horizontalBarBackgroundImage;
  7368. private _verticalBarBackgroundImage;
  7369. private _barSize;
  7370. private _window;
  7371. private _pointerIsOver;
  7372. private _wheelPrecision;
  7373. private _onPointerObserver;
  7374. private _clientWidth;
  7375. private _clientHeight;
  7376. private _useImageBar;
  7377. private _thumbLength;
  7378. private _thumbHeight;
  7379. private _barImageHeight;
  7380. private _horizontalBarImageHeight;
  7381. private _verticalBarImageHeight;
  7382. /**
  7383. * Gets the horizontal scrollbar
  7384. */
  7385. get horizontalBar(): ScrollBar | ImageScrollBar;
  7386. /**
  7387. * Gets the vertical scrollbar
  7388. */
  7389. get verticalBar(): ScrollBar | ImageScrollBar;
  7390. /**
  7391. * Adds a new control to the current container
  7392. * @param control defines the control to add
  7393. * @returns the current container
  7394. */
  7395. addControl(control: BABYLON.Nullable<Control>): Container;
  7396. /**
  7397. * Removes a control from the current container
  7398. * @param control defines the control to remove
  7399. * @returns the current container
  7400. */
  7401. removeControl(control: Control): Container;
  7402. /** Gets the list of children */
  7403. get children(): Control[];
  7404. _flagDescendantsAsMatrixDirty(): void;
  7405. /**
  7406. * Freezes or unfreezes the controls in the window.
  7407. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  7408. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  7409. */
  7410. get freezeControls(): boolean;
  7411. set freezeControls(value: boolean);
  7412. /** Gets the bucket width */
  7413. get bucketWidth(): number;
  7414. /** Gets the bucket height */
  7415. get bucketHeight(): number;
  7416. /**
  7417. * Sets the bucket sizes.
  7418. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  7419. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  7420. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  7421. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  7422. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  7423. * used), that's why it is not enabled by default.
  7424. * @param width width of the bucket
  7425. * @param height height of the bucket
  7426. */
  7427. setBucketSizes(width: number, height: number): void;
  7428. private _forceHorizontalBar;
  7429. private _forceVerticalBar;
  7430. /**
  7431. * Forces the horizontal scroll bar to be displayed
  7432. */
  7433. get forceHorizontalBar(): boolean;
  7434. set forceHorizontalBar(value: boolean);
  7435. /**
  7436. * Forces the vertical scroll bar to be displayed
  7437. */
  7438. get forceVerticalBar(): boolean;
  7439. set forceVerticalBar(value: boolean);
  7440. /**
  7441. * Creates a new ScrollViewer
  7442. * @param name of ScrollViewer
  7443. */
  7444. constructor(name?: string, isImageBased?: boolean);
  7445. /** Reset the scroll viewer window to initial size */
  7446. resetWindow(): void;
  7447. protected _getTypeName(): string;
  7448. private _buildClientSizes;
  7449. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7450. protected _postMeasure(): void;
  7451. /**
  7452. * Gets or sets the mouse wheel precision
  7453. * from 0 to 1 with a default value of 0.05
  7454. * */
  7455. get wheelPrecision(): number;
  7456. set wheelPrecision(value: number);
  7457. /** Gets or sets the scroll bar container background color */
  7458. get scrollBackground(): string;
  7459. set scrollBackground(color: string);
  7460. /** Gets or sets the bar color */
  7461. get barColor(): string;
  7462. set barColor(color: string);
  7463. /** Gets or sets the bar image */
  7464. get thumbImage(): Image;
  7465. set thumbImage(value: Image);
  7466. /** Gets or sets the horizontal bar image */
  7467. get horizontalThumbImage(): Image;
  7468. set horizontalThumbImage(value: Image);
  7469. /** Gets or sets the vertical bar image */
  7470. get verticalThumbImage(): Image;
  7471. set verticalThumbImage(value: Image);
  7472. /** Gets or sets the size of the bar */
  7473. get barSize(): number;
  7474. set barSize(value: number);
  7475. /** Gets or sets the length of the thumb */
  7476. get thumbLength(): number;
  7477. set thumbLength(value: number);
  7478. /** Gets or sets the height of the thumb */
  7479. get thumbHeight(): number;
  7480. set thumbHeight(value: number);
  7481. /** Gets or sets the height of the bar image */
  7482. get barImageHeight(): number;
  7483. set barImageHeight(value: number);
  7484. /** Gets or sets the height of the horizontal bar image */
  7485. get horizontalBarImageHeight(): number;
  7486. set horizontalBarImageHeight(value: number);
  7487. /** Gets or sets the height of the vertical bar image */
  7488. get verticalBarImageHeight(): number;
  7489. set verticalBarImageHeight(value: number);
  7490. /** Gets or sets the bar background */
  7491. get barBackground(): string;
  7492. set barBackground(color: string);
  7493. /** Gets or sets the bar background image */
  7494. get barImage(): Image;
  7495. set barImage(value: Image);
  7496. /** Gets or sets the horizontal bar background image */
  7497. get horizontalBarImage(): Image;
  7498. set horizontalBarImage(value: Image);
  7499. /** Gets or sets the vertical bar background image */
  7500. get verticalBarImage(): Image;
  7501. set verticalBarImage(value: Image);
  7502. private _setWindowPosition;
  7503. /** @hidden */
  7504. private _updateScroller;
  7505. _link(host: AdvancedDynamicTexture): void;
  7506. /** @hidden */
  7507. private _addBar;
  7508. /** @hidden */
  7509. private _attachWheel;
  7510. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  7511. /** Releases associated resources */
  7512. dispose(): void;
  7513. }
  7514. }
  7515. declare module BABYLON.GUI {
  7516. /** Class used to render a grid */
  7517. export class DisplayGrid extends Control {
  7518. name?: string | undefined;
  7519. private _cellWidth;
  7520. private _cellHeight;
  7521. private _minorLineTickness;
  7522. private _minorLineColor;
  7523. private _majorLineTickness;
  7524. private _majorLineColor;
  7525. private _majorLineFrequency;
  7526. private _background;
  7527. private _displayMajorLines;
  7528. private _displayMinorLines;
  7529. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  7530. get displayMinorLines(): boolean;
  7531. set displayMinorLines(value: boolean);
  7532. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  7533. get displayMajorLines(): boolean;
  7534. set displayMajorLines(value: boolean);
  7535. /** Gets or sets background color (Black by default) */
  7536. get background(): string;
  7537. set background(value: string);
  7538. /** Gets or sets the width of each cell (20 by default) */
  7539. get cellWidth(): number;
  7540. set cellWidth(value: number);
  7541. /** Gets or sets the height of each cell (20 by default) */
  7542. get cellHeight(): number;
  7543. set cellHeight(value: number);
  7544. /** Gets or sets the tickness of minor lines (1 by default) */
  7545. get minorLineTickness(): number;
  7546. set minorLineTickness(value: number);
  7547. /** Gets or sets the color of minor lines (DarkGray by default) */
  7548. get minorLineColor(): string;
  7549. set minorLineColor(value: string);
  7550. /** Gets or sets the tickness of major lines (2 by default) */
  7551. get majorLineTickness(): number;
  7552. set majorLineTickness(value: number);
  7553. /** Gets or sets the color of major lines (White by default) */
  7554. get majorLineColor(): string;
  7555. set majorLineColor(value: string);
  7556. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  7557. get majorLineFrequency(): number;
  7558. set majorLineFrequency(value: number);
  7559. /**
  7560. * Creates a new GridDisplayRectangle
  7561. * @param name defines the control name
  7562. */
  7563. constructor(name?: string | undefined);
  7564. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7565. protected _getTypeName(): string;
  7566. }
  7567. }
  7568. declare module BABYLON.GUI {
  7569. /**
  7570. * Class used to create slider controls based on images
  7571. */
  7572. export class ImageBasedSlider extends BaseSlider {
  7573. name?: string | undefined;
  7574. private _backgroundImage;
  7575. private _thumbImage;
  7576. private _valueBarImage;
  7577. private _tempMeasure;
  7578. get displayThumb(): boolean;
  7579. set displayThumb(value: boolean);
  7580. /**
  7581. * Gets or sets the image used to render the background
  7582. */
  7583. get backgroundImage(): Image;
  7584. set backgroundImage(value: Image);
  7585. /**
  7586. * Gets or sets the image used to render the value bar
  7587. */
  7588. get valueBarImage(): Image;
  7589. set valueBarImage(value: Image);
  7590. /**
  7591. * Gets or sets the image used to render the thumb
  7592. */
  7593. get thumbImage(): Image;
  7594. set thumbImage(value: Image);
  7595. /**
  7596. * Creates a new ImageBasedSlider
  7597. * @param name defines the control name
  7598. */
  7599. constructor(name?: string | undefined);
  7600. protected _getTypeName(): string;
  7601. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7602. }
  7603. }
  7604. declare module BABYLON.GUI {
  7605. /**
  7606. * Forcing an export so that this code will execute
  7607. * @hidden
  7608. */
  7609. const name = "Statics";
  7610. }
  7611. declare module BABYLON.GUI {
  7612. /**
  7613. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  7614. */
  7615. export class AdvancedDynamicTextureInstrumentation implements BABYLON.IDisposable {
  7616. /**
  7617. * Define the instrumented AdvancedDynamicTexture.
  7618. */
  7619. texture: AdvancedDynamicTexture;
  7620. private _captureRenderTime;
  7621. private _renderTime;
  7622. private _captureLayoutTime;
  7623. private _layoutTime;
  7624. private _onBeginRenderObserver;
  7625. private _onEndRenderObserver;
  7626. private _onBeginLayoutObserver;
  7627. private _onEndLayoutObserver;
  7628. /**
  7629. * Gets the perf counter used to capture render time
  7630. */
  7631. get renderTimeCounter(): BABYLON.PerfCounter;
  7632. /**
  7633. * Gets the perf counter used to capture layout time
  7634. */
  7635. get layoutTimeCounter(): BABYLON.PerfCounter;
  7636. /**
  7637. * Enable or disable the render time capture
  7638. */
  7639. get captureRenderTime(): boolean;
  7640. set captureRenderTime(value: boolean);
  7641. /**
  7642. * Enable or disable the layout time capture
  7643. */
  7644. get captureLayoutTime(): boolean;
  7645. set captureLayoutTime(value: boolean);
  7646. /**
  7647. * Instantiates a new advanced dynamic texture instrumentation.
  7648. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  7649. * @param texture Defines the AdvancedDynamicTexture to instrument
  7650. */
  7651. constructor(
  7652. /**
  7653. * Define the instrumented AdvancedDynamicTexture.
  7654. */
  7655. texture: AdvancedDynamicTexture);
  7656. /**
  7657. * Dispose and release associated resources.
  7658. */
  7659. dispose(): void;
  7660. }
  7661. }
  7662. declare module BABYLON.GUI {
  7663. /**
  7664. * Class used to load GUI via XML.
  7665. */
  7666. export class XmlLoader {
  7667. private _nodes;
  7668. private _nodeTypes;
  7669. private _isLoaded;
  7670. private _objectAttributes;
  7671. private _parentClass;
  7672. /**
  7673. * Create a new xml loader
  7674. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  7675. */
  7676. constructor(parentClass?: null);
  7677. private _getChainElement;
  7678. private _getClassAttribute;
  7679. private _createGuiElement;
  7680. private _parseGrid;
  7681. private _parseElement;
  7682. private _prepareSourceElement;
  7683. private _parseElementsFromSource;
  7684. private _parseXml;
  7685. /**
  7686. * Gets if the loading has finished.
  7687. * @returns whether the loading has finished or not
  7688. */
  7689. isLoaded(): boolean;
  7690. /**
  7691. * Gets a loaded node / control by id.
  7692. * @param id the Controls id set in the xml
  7693. * @returns element of type Control
  7694. */
  7695. getNodeById(id: string): any;
  7696. /**
  7697. * Gets all loaded nodes / controls
  7698. * @returns Array of controls
  7699. */
  7700. getNodes(): any;
  7701. /**
  7702. * Initiates the xml layout loading
  7703. * @param xmlFile defines the xml layout to load
  7704. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  7705. * @param callback defines the callback called on layout load.
  7706. */
  7707. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  7708. }
  7709. }
  7710. declare module BABYLON.GUI {
  7711. /**
  7712. * Class used to create containers for controls
  7713. */
  7714. export class Container3D extends Control3D {
  7715. private _blockLayout;
  7716. /**
  7717. * Gets the list of child controls
  7718. */
  7719. protected _children: Control3D[];
  7720. /**
  7721. * Gets the list of child controls
  7722. */
  7723. get children(): Array<Control3D>;
  7724. /**
  7725. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  7726. * This is helpful to optimize layout operation when adding multiple children in a row
  7727. */
  7728. get blockLayout(): boolean;
  7729. set blockLayout(value: boolean);
  7730. /**
  7731. * Creates a new container
  7732. * @param name defines the container name
  7733. */
  7734. constructor(name?: string);
  7735. /**
  7736. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  7737. * @returns the current container
  7738. */
  7739. updateLayout(): Container3D;
  7740. /**
  7741. * Gets a boolean indicating if the given control is in the children of this control
  7742. * @param control defines the control to check
  7743. * @returns true if the control is in the child list
  7744. */
  7745. containsControl(control: Control3D): boolean;
  7746. /**
  7747. * Adds a control to the children of this control
  7748. * @param control defines the control to add
  7749. * @returns the current container
  7750. */
  7751. addControl(control: Control3D): Container3D;
  7752. /**
  7753. * This function will be called everytime a new control is added
  7754. */
  7755. protected _arrangeChildren(): void;
  7756. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  7757. /**
  7758. * Removes a control from the children of this control
  7759. * @param control defines the control to remove
  7760. * @returns the current container
  7761. */
  7762. removeControl(control: Control3D): Container3D;
  7763. protected _getTypeName(): string;
  7764. /**
  7765. * Releases all associated resources
  7766. */
  7767. dispose(): void;
  7768. /** Control rotation will remain unchanged */
  7769. static readonly UNSET_ORIENTATION: number;
  7770. /** Control will rotate to make it look at sphere central axis */
  7771. static readonly FACEORIGIN_ORIENTATION: number;
  7772. /** Control will rotate to make it look back at sphere central axis */
  7773. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  7774. /** Control will rotate to look at z axis (0, 0, 1) */
  7775. static readonly FACEFORWARD_ORIENTATION: number;
  7776. /** Control will rotate to look at negative z axis (0, 0, -1) */
  7777. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  7778. }
  7779. }
  7780. declare module BABYLON.GUI {
  7781. /**
  7782. * Class used to manage 3D user interface
  7783. * @see http://doc.babylonjs.com/how_to/gui3d
  7784. */
  7785. export class GUI3DManager implements BABYLON.IDisposable {
  7786. private _scene;
  7787. private _sceneDisposeObserver;
  7788. private _utilityLayer;
  7789. private _rootContainer;
  7790. private _pointerObserver;
  7791. private _pointerOutObserver;
  7792. /** @hidden */
  7793. _lastPickedControl: Control3D;
  7794. /** @hidden */
  7795. _lastControlOver: {
  7796. [pointerId: number]: Control3D;
  7797. };
  7798. /** @hidden */
  7799. _lastControlDown: {
  7800. [pointerId: number]: Control3D;
  7801. };
  7802. /**
  7803. * BABYLON.Observable raised when the point picked by the pointer events changed
  7804. */
  7805. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  7806. /** @hidden */
  7807. _sharedMaterials: {
  7808. [key: string]: BABYLON.Material;
  7809. };
  7810. /** Gets the hosting scene */
  7811. get scene(): BABYLON.Scene;
  7812. /** Gets associated utility layer */
  7813. get utilityLayer(): BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  7814. /**
  7815. * Creates a new GUI3DManager
  7816. * @param scene
  7817. */
  7818. constructor(scene?: BABYLON.Scene);
  7819. private _handlePointerOut;
  7820. private _doPicking;
  7821. /**
  7822. * Gets the root container
  7823. */
  7824. get rootContainer(): Container3D;
  7825. /**
  7826. * Gets a boolean indicating if the given control is in the root child list
  7827. * @param control defines the control to check
  7828. * @returns true if the control is in the root child list
  7829. */
  7830. containsControl(control: Control3D): boolean;
  7831. /**
  7832. * Adds a control to the root child list
  7833. * @param control defines the control to add
  7834. * @returns the current manager
  7835. */
  7836. addControl(control: Control3D): GUI3DManager;
  7837. /**
  7838. * Removes a control from the root child list
  7839. * @param control defines the control to remove
  7840. * @returns the current container
  7841. */
  7842. removeControl(control: Control3D): GUI3DManager;
  7843. /**
  7844. * Releases all associated resources
  7845. */
  7846. dispose(): void;
  7847. }
  7848. }
  7849. declare module BABYLON.GUI {
  7850. /**
  7851. * Class used to transport BABYLON.Vector3 information for pointer events
  7852. */
  7853. export class Vector3WithInfo extends BABYLON.Vector3 {
  7854. /** defines the current mouse button index */
  7855. buttonIndex: number;
  7856. /**
  7857. * Creates a new Vector3WithInfo
  7858. * @param source defines the vector3 data to transport
  7859. * @param buttonIndex defines the current mouse button index
  7860. */
  7861. constructor(source: BABYLON.Vector3,
  7862. /** defines the current mouse button index */
  7863. buttonIndex?: number);
  7864. }
  7865. }
  7866. declare module BABYLON.GUI {
  7867. /**
  7868. * Class used as base class for controls
  7869. */
  7870. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  7871. /** Defines the control name */
  7872. name?: string | undefined;
  7873. /** @hidden */
  7874. _host: GUI3DManager;
  7875. private _node;
  7876. private _downCount;
  7877. private _enterCount;
  7878. private _downPointerIds;
  7879. private _isVisible;
  7880. /** Gets or sets the control position in world space */
  7881. get position(): BABYLON.Vector3;
  7882. set position(value: BABYLON.Vector3);
  7883. /** Gets or sets the control scaling in world space */
  7884. get scaling(): BABYLON.Vector3;
  7885. set scaling(value: BABYLON.Vector3);
  7886. /** Callback used to start pointer enter animation */
  7887. pointerEnterAnimation: () => void;
  7888. /** Callback used to start pointer out animation */
  7889. pointerOutAnimation: () => void;
  7890. /** Callback used to start pointer down animation */
  7891. pointerDownAnimation: () => void;
  7892. /** Callback used to start pointer up animation */
  7893. pointerUpAnimation: () => void;
  7894. /**
  7895. * An event triggered when the pointer move over the control
  7896. */
  7897. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  7898. /**
  7899. * An event triggered when the pointer move out of the control
  7900. */
  7901. onPointerOutObservable: BABYLON.Observable<Control3D>;
  7902. /**
  7903. * An event triggered when the pointer taps the control
  7904. */
  7905. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  7906. /**
  7907. * An event triggered when pointer is up
  7908. */
  7909. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  7910. /**
  7911. * An event triggered when a control is clicked on (with a mouse)
  7912. */
  7913. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  7914. /**
  7915. * An event triggered when pointer enters the control
  7916. */
  7917. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  7918. /**
  7919. * Gets or sets the parent container
  7920. */
  7921. parent: BABYLON.Nullable<Container3D>;
  7922. private _behaviors;
  7923. /**
  7924. * Gets the list of attached behaviors
  7925. * @see http://doc.babylonjs.com/features/behaviour
  7926. */
  7927. get behaviors(): BABYLON.Behavior<Control3D>[];
  7928. /**
  7929. * Attach a behavior to the control
  7930. * @see http://doc.babylonjs.com/features/behaviour
  7931. * @param behavior defines the behavior to attach
  7932. * @returns the current control
  7933. */
  7934. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  7935. /**
  7936. * Remove an attached behavior
  7937. * @see http://doc.babylonjs.com/features/behaviour
  7938. * @param behavior defines the behavior to attach
  7939. * @returns the current control
  7940. */
  7941. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  7942. /**
  7943. * Gets an attached behavior by name
  7944. * @param name defines the name of the behavior to look for
  7945. * @see http://doc.babylonjs.com/features/behaviour
  7946. * @returns null if behavior was not found else the requested behavior
  7947. */
  7948. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  7949. /** Gets or sets a boolean indicating if the control is visible */
  7950. get isVisible(): boolean;
  7951. set isVisible(value: boolean);
  7952. /**
  7953. * Creates a new control
  7954. * @param name defines the control name
  7955. */
  7956. constructor(
  7957. /** Defines the control name */
  7958. name?: string | undefined);
  7959. /**
  7960. * Gets a string representing the class name
  7961. */
  7962. get typeName(): string;
  7963. /**
  7964. * Get the current class name of the control.
  7965. * @returns current class name
  7966. */
  7967. getClassName(): string;
  7968. protected _getTypeName(): string;
  7969. /**
  7970. * Gets the transform node used by this control
  7971. */
  7972. get node(): BABYLON.Nullable<BABYLON.TransformNode>;
  7973. /**
  7974. * Gets the mesh used to render this control
  7975. */
  7976. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  7977. /**
  7978. * Link the control as child of the given node
  7979. * @param node defines the node to link to. Use null to unlink the control
  7980. * @returns the current control
  7981. */
  7982. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  7983. /** @hidden **/
  7984. _prepareNode(scene: BABYLON.Scene): void;
  7985. /**
  7986. * Node creation.
  7987. * Can be overriden by children
  7988. * @param scene defines the scene where the node must be attached
  7989. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  7990. */
  7991. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  7992. /**
  7993. * Affect a material to the given mesh
  7994. * @param mesh defines the mesh which will represent the control
  7995. */
  7996. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  7997. /** @hidden */
  7998. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  7999. /** @hidden */
  8000. _onPointerEnter(target: Control3D): boolean;
  8001. /** @hidden */
  8002. _onPointerOut(target: Control3D): void;
  8003. /** @hidden */
  8004. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  8005. /** @hidden */
  8006. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  8007. /** @hidden */
  8008. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  8009. /** @hidden */
  8010. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  8011. /** @hidden */
  8012. _disposeNode(): void;
  8013. /**
  8014. * Releases all associated resources
  8015. */
  8016. dispose(): void;
  8017. }
  8018. }
  8019. declare module BABYLON.GUI {
  8020. /**
  8021. * Class used as a root to all buttons
  8022. */
  8023. export class AbstractButton3D extends Control3D {
  8024. /**
  8025. * Creates a new button
  8026. * @param name defines the control name
  8027. */
  8028. constructor(name?: string);
  8029. protected _getTypeName(): string;
  8030. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8031. }
  8032. }
  8033. declare module BABYLON.GUI {
  8034. /**
  8035. * Class used to create a button in 3D
  8036. */
  8037. export class Button3D extends AbstractButton3D {
  8038. /** @hidden */
  8039. protected _currentMaterial: BABYLON.Material;
  8040. private _facadeTexture;
  8041. private _content;
  8042. private _contentResolution;
  8043. private _contentScaleRatio;
  8044. /**
  8045. * Gets or sets the texture resolution used to render content (512 by default)
  8046. */
  8047. get contentResolution(): BABYLON.int;
  8048. set contentResolution(value: BABYLON.int);
  8049. /**
  8050. * Gets or sets the texture scale ratio used to render content (2 by default)
  8051. */
  8052. get contentScaleRatio(): number;
  8053. set contentScaleRatio(value: number);
  8054. protected _disposeFacadeTexture(): void;
  8055. protected _resetContent(): void;
  8056. /**
  8057. * Creates a new button
  8058. * @param name defines the control name
  8059. */
  8060. constructor(name?: string);
  8061. /**
  8062. * Gets or sets the GUI 2D content used to display the button's facade
  8063. */
  8064. get content(): Control;
  8065. set content(value: Control);
  8066. /**
  8067. * Apply the facade texture (created from the content property).
  8068. * This function can be overloaded by child classes
  8069. * @param facadeTexture defines the AdvancedDynamicTexture to use
  8070. */
  8071. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  8072. protected _getTypeName(): string;
  8073. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8074. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  8075. /**
  8076. * Releases all associated resources
  8077. */
  8078. dispose(): void;
  8079. }
  8080. }
  8081. declare module BABYLON.GUI {
  8082. /**
  8083. * Abstract class used to create a container panel deployed on the surface of a volume
  8084. */
  8085. export abstract class VolumeBasedPanel extends Container3D {
  8086. private _columns;
  8087. private _rows;
  8088. private _rowThenColum;
  8089. private _orientation;
  8090. protected _cellWidth: number;
  8091. protected _cellHeight: number;
  8092. /**
  8093. * Gets or sets the distance between elements
  8094. */
  8095. margin: number;
  8096. /**
  8097. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  8098. * | Value | Type | Description |
  8099. * | ----- | ----------------------------------- | ----------- |
  8100. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  8101. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  8102. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  8103. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  8104. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  8105. */
  8106. get orientation(): number;
  8107. set orientation(value: number);
  8108. /**
  8109. * Gets or sets the number of columns requested (10 by default).
  8110. * The panel will automatically compute the number of rows based on number of child controls.
  8111. */
  8112. get columns(): BABYLON.int;
  8113. set columns(value: BABYLON.int);
  8114. /**
  8115. * Gets or sets a the number of rows requested.
  8116. * The panel will automatically compute the number of columns based on number of child controls.
  8117. */
  8118. get rows(): BABYLON.int;
  8119. set rows(value: BABYLON.int);
  8120. /**
  8121. * Creates new VolumeBasedPanel
  8122. */
  8123. constructor();
  8124. protected _arrangeChildren(): void;
  8125. /** Child classes must implement this function to provide correct control positioning */
  8126. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8127. /** Child classes can implement this function to provide additional processing */
  8128. protected _finalProcessing(): void;
  8129. }
  8130. }
  8131. declare module BABYLON.GUI {
  8132. /**
  8133. * Class used to create a container panel deployed on the surface of a cylinder
  8134. */
  8135. export class CylinderPanel extends VolumeBasedPanel {
  8136. private _radius;
  8137. /**
  8138. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  8139. */
  8140. get radius(): BABYLON.float;
  8141. set radius(value: BABYLON.float);
  8142. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8143. private _cylindricalMapping;
  8144. }
  8145. }
  8146. declare module BABYLON.GUI {
  8147. /** @hidden */
  8148. export var fluentVertexShader: {
  8149. name: string;
  8150. shader: string;
  8151. };
  8152. }
  8153. declare module BABYLON.GUI {
  8154. /** @hidden */
  8155. export var fluentPixelShader: {
  8156. name: string;
  8157. shader: string;
  8158. };
  8159. }
  8160. declare module BABYLON.GUI {
  8161. /** @hidden */
  8162. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  8163. INNERGLOW: boolean;
  8164. BORDER: boolean;
  8165. HOVERLIGHT: boolean;
  8166. TEXTURE: boolean;
  8167. constructor();
  8168. }
  8169. /**
  8170. * Class used to render controls with fluent desgin
  8171. */
  8172. export class FluentMaterial extends BABYLON.PushMaterial {
  8173. /**
  8174. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  8175. */
  8176. innerGlowColorIntensity: number;
  8177. /**
  8178. * Gets or sets the inner glow color (white by default)
  8179. */
  8180. innerGlowColor: BABYLON.Color3;
  8181. /**
  8182. * Gets or sets alpha value (default is 1.0)
  8183. */
  8184. alpha: number;
  8185. /**
  8186. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  8187. */
  8188. albedoColor: BABYLON.Color3;
  8189. /**
  8190. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  8191. */
  8192. renderBorders: boolean;
  8193. /**
  8194. * Gets or sets border width (default is 0.5)
  8195. */
  8196. borderWidth: number;
  8197. /**
  8198. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  8199. */
  8200. edgeSmoothingValue: number;
  8201. /**
  8202. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  8203. */
  8204. borderMinValue: number;
  8205. /**
  8206. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  8207. */
  8208. renderHoverLight: boolean;
  8209. /**
  8210. * Gets or sets the radius used to render the hover light (default is 1.0)
  8211. */
  8212. hoverRadius: number;
  8213. /**
  8214. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  8215. */
  8216. hoverColor: BABYLON.Color4;
  8217. /**
  8218. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  8219. */
  8220. hoverPosition: BABYLON.Vector3;
  8221. private _albedoTexture;
  8222. /** Gets or sets the texture to use for albedo color */
  8223. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  8224. /**
  8225. * Creates a new Fluent material
  8226. * @param name defines the name of the material
  8227. * @param scene defines the hosting scene
  8228. */
  8229. constructor(name: string, scene: BABYLON.Scene);
  8230. needAlphaBlending(): boolean;
  8231. needAlphaTesting(): boolean;
  8232. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  8233. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  8234. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  8235. getActiveTextures(): BABYLON.BaseTexture[];
  8236. hasTexture(texture: BABYLON.BaseTexture): boolean;
  8237. dispose(forceDisposeEffect?: boolean): void;
  8238. clone(name: string): FluentMaterial;
  8239. serialize(): any;
  8240. getClassName(): string;
  8241. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  8242. }
  8243. }
  8244. declare module BABYLON.GUI {
  8245. /**
  8246. * Class used to create a holographic button in 3D
  8247. */
  8248. export class HolographicButton extends Button3D {
  8249. private _backPlate;
  8250. private _textPlate;
  8251. private _frontPlate;
  8252. private _text;
  8253. private _imageUrl;
  8254. private _shareMaterials;
  8255. private _frontMaterial;
  8256. private _backMaterial;
  8257. private _plateMaterial;
  8258. private _pickedPointObserver;
  8259. private _tooltipFade;
  8260. private _tooltipTextBlock;
  8261. private _tooltipTexture;
  8262. private _tooltipMesh;
  8263. private _tooltipHoverObserver;
  8264. private _tooltipOutObserver;
  8265. private _disposeTooltip;
  8266. /**
  8267. * Rendering ground id of all the mesh in the button
  8268. */
  8269. set renderingGroupId(id: number);
  8270. get renderingGroupId(): number;
  8271. /**
  8272. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  8273. */
  8274. set tooltipText(text: BABYLON.Nullable<string>);
  8275. get tooltipText(): BABYLON.Nullable<string>;
  8276. /**
  8277. * Gets or sets text for the button
  8278. */
  8279. get text(): string;
  8280. set text(value: string);
  8281. /**
  8282. * Gets or sets the image url for the button
  8283. */
  8284. get imageUrl(): string;
  8285. set imageUrl(value: string);
  8286. /**
  8287. * Gets the back material used by this button
  8288. */
  8289. get backMaterial(): FluentMaterial;
  8290. /**
  8291. * Gets the front material used by this button
  8292. */
  8293. get frontMaterial(): FluentMaterial;
  8294. /**
  8295. * Gets the plate material used by this button
  8296. */
  8297. get plateMaterial(): BABYLON.StandardMaterial;
  8298. /**
  8299. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  8300. */
  8301. get shareMaterials(): boolean;
  8302. /**
  8303. * Creates a new button
  8304. * @param name defines the control name
  8305. */
  8306. constructor(name?: string, shareMaterials?: boolean);
  8307. protected _getTypeName(): string;
  8308. private _rebuildContent;
  8309. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8310. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  8311. private _createBackMaterial;
  8312. private _createFrontMaterial;
  8313. private _createPlateMaterial;
  8314. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  8315. /**
  8316. * Releases all associated resources
  8317. */
  8318. dispose(): void;
  8319. }
  8320. }
  8321. declare module BABYLON.GUI {
  8322. /**
  8323. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  8324. */
  8325. export class MeshButton3D extends Button3D {
  8326. /** @hidden */
  8327. protected _currentMesh: BABYLON.Mesh;
  8328. /**
  8329. * Creates a new 3D button based on a mesh
  8330. * @param mesh mesh to become a 3D button
  8331. * @param name defines the control name
  8332. */
  8333. constructor(mesh: BABYLON.Mesh, name?: string);
  8334. protected _getTypeName(): string;
  8335. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8336. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  8337. }
  8338. }
  8339. declare module BABYLON.GUI {
  8340. /**
  8341. * Class used to create a container panel deployed on the surface of a plane
  8342. */
  8343. export class PlanePanel extends VolumeBasedPanel {
  8344. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8345. }
  8346. }
  8347. declare module BABYLON.GUI {
  8348. /**
  8349. * Class used to create a container panel where items get randomized planar mapping
  8350. */
  8351. export class ScatterPanel extends VolumeBasedPanel {
  8352. private _iteration;
  8353. /**
  8354. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  8355. */
  8356. get iteration(): BABYLON.float;
  8357. set iteration(value: BABYLON.float);
  8358. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8359. private _scatterMapping;
  8360. protected _finalProcessing(): void;
  8361. }
  8362. }
  8363. declare module BABYLON.GUI {
  8364. /**
  8365. * Class used to create a container panel deployed on the surface of a sphere
  8366. */
  8367. export class SpherePanel extends VolumeBasedPanel {
  8368. private _radius;
  8369. /**
  8370. * Gets or sets the radius of the sphere where to project controls (5 by default)
  8371. */
  8372. get radius(): BABYLON.float;
  8373. set radius(value: BABYLON.float);
  8374. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8375. private _sphericalMapping;
  8376. }
  8377. }
  8378. declare module BABYLON.GUI {
  8379. /**
  8380. * Class used to create a stack panel in 3D on XY plane
  8381. */
  8382. export class StackPanel3D extends Container3D {
  8383. private _isVertical;
  8384. /**
  8385. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  8386. */
  8387. get isVertical(): boolean;
  8388. set isVertical(value: boolean);
  8389. /**
  8390. * Gets or sets the distance between elements
  8391. */
  8392. margin: number;
  8393. /**
  8394. * Creates new StackPanel
  8395. * @param isVertical
  8396. */
  8397. constructor(isVertical?: boolean);
  8398. protected _arrangeChildren(): void;
  8399. }
  8400. }