babylon.gui.module.d.ts 342 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352
  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 _barBackgroundImage;
  3148. private _barSize;
  3149. private _window;
  3150. private _pointerIsOver;
  3151. private _wheelPrecision;
  3152. private _onPointerObserver;
  3153. private _clientWidth;
  3154. private _clientHeight;
  3155. private _useImageBar;
  3156. private _thumbLength;
  3157. private _thumbHeight;
  3158. private _barImageHeight;
  3159. /**
  3160. * Gets the horizontal scrollbar
  3161. */
  3162. get horizontalBar(): ScrollBar | ImageScrollBar;
  3163. /**
  3164. * Gets the vertical scrollbar
  3165. */
  3166. get verticalBar(): ScrollBar | ImageScrollBar;
  3167. /**
  3168. * Adds a new control to the current container
  3169. * @param control defines the control to add
  3170. * @returns the current container
  3171. */
  3172. addControl(control: Nullable<Control>): Container;
  3173. /**
  3174. * Removes a control from the current container
  3175. * @param control defines the control to remove
  3176. * @returns the current container
  3177. */
  3178. removeControl(control: Control): Container;
  3179. /** Gets the list of children */
  3180. get children(): Control[];
  3181. _flagDescendantsAsMatrixDirty(): void;
  3182. /**
  3183. * Freezes or unfreezes the controls in the window.
  3184. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  3185. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  3186. */
  3187. get freezeControls(): boolean;
  3188. set freezeControls(value: boolean);
  3189. /** Gets the bucket width */
  3190. get bucketWidth(): number;
  3191. /** Gets the bucket height */
  3192. get bucketHeight(): number;
  3193. /**
  3194. * Sets the bucket sizes.
  3195. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  3196. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  3197. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  3198. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  3199. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  3200. * used), that's why it is not enabled by default.
  3201. * @param width width of the bucket
  3202. * @param height height of the bucket
  3203. */
  3204. setBucketSizes(width: number, height: number): void;
  3205. private _forceHorizontalBar;
  3206. private _forceVerticalBar;
  3207. /**
  3208. * Forces the horizontal scroll bar to be displayed
  3209. */
  3210. get forceHorizontalBar(): boolean;
  3211. set forceHorizontalBar(value: boolean);
  3212. /**
  3213. * Forces the vertical scroll bar to be displayed
  3214. */
  3215. get forceVerticalBar(): boolean;
  3216. set forceVerticalBar(value: boolean);
  3217. /**
  3218. * Creates a new ScrollViewer
  3219. * @param name of ScrollViewer
  3220. */
  3221. constructor(name?: string, isImageBased?: boolean);
  3222. /** Reset the scroll viewer window to initial size */
  3223. resetWindow(): void;
  3224. protected _getTypeName(): string;
  3225. private _buildClientSizes;
  3226. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3227. protected _postMeasure(): void;
  3228. /**
  3229. * Gets or sets the mouse wheel precision
  3230. * from 0 to 1 with a default value of 0.05
  3231. * */
  3232. get wheelPrecision(): number;
  3233. set wheelPrecision(value: number);
  3234. /** Gets or sets the scroll bar container background color */
  3235. get scrollBackground(): string;
  3236. set scrollBackground(color: string);
  3237. /** Gets or sets the bar color */
  3238. get barColor(): string;
  3239. set barColor(color: string);
  3240. /** Gets or sets the bar image */
  3241. get thumbImage(): Image;
  3242. set thumbImage(value: Image);
  3243. /** Gets or sets the size of the bar */
  3244. get barSize(): number;
  3245. set barSize(value: number);
  3246. /** Gets or sets the length of the thumb */
  3247. get thumbLength(): number;
  3248. set thumbLength(value: number);
  3249. /** Gets or sets the height of the thumb */
  3250. get thumbHeight(): number;
  3251. set thumbHeight(value: number);
  3252. /** Gets or sets the height of the bar image */
  3253. get barImageHeight(): number;
  3254. set barImageHeight(value: number);
  3255. /** Gets or sets the bar background */
  3256. get barBackground(): string;
  3257. set barBackground(color: string);
  3258. /** Gets or sets the bar background image */
  3259. get barImage(): Image;
  3260. set barImage(value: Image);
  3261. private _setWindowPosition;
  3262. /** @hidden */
  3263. private _updateScroller;
  3264. _link(host: AdvancedDynamicTexture): void;
  3265. /** @hidden */
  3266. private _addBar;
  3267. /** @hidden */
  3268. private _attachWheel;
  3269. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  3270. /** Releases associated resources */
  3271. dispose(): void;
  3272. }
  3273. }
  3274. declare module "babylonjs-gui/2D/controls/displayGrid" {
  3275. import { Control } from "babylonjs-gui/2D/controls/control";
  3276. import { Nullable } from 'babylonjs/types';
  3277. import { Measure } from "babylonjs-gui/2D/measure";
  3278. /** Class used to render a grid */
  3279. export class DisplayGrid extends Control {
  3280. name?: string | undefined;
  3281. private _cellWidth;
  3282. private _cellHeight;
  3283. private _minorLineTickness;
  3284. private _minorLineColor;
  3285. private _majorLineTickness;
  3286. private _majorLineColor;
  3287. private _majorLineFrequency;
  3288. private _background;
  3289. private _displayMajorLines;
  3290. private _displayMinorLines;
  3291. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  3292. get displayMinorLines(): boolean;
  3293. set displayMinorLines(value: boolean);
  3294. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  3295. get displayMajorLines(): boolean;
  3296. set displayMajorLines(value: boolean);
  3297. /** Gets or sets background color (Black by default) */
  3298. get background(): string;
  3299. set background(value: string);
  3300. /** Gets or sets the width of each cell (20 by default) */
  3301. get cellWidth(): number;
  3302. set cellWidth(value: number);
  3303. /** Gets or sets the height of each cell (20 by default) */
  3304. get cellHeight(): number;
  3305. set cellHeight(value: number);
  3306. /** Gets or sets the tickness of minor lines (1 by default) */
  3307. get minorLineTickness(): number;
  3308. set minorLineTickness(value: number);
  3309. /** Gets or sets the color of minor lines (DarkGray by default) */
  3310. get minorLineColor(): string;
  3311. set minorLineColor(value: string);
  3312. /** Gets or sets the tickness of major lines (2 by default) */
  3313. get majorLineTickness(): number;
  3314. set majorLineTickness(value: number);
  3315. /** Gets or sets the color of major lines (White by default) */
  3316. get majorLineColor(): string;
  3317. set majorLineColor(value: string);
  3318. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  3319. get majorLineFrequency(): number;
  3320. set majorLineFrequency(value: number);
  3321. /**
  3322. * Creates a new GridDisplayRectangle
  3323. * @param name defines the control name
  3324. */
  3325. constructor(name?: string | undefined);
  3326. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  3327. protected _getTypeName(): string;
  3328. }
  3329. }
  3330. declare module "babylonjs-gui/2D/controls/sliders/imageBasedSlider" {
  3331. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3332. import { Measure } from "babylonjs-gui/2D/measure";
  3333. import { Image } from "babylonjs-gui/2D/controls/image";
  3334. import { Nullable } from 'babylonjs/types';
  3335. /**
  3336. * Class used to create slider controls based on images
  3337. */
  3338. export class ImageBasedSlider extends BaseSlider {
  3339. name?: string | undefined;
  3340. private _backgroundImage;
  3341. private _thumbImage;
  3342. private _valueBarImage;
  3343. private _tempMeasure;
  3344. get displayThumb(): boolean;
  3345. set displayThumb(value: boolean);
  3346. /**
  3347. * Gets or sets the image used to render the background
  3348. */
  3349. get backgroundImage(): Image;
  3350. set backgroundImage(value: Image);
  3351. /**
  3352. * Gets or sets the image used to render the value bar
  3353. */
  3354. get valueBarImage(): Image;
  3355. set valueBarImage(value: Image);
  3356. /**
  3357. * Gets or sets the image used to render the thumb
  3358. */
  3359. get thumbImage(): Image;
  3360. set thumbImage(value: Image);
  3361. /**
  3362. * Creates a new ImageBasedSlider
  3363. * @param name defines the control name
  3364. */
  3365. constructor(name?: string | undefined);
  3366. protected _getTypeName(): string;
  3367. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Nullable<Measure>): void;
  3368. }
  3369. }
  3370. declare module "babylonjs-gui/2D/controls/statics" {
  3371. /**
  3372. * Forcing an export so that this code will execute
  3373. * @hidden
  3374. */
  3375. const name = "Statics";
  3376. export { name };
  3377. }
  3378. declare module "babylonjs-gui/2D/controls/index" {
  3379. export * from "babylonjs-gui/2D/controls/button";
  3380. export * from "babylonjs-gui/2D/controls/checkbox";
  3381. export * from "babylonjs-gui/2D/controls/colorpicker";
  3382. export * from "babylonjs-gui/2D/controls/container";
  3383. export * from "babylonjs-gui/2D/controls/control";
  3384. export * from "babylonjs-gui/2D/controls/ellipse";
  3385. export * from "babylonjs-gui/2D/controls/grid";
  3386. export * from "babylonjs-gui/2D/controls/image";
  3387. export * from "babylonjs-gui/2D/controls/inputText";
  3388. export * from "babylonjs-gui/2D/controls/inputPassword";
  3389. export * from "babylonjs-gui/2D/controls/line";
  3390. export * from "babylonjs-gui/2D/controls/multiLine";
  3391. export * from "babylonjs-gui/2D/controls/radioButton";
  3392. export * from "babylonjs-gui/2D/controls/stackPanel";
  3393. export * from "babylonjs-gui/2D/controls/selector";
  3394. export * from "babylonjs-gui/2D/controls/scrollViewers/scrollViewer";
  3395. export * from "babylonjs-gui/2D/controls/textBlock";
  3396. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  3397. export * from "babylonjs-gui/2D/controls/rectangle";
  3398. export * from "babylonjs-gui/2D/controls/displayGrid";
  3399. export * from "babylonjs-gui/2D/controls/sliders/baseSlider";
  3400. export * from "babylonjs-gui/2D/controls/sliders/slider";
  3401. export * from "babylonjs-gui/2D/controls/sliders/imageBasedSlider";
  3402. export * from "babylonjs-gui/2D/controls/sliders/scrollBar";
  3403. export * from "babylonjs-gui/2D/controls/sliders/imageScrollBar";
  3404. export * from "babylonjs-gui/2D/controls/statics";
  3405. }
  3406. declare module "babylonjs-gui/2D/adtInstrumentation" {
  3407. import { PerfCounter } from "babylonjs/Misc/perfCounter";
  3408. import { IDisposable } from "babylonjs/scene";
  3409. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3410. /**
  3411. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  3412. */
  3413. export class AdvancedDynamicTextureInstrumentation implements IDisposable {
  3414. /**
  3415. * Define the instrumented AdvancedDynamicTexture.
  3416. */
  3417. texture: AdvancedDynamicTexture;
  3418. private _captureRenderTime;
  3419. private _renderTime;
  3420. private _captureLayoutTime;
  3421. private _layoutTime;
  3422. private _onBeginRenderObserver;
  3423. private _onEndRenderObserver;
  3424. private _onBeginLayoutObserver;
  3425. private _onEndLayoutObserver;
  3426. /**
  3427. * Gets the perf counter used to capture render time
  3428. */
  3429. get renderTimeCounter(): PerfCounter;
  3430. /**
  3431. * Gets the perf counter used to capture layout time
  3432. */
  3433. get layoutTimeCounter(): PerfCounter;
  3434. /**
  3435. * Enable or disable the render time capture
  3436. */
  3437. get captureRenderTime(): boolean;
  3438. set captureRenderTime(value: boolean);
  3439. /**
  3440. * Enable or disable the layout time capture
  3441. */
  3442. get captureLayoutTime(): boolean;
  3443. set captureLayoutTime(value: boolean);
  3444. /**
  3445. * Instantiates a new advanced dynamic texture instrumentation.
  3446. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  3447. * @param texture Defines the AdvancedDynamicTexture to instrument
  3448. */
  3449. constructor(
  3450. /**
  3451. * Define the instrumented AdvancedDynamicTexture.
  3452. */
  3453. texture: AdvancedDynamicTexture);
  3454. /**
  3455. * Dispose and release associated resources.
  3456. */
  3457. dispose(): void;
  3458. }
  3459. }
  3460. declare module "babylonjs-gui/2D/xmlLoader" {
  3461. /**
  3462. * Class used to load GUI via XML.
  3463. */
  3464. export class XmlLoader {
  3465. private _nodes;
  3466. private _nodeTypes;
  3467. private _isLoaded;
  3468. private _objectAttributes;
  3469. private _parentClass;
  3470. /**
  3471. * Create a new xml loader
  3472. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  3473. */
  3474. constructor(parentClass?: null);
  3475. private _getChainElement;
  3476. private _getClassAttribute;
  3477. private _createGuiElement;
  3478. private _parseGrid;
  3479. private _parseElement;
  3480. private _prepareSourceElement;
  3481. private _parseElementsFromSource;
  3482. private _parseXml;
  3483. /**
  3484. * Gets if the loading has finished.
  3485. * @returns whether the loading has finished or not
  3486. */
  3487. isLoaded(): boolean;
  3488. /**
  3489. * Gets a loaded node / control by id.
  3490. * @param id the Controls id set in the xml
  3491. * @returns element of type Control
  3492. */
  3493. getNodeById(id: string): any;
  3494. /**
  3495. * Gets all loaded nodes / controls
  3496. * @returns Array of controls
  3497. */
  3498. getNodes(): any;
  3499. /**
  3500. * Initiates the xml layout loading
  3501. * @param xmlFile defines the xml layout to load
  3502. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  3503. * @param callback defines the callback called on layout load.
  3504. */
  3505. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  3506. }
  3507. }
  3508. declare module "babylonjs-gui/2D/index" {
  3509. export * from "babylonjs-gui/2D/controls/index";
  3510. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  3511. export * from "babylonjs-gui/2D/adtInstrumentation";
  3512. export * from "babylonjs-gui/2D/math2D";
  3513. export * from "babylonjs-gui/2D/measure";
  3514. export * from "babylonjs-gui/2D/multiLinePoint";
  3515. export * from "babylonjs-gui/2D/style";
  3516. export * from "babylonjs-gui/2D/valueAndUnit";
  3517. export * from "babylonjs-gui/2D/xmlLoader";
  3518. }
  3519. declare module "babylonjs-gui/3D/controls/container3D" {
  3520. import { Nullable } from "babylonjs/types";
  3521. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3522. import { Scene } from "babylonjs/scene";
  3523. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3524. /**
  3525. * Class used to create containers for controls
  3526. */
  3527. export class Container3D extends Control3D {
  3528. private _blockLayout;
  3529. /**
  3530. * Gets the list of child controls
  3531. */
  3532. protected _children: Control3D[];
  3533. /**
  3534. * Gets the list of child controls
  3535. */
  3536. get children(): Array<Control3D>;
  3537. /**
  3538. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  3539. * This is helpful to optimize layout operation when adding multiple children in a row
  3540. */
  3541. get blockLayout(): boolean;
  3542. set blockLayout(value: boolean);
  3543. /**
  3544. * Creates a new container
  3545. * @param name defines the container name
  3546. */
  3547. constructor(name?: string);
  3548. /**
  3549. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  3550. * @returns the current container
  3551. */
  3552. updateLayout(): Container3D;
  3553. /**
  3554. * Gets a boolean indicating if the given control is in the children of this control
  3555. * @param control defines the control to check
  3556. * @returns true if the control is in the child list
  3557. */
  3558. containsControl(control: Control3D): boolean;
  3559. /**
  3560. * Adds a control to the children of this control
  3561. * @param control defines the control to add
  3562. * @returns the current container
  3563. */
  3564. addControl(control: Control3D): Container3D;
  3565. /**
  3566. * This function will be called everytime a new control is added
  3567. */
  3568. protected _arrangeChildren(): void;
  3569. protected _createNode(scene: Scene): Nullable<TransformNode>;
  3570. /**
  3571. * Removes a control from the children of this control
  3572. * @param control defines the control to remove
  3573. * @returns the current container
  3574. */
  3575. removeControl(control: Control3D): Container3D;
  3576. protected _getTypeName(): string;
  3577. /**
  3578. * Releases all associated resources
  3579. */
  3580. dispose(): void;
  3581. /** Control rotation will remain unchanged */
  3582. static readonly UNSET_ORIENTATION: number;
  3583. /** Control will rotate to make it look at sphere central axis */
  3584. static readonly FACEORIGIN_ORIENTATION: number;
  3585. /** Control will rotate to make it look back at sphere central axis */
  3586. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  3587. /** Control will rotate to look at z axis (0, 0, 1) */
  3588. static readonly FACEFORWARD_ORIENTATION: number;
  3589. /** Control will rotate to look at negative z axis (0, 0, -1) */
  3590. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  3591. }
  3592. }
  3593. declare module "babylonjs-gui/3D/gui3DManager" {
  3594. import { Nullable } from "babylonjs/types";
  3595. import { Observable } from "babylonjs/Misc/observable";
  3596. import { Vector3 } from "babylonjs/Maths/math";
  3597. import { Material } from "babylonjs/Materials/material";
  3598. import { UtilityLayerRenderer } from "babylonjs/Rendering/utilityLayerRenderer";
  3599. import { IDisposable, Scene } from "babylonjs/scene";
  3600. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3601. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3602. /**
  3603. * Class used to manage 3D user interface
  3604. * @see http://doc.babylonjs.com/how_to/gui3d
  3605. */
  3606. export class GUI3DManager implements IDisposable {
  3607. private _scene;
  3608. private _sceneDisposeObserver;
  3609. private _utilityLayer;
  3610. private _rootContainer;
  3611. private _pointerObserver;
  3612. private _pointerOutObserver;
  3613. /** @hidden */
  3614. _lastPickedControl: Control3D;
  3615. /** @hidden */
  3616. _lastControlOver: {
  3617. [pointerId: number]: Control3D;
  3618. };
  3619. /** @hidden */
  3620. _lastControlDown: {
  3621. [pointerId: number]: Control3D;
  3622. };
  3623. /**
  3624. * Observable raised when the point picked by the pointer events changed
  3625. */
  3626. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  3627. /** @hidden */
  3628. _sharedMaterials: {
  3629. [key: string]: Material;
  3630. };
  3631. /** Gets the hosting scene */
  3632. get scene(): Scene;
  3633. /** Gets associated utility layer */
  3634. get utilityLayer(): Nullable<UtilityLayerRenderer>;
  3635. /**
  3636. * Creates a new GUI3DManager
  3637. * @param scene
  3638. */
  3639. constructor(scene?: Scene);
  3640. private _handlePointerOut;
  3641. private _doPicking;
  3642. /**
  3643. * Gets the root container
  3644. */
  3645. get rootContainer(): Container3D;
  3646. /**
  3647. * Gets a boolean indicating if the given control is in the root child list
  3648. * @param control defines the control to check
  3649. * @returns true if the control is in the root child list
  3650. */
  3651. containsControl(control: Control3D): boolean;
  3652. /**
  3653. * Adds a control to the root child list
  3654. * @param control defines the control to add
  3655. * @returns the current manager
  3656. */
  3657. addControl(control: Control3D): GUI3DManager;
  3658. /**
  3659. * Removes a control from the root child list
  3660. * @param control defines the control to remove
  3661. * @returns the current container
  3662. */
  3663. removeControl(control: Control3D): GUI3DManager;
  3664. /**
  3665. * Releases all associated resources
  3666. */
  3667. dispose(): void;
  3668. }
  3669. }
  3670. declare module "babylonjs-gui/3D/vector3WithInfo" {
  3671. import { Vector3 } from "babylonjs/Maths/math";
  3672. /**
  3673. * Class used to transport Vector3 information for pointer events
  3674. */
  3675. export class Vector3WithInfo extends Vector3 {
  3676. /** defines the current mouse button index */
  3677. buttonIndex: number;
  3678. /**
  3679. * Creates a new Vector3WithInfo
  3680. * @param source defines the vector3 data to transport
  3681. * @param buttonIndex defines the current mouse button index
  3682. */
  3683. constructor(source: Vector3,
  3684. /** defines the current mouse button index */
  3685. buttonIndex?: number);
  3686. }
  3687. }
  3688. declare module "babylonjs-gui/3D/controls/control3D" {
  3689. import { Nullable } from "babylonjs/types";
  3690. import { Observable } from "babylonjs/Misc/observable";
  3691. import { Vector3 } from "babylonjs/Maths/math";
  3692. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3693. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  3694. import { IBehaviorAware, Behavior } from "babylonjs/Behaviors/behavior";
  3695. import { IDisposable, Scene } from "babylonjs/scene";
  3696. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  3697. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  3698. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3699. /**
  3700. * Class used as base class for controls
  3701. */
  3702. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  3703. /** Defines the control name */
  3704. name?: string | undefined;
  3705. /** @hidden */
  3706. _host: GUI3DManager;
  3707. private _node;
  3708. private _downCount;
  3709. private _enterCount;
  3710. private _downPointerIds;
  3711. private _isVisible;
  3712. /** Gets or sets the control position in world space */
  3713. get position(): Vector3;
  3714. set position(value: Vector3);
  3715. /** Gets or sets the control scaling in world space */
  3716. get scaling(): Vector3;
  3717. set scaling(value: Vector3);
  3718. /** Callback used to start pointer enter animation */
  3719. pointerEnterAnimation: () => void;
  3720. /** Callback used to start pointer out animation */
  3721. pointerOutAnimation: () => void;
  3722. /** Callback used to start pointer down animation */
  3723. pointerDownAnimation: () => void;
  3724. /** Callback used to start pointer up animation */
  3725. pointerUpAnimation: () => void;
  3726. /**
  3727. * An event triggered when the pointer move over the control
  3728. */
  3729. onPointerMoveObservable: Observable<Vector3>;
  3730. /**
  3731. * An event triggered when the pointer move out of the control
  3732. */
  3733. onPointerOutObservable: Observable<Control3D>;
  3734. /**
  3735. * An event triggered when the pointer taps the control
  3736. */
  3737. onPointerDownObservable: Observable<Vector3WithInfo>;
  3738. /**
  3739. * An event triggered when pointer is up
  3740. */
  3741. onPointerUpObservable: Observable<Vector3WithInfo>;
  3742. /**
  3743. * An event triggered when a control is clicked on (with a mouse)
  3744. */
  3745. onPointerClickObservable: Observable<Vector3WithInfo>;
  3746. /**
  3747. * An event triggered when pointer enters the control
  3748. */
  3749. onPointerEnterObservable: Observable<Control3D>;
  3750. /**
  3751. * Gets or sets the parent container
  3752. */
  3753. parent: Nullable<Container3D>;
  3754. private _behaviors;
  3755. /**
  3756. * Gets the list of attached behaviors
  3757. * @see http://doc.babylonjs.com/features/behaviour
  3758. */
  3759. get behaviors(): Behavior<Control3D>[];
  3760. /**
  3761. * Attach a behavior to the control
  3762. * @see http://doc.babylonjs.com/features/behaviour
  3763. * @param behavior defines the behavior to attach
  3764. * @returns the current control
  3765. */
  3766. addBehavior(behavior: Behavior<Control3D>): Control3D;
  3767. /**
  3768. * Remove an attached behavior
  3769. * @see http://doc.babylonjs.com/features/behaviour
  3770. * @param behavior defines the behavior to attach
  3771. * @returns the current control
  3772. */
  3773. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  3774. /**
  3775. * Gets an attached behavior by name
  3776. * @param name defines the name of the behavior to look for
  3777. * @see http://doc.babylonjs.com/features/behaviour
  3778. * @returns null if behavior was not found else the requested behavior
  3779. */
  3780. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  3781. /** Gets or sets a boolean indicating if the control is visible */
  3782. get isVisible(): boolean;
  3783. set isVisible(value: boolean);
  3784. /**
  3785. * Creates a new control
  3786. * @param name defines the control name
  3787. */
  3788. constructor(
  3789. /** Defines the control name */
  3790. name?: string | undefined);
  3791. /**
  3792. * Gets a string representing the class name
  3793. */
  3794. get typeName(): string;
  3795. /**
  3796. * Get the current class name of the control.
  3797. * @returns current class name
  3798. */
  3799. getClassName(): string;
  3800. protected _getTypeName(): string;
  3801. /**
  3802. * Gets the transform node used by this control
  3803. */
  3804. get node(): Nullable<TransformNode>;
  3805. /**
  3806. * Gets the mesh used to render this control
  3807. */
  3808. get mesh(): Nullable<AbstractMesh>;
  3809. /**
  3810. * Link the control as child of the given node
  3811. * @param node defines the node to link to. Use null to unlink the control
  3812. * @returns the current control
  3813. */
  3814. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  3815. /** @hidden **/
  3816. _prepareNode(scene: Scene): void;
  3817. /**
  3818. * Node creation.
  3819. * Can be overriden by children
  3820. * @param scene defines the scene where the node must be attached
  3821. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  3822. */
  3823. protected _createNode(scene: Scene): Nullable<TransformNode>;
  3824. /**
  3825. * Affect a material to the given mesh
  3826. * @param mesh defines the mesh which will represent the control
  3827. */
  3828. protected _affectMaterial(mesh: AbstractMesh): void;
  3829. /** @hidden */
  3830. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  3831. /** @hidden */
  3832. _onPointerEnter(target: Control3D): boolean;
  3833. /** @hidden */
  3834. _onPointerOut(target: Control3D): void;
  3835. /** @hidden */
  3836. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  3837. /** @hidden */
  3838. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3839. /** @hidden */
  3840. forcePointerUp(pointerId?: Nullable<number>): void;
  3841. /** @hidden */
  3842. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  3843. /** @hidden */
  3844. _disposeNode(): void;
  3845. /**
  3846. * Releases all associated resources
  3847. */
  3848. dispose(): void;
  3849. }
  3850. }
  3851. declare module "babylonjs-gui/3D/controls/abstractButton3D" {
  3852. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3853. import { Scene } from "babylonjs/scene";
  3854. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3855. /**
  3856. * Class used as a root to all buttons
  3857. */
  3858. export class AbstractButton3D extends Control3D {
  3859. /**
  3860. * Creates a new button
  3861. * @param name defines the control name
  3862. */
  3863. constructor(name?: string);
  3864. protected _getTypeName(): string;
  3865. protected _createNode(scene: Scene): TransformNode;
  3866. }
  3867. }
  3868. declare module "babylonjs-gui/3D/controls/button3D" {
  3869. import { int } from "babylonjs/types";
  3870. import { TransformNode } from "babylonjs/Meshes/transformNode";
  3871. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  3872. import { Material } from "babylonjs/Materials/material";
  3873. import { Scene } from "babylonjs/scene";
  3874. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  3875. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  3876. import { Control } from "babylonjs-gui/2D/controls/control";
  3877. /**
  3878. * Class used to create a button in 3D
  3879. */
  3880. export class Button3D extends AbstractButton3D {
  3881. /** @hidden */
  3882. protected _currentMaterial: Material;
  3883. private _facadeTexture;
  3884. private _content;
  3885. private _contentResolution;
  3886. private _contentScaleRatio;
  3887. /**
  3888. * Gets or sets the texture resolution used to render content (512 by default)
  3889. */
  3890. get contentResolution(): int;
  3891. set contentResolution(value: int);
  3892. /**
  3893. * Gets or sets the texture scale ratio used to render content (2 by default)
  3894. */
  3895. get contentScaleRatio(): number;
  3896. set contentScaleRatio(value: number);
  3897. protected _disposeFacadeTexture(): void;
  3898. protected _resetContent(): void;
  3899. /**
  3900. * Creates a new button
  3901. * @param name defines the control name
  3902. */
  3903. constructor(name?: string);
  3904. /**
  3905. * Gets or sets the GUI 2D content used to display the button's facade
  3906. */
  3907. get content(): Control;
  3908. set content(value: Control);
  3909. /**
  3910. * Apply the facade texture (created from the content property).
  3911. * This function can be overloaded by child classes
  3912. * @param facadeTexture defines the AdvancedDynamicTexture to use
  3913. */
  3914. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  3915. protected _getTypeName(): string;
  3916. protected _createNode(scene: Scene): TransformNode;
  3917. protected _affectMaterial(mesh: AbstractMesh): void;
  3918. /**
  3919. * Releases all associated resources
  3920. */
  3921. dispose(): void;
  3922. }
  3923. }
  3924. declare module "babylonjs-gui/3D/controls/volumeBasedPanel" {
  3925. import { Vector3 } from "babylonjs/Maths/math.vector";
  3926. import { int } from "babylonjs/types";
  3927. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3928. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3929. /**
  3930. * Abstract class used to create a container panel deployed on the surface of a volume
  3931. */
  3932. export abstract class VolumeBasedPanel extends Container3D {
  3933. private _columns;
  3934. private _rows;
  3935. private _rowThenColum;
  3936. private _orientation;
  3937. protected _cellWidth: number;
  3938. protected _cellHeight: number;
  3939. /**
  3940. * Gets or sets the distance between elements
  3941. */
  3942. margin: number;
  3943. /**
  3944. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  3945. * | Value | Type | Description |
  3946. * | ----- | ----------------------------------- | ----------- |
  3947. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  3948. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  3949. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  3950. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  3951. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  3952. */
  3953. get orientation(): number;
  3954. set orientation(value: number);
  3955. /**
  3956. * Gets or sets the number of columns requested (10 by default).
  3957. * The panel will automatically compute the number of rows based on number of child controls.
  3958. */
  3959. get columns(): int;
  3960. set columns(value: int);
  3961. /**
  3962. * Gets or sets a the number of rows requested.
  3963. * The panel will automatically compute the number of columns based on number of child controls.
  3964. */
  3965. get rows(): int;
  3966. set rows(value: int);
  3967. /**
  3968. * Creates new VolumeBasedPanel
  3969. */
  3970. constructor();
  3971. protected _arrangeChildren(): void;
  3972. /** Child classes must implement this function to provide correct control positioning */
  3973. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  3974. /** Child classes can implement this function to provide additional processing */
  3975. protected _finalProcessing(): void;
  3976. }
  3977. }
  3978. declare module "babylonjs-gui/3D/controls/cylinderPanel" {
  3979. import { Vector3 } from "babylonjs/Maths/math.vector";
  3980. import { float } from "babylonjs/types";
  3981. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  3982. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3983. /**
  3984. * Class used to create a container panel deployed on the surface of a cylinder
  3985. */
  3986. export class CylinderPanel extends VolumeBasedPanel {
  3987. private _radius;
  3988. /**
  3989. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  3990. */
  3991. get radius(): float;
  3992. set radius(value: float);
  3993. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  3994. private _cylindricalMapping;
  3995. }
  3996. }
  3997. declare module "babylonjs-gui/3D/materials/shaders/fluent.vertex" {
  3998. /** @hidden */
  3999. export var fluentVertexShader: {
  4000. name: string;
  4001. shader: string;
  4002. };
  4003. }
  4004. declare module "babylonjs-gui/3D/materials/shaders/fluent.fragment" {
  4005. /** @hidden */
  4006. export var fluentPixelShader: {
  4007. name: string;
  4008. shader: string;
  4009. };
  4010. }
  4011. declare module "babylonjs-gui/3D/materials/fluentMaterial" {
  4012. import { Nullable } from "babylonjs/types";
  4013. import { Color3, Vector3, Color4, Matrix } from "babylonjs/Maths/math";
  4014. import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
  4015. import { MaterialDefines } from "babylonjs/Materials/materialDefines";
  4016. import { PushMaterial } from "babylonjs/Materials/pushMaterial";
  4017. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4018. import { SubMesh } from "babylonjs/Meshes/subMesh";
  4019. import { Mesh } from "babylonjs/Meshes/mesh";
  4020. import { Scene } from "babylonjs/scene";
  4021. import "babylonjs-gui/3D/materials/shaders/fluent.vertex";
  4022. import "babylonjs-gui/3D/materials/shaders/fluent.fragment";
  4023. /** @hidden */
  4024. export class FluentMaterialDefines extends MaterialDefines {
  4025. INNERGLOW: boolean;
  4026. BORDER: boolean;
  4027. HOVERLIGHT: boolean;
  4028. TEXTURE: boolean;
  4029. constructor();
  4030. }
  4031. /**
  4032. * Class used to render controls with fluent desgin
  4033. */
  4034. export class FluentMaterial extends PushMaterial {
  4035. /**
  4036. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  4037. */
  4038. innerGlowColorIntensity: number;
  4039. /**
  4040. * Gets or sets the inner glow color (white by default)
  4041. */
  4042. innerGlowColor: Color3;
  4043. /**
  4044. * Gets or sets alpha value (default is 1.0)
  4045. */
  4046. alpha: number;
  4047. /**
  4048. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  4049. */
  4050. albedoColor: Color3;
  4051. /**
  4052. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  4053. */
  4054. renderBorders: boolean;
  4055. /**
  4056. * Gets or sets border width (default is 0.5)
  4057. */
  4058. borderWidth: number;
  4059. /**
  4060. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  4061. */
  4062. edgeSmoothingValue: number;
  4063. /**
  4064. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  4065. */
  4066. borderMinValue: number;
  4067. /**
  4068. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  4069. */
  4070. renderHoverLight: boolean;
  4071. /**
  4072. * Gets or sets the radius used to render the hover light (default is 1.0)
  4073. */
  4074. hoverRadius: number;
  4075. /**
  4076. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  4077. */
  4078. hoverColor: Color4;
  4079. /**
  4080. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  4081. */
  4082. hoverPosition: Vector3;
  4083. private _albedoTexture;
  4084. /** Gets or sets the texture to use for albedo color */
  4085. albedoTexture: Nullable<BaseTexture>;
  4086. /**
  4087. * Creates a new Fluent material
  4088. * @param name defines the name of the material
  4089. * @param scene defines the hosting scene
  4090. */
  4091. constructor(name: string, scene: Scene);
  4092. needAlphaBlending(): boolean;
  4093. needAlphaTesting(): boolean;
  4094. getAlphaTestTexture(): Nullable<BaseTexture>;
  4095. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  4096. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  4097. getActiveTextures(): BaseTexture[];
  4098. hasTexture(texture: BaseTexture): boolean;
  4099. dispose(forceDisposeEffect?: boolean): void;
  4100. clone(name: string): FluentMaterial;
  4101. serialize(): any;
  4102. getClassName(): string;
  4103. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  4104. }
  4105. }
  4106. declare module "babylonjs-gui/3D/controls/holographicButton" {
  4107. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  4108. import { Nullable } from "babylonjs/types";
  4109. import { StandardMaterial } from "babylonjs/Materials/standardMaterial";
  4110. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4111. import { Mesh } from "babylonjs/Meshes/mesh";
  4112. import { Scene } from "babylonjs/scene";
  4113. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  4114. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  4115. /**
  4116. * Class used to create a holographic button in 3D
  4117. */
  4118. export class HolographicButton extends Button3D {
  4119. private _backPlate;
  4120. private _textPlate;
  4121. private _frontPlate;
  4122. private _text;
  4123. private _imageUrl;
  4124. private _shareMaterials;
  4125. private _frontMaterial;
  4126. private _backMaterial;
  4127. private _plateMaterial;
  4128. private _pickedPointObserver;
  4129. private _tooltipFade;
  4130. private _tooltipTextBlock;
  4131. private _tooltipTexture;
  4132. private _tooltipMesh;
  4133. private _tooltipHoverObserver;
  4134. private _tooltipOutObserver;
  4135. private _disposeTooltip;
  4136. /**
  4137. * Rendering ground id of all the mesh in the button
  4138. */
  4139. set renderingGroupId(id: number);
  4140. get renderingGroupId(): number;
  4141. /**
  4142. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4143. */
  4144. set tooltipText(text: Nullable<string>);
  4145. get tooltipText(): Nullable<string>;
  4146. /**
  4147. * Gets or sets text for the button
  4148. */
  4149. get text(): string;
  4150. set text(value: string);
  4151. /**
  4152. * Gets or sets the image url for the button
  4153. */
  4154. get imageUrl(): string;
  4155. set imageUrl(value: string);
  4156. /**
  4157. * Gets the back material used by this button
  4158. */
  4159. get backMaterial(): FluentMaterial;
  4160. /**
  4161. * Gets the front material used by this button
  4162. */
  4163. get frontMaterial(): FluentMaterial;
  4164. /**
  4165. * Gets the plate material used by this button
  4166. */
  4167. get plateMaterial(): StandardMaterial;
  4168. /**
  4169. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4170. */
  4171. get shareMaterials(): boolean;
  4172. /**
  4173. * Creates a new button
  4174. * @param name defines the control name
  4175. */
  4176. constructor(name?: string, shareMaterials?: boolean);
  4177. protected _getTypeName(): string;
  4178. private _rebuildContent;
  4179. protected _createNode(scene: Scene): TransformNode;
  4180. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4181. private _createBackMaterial;
  4182. private _createFrontMaterial;
  4183. private _createPlateMaterial;
  4184. protected _affectMaterial(mesh: Mesh): void;
  4185. /**
  4186. * Releases all associated resources
  4187. */
  4188. dispose(): void;
  4189. }
  4190. }
  4191. declare module "babylonjs-gui/3D/controls/meshButton3D" {
  4192. import { TransformNode } from "babylonjs/Meshes/transformNode";
  4193. import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
  4194. import { Mesh } from "babylonjs/Meshes/mesh";
  4195. import { Scene } from "babylonjs/scene";
  4196. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  4197. /**
  4198. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  4199. */
  4200. export class MeshButton3D extends Button3D {
  4201. /** @hidden */
  4202. protected _currentMesh: Mesh;
  4203. /**
  4204. * Creates a new 3D button based on a mesh
  4205. * @param mesh mesh to become a 3D button
  4206. * @param name defines the control name
  4207. */
  4208. constructor(mesh: Mesh, name?: string);
  4209. protected _getTypeName(): string;
  4210. protected _createNode(scene: Scene): TransformNode;
  4211. protected _affectMaterial(mesh: AbstractMesh): void;
  4212. }
  4213. }
  4214. declare module "babylonjs-gui/3D/controls/planePanel" {
  4215. import { Vector3 } from "babylonjs/Maths/math";
  4216. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4217. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4218. /**
  4219. * Class used to create a container panel deployed on the surface of a plane
  4220. */
  4221. export class PlanePanel extends VolumeBasedPanel {
  4222. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4223. }
  4224. }
  4225. declare module "babylonjs-gui/3D/controls/scatterPanel" {
  4226. import { Vector3 } from "babylonjs/Maths/math";
  4227. import { float } from "babylonjs/types";
  4228. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4229. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4230. /**
  4231. * Class used to create a container panel where items get randomized planar mapping
  4232. */
  4233. export class ScatterPanel extends VolumeBasedPanel {
  4234. private _iteration;
  4235. /**
  4236. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  4237. */
  4238. get iteration(): float;
  4239. set iteration(value: float);
  4240. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4241. private _scatterMapping;
  4242. protected _finalProcessing(): void;
  4243. }
  4244. }
  4245. declare module "babylonjs-gui/3D/controls/spherePanel" {
  4246. import { Vector3 } from "babylonjs/Maths/math";
  4247. import { float } from "babylonjs/types";
  4248. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4249. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  4250. /**
  4251. * Class used to create a container panel deployed on the surface of a sphere
  4252. */
  4253. export class SpherePanel extends VolumeBasedPanel {
  4254. private _radius;
  4255. /**
  4256. * Gets or sets the radius of the sphere where to project controls (5 by default)
  4257. */
  4258. get radius(): float;
  4259. set radius(value: float);
  4260. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  4261. private _sphericalMapping;
  4262. }
  4263. }
  4264. declare module "babylonjs-gui/3D/controls/stackPanel3D" {
  4265. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  4266. /**
  4267. * Class used to create a stack panel in 3D on XY plane
  4268. */
  4269. export class StackPanel3D extends Container3D {
  4270. private _isVertical;
  4271. /**
  4272. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  4273. */
  4274. get isVertical(): boolean;
  4275. set isVertical(value: boolean);
  4276. /**
  4277. * Gets or sets the distance between elements
  4278. */
  4279. margin: number;
  4280. /**
  4281. * Creates new StackPanel
  4282. * @param isVertical
  4283. */
  4284. constructor(isVertical?: boolean);
  4285. protected _arrangeChildren(): void;
  4286. }
  4287. }
  4288. declare module "babylonjs-gui/3D/controls/index" {
  4289. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  4290. export * from "babylonjs-gui/3D/controls/button3D";
  4291. export * from "babylonjs-gui/3D/controls/container3D";
  4292. export * from "babylonjs-gui/3D/controls/control3D";
  4293. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  4294. export * from "babylonjs-gui/3D/controls/holographicButton";
  4295. export * from "babylonjs-gui/3D/controls/meshButton3D";
  4296. export * from "babylonjs-gui/3D/controls/planePanel";
  4297. export * from "babylonjs-gui/3D/controls/scatterPanel";
  4298. export * from "babylonjs-gui/3D/controls/spherePanel";
  4299. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  4300. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  4301. }
  4302. declare module "babylonjs-gui/3D/materials/index" {
  4303. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  4304. }
  4305. declare module "babylonjs-gui/3D/index" {
  4306. export * from "babylonjs-gui/3D/controls/index";
  4307. export * from "babylonjs-gui/3D/materials/index";
  4308. export * from "babylonjs-gui/3D/gui3DManager";
  4309. export * from "babylonjs-gui/3D/vector3WithInfo";
  4310. }
  4311. declare module "babylonjs-gui/index" {
  4312. export * from "babylonjs-gui/2D/index";
  4313. export * from "babylonjs-gui/3D/index";
  4314. }
  4315. declare module "babylonjs-gui/legacy/legacy" {
  4316. export * from "babylonjs-gui/index";
  4317. }
  4318. declare module "babylonjs-gui" {
  4319. export * from "babylonjs-gui/legacy/legacy";
  4320. }
  4321. declare module BABYLON.GUI {
  4322. /**
  4323. * Class used to specific a value and its associated unit
  4324. */
  4325. export class ValueAndUnit {
  4326. /** defines the unit to store */
  4327. unit: number;
  4328. /** defines a boolean indicating if the value can be negative */
  4329. negativeValueAllowed: boolean;
  4330. private _value;
  4331. private _originalUnit;
  4332. /**
  4333. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  4334. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4335. */
  4336. ignoreAdaptiveScaling: boolean;
  4337. /**
  4338. * Creates a new ValueAndUnit
  4339. * @param value defines the value to store
  4340. * @param unit defines the unit to store
  4341. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  4342. */
  4343. constructor(value: number,
  4344. /** defines the unit to store */
  4345. unit?: number,
  4346. /** defines a boolean indicating if the value can be negative */
  4347. negativeValueAllowed?: boolean);
  4348. /** Gets a boolean indicating if the value is a percentage */
  4349. get isPercentage(): boolean;
  4350. /** Gets a boolean indicating if the value is store as pixel */
  4351. get isPixel(): boolean;
  4352. /** Gets direct internal value */
  4353. get internalValue(): number;
  4354. /**
  4355. * Gets value as pixel
  4356. * @param host defines the root host
  4357. * @param refValue defines the reference value for percentages
  4358. * @returns the value as pixel
  4359. */
  4360. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  4361. /**
  4362. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  4363. * @param value defines the value to store
  4364. * @param unit defines the unit to store
  4365. * @returns the current ValueAndUnit
  4366. */
  4367. updateInPlace(value: number, unit?: number): ValueAndUnit;
  4368. /**
  4369. * Gets the value accordingly to its unit
  4370. * @param host defines the root host
  4371. * @returns the value
  4372. */
  4373. getValue(host: AdvancedDynamicTexture): number;
  4374. /**
  4375. * Gets a string representation of the value
  4376. * @param host defines the root host
  4377. * @param decimals defines an optional number of decimals to display
  4378. * @returns a string
  4379. */
  4380. toString(host: AdvancedDynamicTexture, decimals?: number): string;
  4381. /**
  4382. * Store a value parsed from a string
  4383. * @param source defines the source string
  4384. * @returns true if the value was successfully parsed
  4385. */
  4386. fromString(source: string | number): boolean;
  4387. private static _Regex;
  4388. private static _UNITMODE_PERCENTAGE;
  4389. private static _UNITMODE_PIXEL;
  4390. /** UNITMODE_PERCENTAGE */
  4391. static get UNITMODE_PERCENTAGE(): number;
  4392. /** UNITMODE_PIXEL */
  4393. static get UNITMODE_PIXEL(): number;
  4394. }
  4395. }
  4396. declare module BABYLON.GUI {
  4397. /**
  4398. * Define a style used by control to automatically setup properties based on a template.
  4399. * Only support font related properties so far
  4400. */
  4401. export class Style implements BABYLON.IDisposable {
  4402. private _fontFamily;
  4403. private _fontStyle;
  4404. private _fontWeight;
  4405. /** @hidden */
  4406. _host: AdvancedDynamicTexture;
  4407. /** @hidden */
  4408. _fontSize: ValueAndUnit;
  4409. /**
  4410. * BABYLON.Observable raised when the style values are changed
  4411. */
  4412. onChangedObservable: BABYLON.Observable<Style>;
  4413. /**
  4414. * Creates a new style object
  4415. * @param host defines the AdvancedDynamicTexture which hosts this style
  4416. */
  4417. constructor(host: AdvancedDynamicTexture);
  4418. /**
  4419. * Gets or sets the font size
  4420. */
  4421. get fontSize(): string | number;
  4422. set fontSize(value: string | number);
  4423. /**
  4424. * Gets or sets the font family
  4425. */
  4426. get fontFamily(): string;
  4427. set fontFamily(value: string);
  4428. /**
  4429. * Gets or sets the font style
  4430. */
  4431. get fontStyle(): string;
  4432. set fontStyle(value: string);
  4433. /** Gets or sets font weight */
  4434. get fontWeight(): string;
  4435. set fontWeight(value: string);
  4436. /** Dispose all associated resources */
  4437. dispose(): void;
  4438. }
  4439. }
  4440. declare module BABYLON.GUI {
  4441. /**
  4442. * Class used to transport BABYLON.Vector2 information for pointer events
  4443. */
  4444. export class Vector2WithInfo extends BABYLON.Vector2 {
  4445. /** defines the current mouse button index */
  4446. buttonIndex: number;
  4447. /**
  4448. * Creates a new Vector2WithInfo
  4449. * @param source defines the vector2 data to transport
  4450. * @param buttonIndex defines the current mouse button index
  4451. */
  4452. constructor(source: BABYLON.Vector2,
  4453. /** defines the current mouse button index */
  4454. buttonIndex?: number);
  4455. }
  4456. /** Class used to provide 2D matrix features */
  4457. export class Matrix2D {
  4458. /** Gets the internal array of 6 floats used to store matrix data */
  4459. m: Float32Array;
  4460. /**
  4461. * Creates a new matrix
  4462. * @param m00 defines value for (0, 0)
  4463. * @param m01 defines value for (0, 1)
  4464. * @param m10 defines value for (1, 0)
  4465. * @param m11 defines value for (1, 1)
  4466. * @param m20 defines value for (2, 0)
  4467. * @param m21 defines value for (2, 1)
  4468. */
  4469. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  4470. /**
  4471. * Fills the matrix from direct values
  4472. * @param m00 defines value for (0, 0)
  4473. * @param m01 defines value for (0, 1)
  4474. * @param m10 defines value for (1, 0)
  4475. * @param m11 defines value for (1, 1)
  4476. * @param m20 defines value for (2, 0)
  4477. * @param m21 defines value for (2, 1)
  4478. * @returns the current modified matrix
  4479. */
  4480. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  4481. /**
  4482. * Gets matrix determinant
  4483. * @returns the determinant
  4484. */
  4485. determinant(): number;
  4486. /**
  4487. * Inverses the matrix and stores it in a target matrix
  4488. * @param result defines the target matrix
  4489. * @returns the current matrix
  4490. */
  4491. invertToRef(result: Matrix2D): Matrix2D;
  4492. /**
  4493. * Multiplies the current matrix with another one
  4494. * @param other defines the second operand
  4495. * @param result defines the target matrix
  4496. * @returns the current matrix
  4497. */
  4498. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  4499. /**
  4500. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  4501. * @param x defines the x coordinate to transform
  4502. * @param y defines the x coordinate to transform
  4503. * @param result defines the target vector2
  4504. * @returns the current matrix
  4505. */
  4506. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  4507. /**
  4508. * Creates an identity matrix
  4509. * @returns a new matrix
  4510. */
  4511. static Identity(): Matrix2D;
  4512. /**
  4513. * Creates a translation matrix and stores it in a target matrix
  4514. * @param x defines the x coordinate of the translation
  4515. * @param y defines the y coordinate of the translation
  4516. * @param result defines the target matrix
  4517. */
  4518. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  4519. /**
  4520. * Creates a scaling matrix and stores it in a target matrix
  4521. * @param x defines the x coordinate of the scaling
  4522. * @param y defines the y coordinate of the scaling
  4523. * @param result defines the target matrix
  4524. */
  4525. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  4526. /**
  4527. * Creates a rotation matrix and stores it in a target matrix
  4528. * @param angle defines the rotation angle
  4529. * @param result defines the target matrix
  4530. */
  4531. static RotationToRef(angle: number, result: Matrix2D): void;
  4532. private static _TempPreTranslationMatrix;
  4533. private static _TempPostTranslationMatrix;
  4534. private static _TempRotationMatrix;
  4535. private static _TempScalingMatrix;
  4536. private static _TempCompose0;
  4537. private static _TempCompose1;
  4538. private static _TempCompose2;
  4539. /**
  4540. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  4541. * @param tx defines the x coordinate of the translation
  4542. * @param ty defines the y coordinate of the translation
  4543. * @param angle defines the rotation angle
  4544. * @param scaleX defines the x coordinate of the scaling
  4545. * @param scaleY defines the y coordinate of the scaling
  4546. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  4547. * @param result defines the target matrix
  4548. */
  4549. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  4550. }
  4551. }
  4552. declare module BABYLON.GUI {
  4553. /**
  4554. * Class used to store 2D control sizes
  4555. */
  4556. export class Measure {
  4557. /** defines left coordinate */
  4558. left: number;
  4559. /** defines top coordinate */
  4560. top: number;
  4561. /** defines width dimension */
  4562. width: number;
  4563. /** defines height dimension */
  4564. height: number;
  4565. /**
  4566. * Creates a new measure
  4567. * @param left defines left coordinate
  4568. * @param top defines top coordinate
  4569. * @param width defines width dimension
  4570. * @param height defines height dimension
  4571. */
  4572. constructor(
  4573. /** defines left coordinate */
  4574. left: number,
  4575. /** defines top coordinate */
  4576. top: number,
  4577. /** defines width dimension */
  4578. width: number,
  4579. /** defines height dimension */
  4580. height: number);
  4581. /**
  4582. * Copy from another measure
  4583. * @param other defines the other measure to copy from
  4584. */
  4585. copyFrom(other: Measure): void;
  4586. /**
  4587. * Copy from a group of 4 floats
  4588. * @param left defines left coordinate
  4589. * @param top defines top coordinate
  4590. * @param width defines width dimension
  4591. * @param height defines height dimension
  4592. */
  4593. copyFromFloats(left: number, top: number, width: number, height: number): void;
  4594. /**
  4595. * Computes the axis aligned bounding box measure for two given measures
  4596. * @param a Input measure
  4597. * @param b Input measure
  4598. * @param result the resulting bounding measure
  4599. */
  4600. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  4601. /**
  4602. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  4603. * @param transform the matrix to transform the measure before computing the AABB
  4604. * @param result the resulting AABB
  4605. */
  4606. transformToRef(transform: Matrix2D, result: Measure): void;
  4607. /**
  4608. * Check equality between this measure and another one
  4609. * @param other defines the other measures
  4610. * @returns true if both measures are equals
  4611. */
  4612. isEqualsTo(other: Measure): boolean;
  4613. /**
  4614. * Creates an empty measure
  4615. * @returns a new measure
  4616. */
  4617. static Empty(): Measure;
  4618. }
  4619. }
  4620. declare module BABYLON.GUI {
  4621. /**
  4622. * Interface used to define a control that can receive focus
  4623. */
  4624. export interface IFocusableControl {
  4625. /**
  4626. * Function called when the control receives the focus
  4627. */
  4628. onFocus(): void;
  4629. /**
  4630. * Function called when the control loses the focus
  4631. */
  4632. onBlur(): void;
  4633. /**
  4634. * Function called to let the control handle keyboard events
  4635. * @param evt defines the current keyboard event
  4636. */
  4637. processKeyboard(evt: KeyboardEvent): void;
  4638. /**
  4639. * Function called to get the list of controls that should not steal the focus from this control
  4640. * @returns an array of controls
  4641. */
  4642. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4643. }
  4644. /**
  4645. * Class used to create texture to support 2D GUI elements
  4646. * @see http://doc.babylonjs.com/how_to/gui
  4647. */
  4648. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  4649. private _isDirty;
  4650. private _renderObserver;
  4651. private _resizeObserver;
  4652. private _preKeyboardObserver;
  4653. private _pointerMoveObserver;
  4654. private _pointerObserver;
  4655. private _canvasPointerOutObserver;
  4656. private _background;
  4657. /** @hidden */
  4658. _rootContainer: Container;
  4659. /** @hidden */
  4660. _lastPickedControl: Control;
  4661. /** @hidden */
  4662. _lastControlOver: {
  4663. [pointerId: number]: Control;
  4664. };
  4665. /** @hidden */
  4666. _lastControlDown: {
  4667. [pointerId: number]: Control;
  4668. };
  4669. /** @hidden */
  4670. _capturingControl: {
  4671. [pointerId: number]: Control;
  4672. };
  4673. /** @hidden */
  4674. _shouldBlockPointer: boolean;
  4675. /** @hidden */
  4676. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  4677. /** @hidden */
  4678. _linkedControls: Control[];
  4679. private _isFullscreen;
  4680. private _fullscreenViewport;
  4681. private _idealWidth;
  4682. private _idealHeight;
  4683. private _useSmallestIdeal;
  4684. private _renderAtIdealSize;
  4685. private _focusedControl;
  4686. private _blockNextFocusCheck;
  4687. private _renderScale;
  4688. private _rootElement;
  4689. private _cursorChanged;
  4690. /** @hidden */
  4691. _numLayoutCalls: number;
  4692. /** Gets the number of layout calls made the last time the ADT has been rendered */
  4693. get numLayoutCalls(): number;
  4694. /** @hidden */
  4695. _numRenderCalls: number;
  4696. /** Gets the number of render calls made the last time the ADT has been rendered */
  4697. get numRenderCalls(): number;
  4698. /**
  4699. * Define type to string to ensure compatibility across browsers
  4700. * Safari doesn't support DataTransfer constructor
  4701. */
  4702. private _clipboardData;
  4703. /**
  4704. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  4705. */
  4706. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  4707. /**
  4708. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  4709. */
  4710. onControlPickedObservable: BABYLON.Observable<Control>;
  4711. /**
  4712. * BABYLON.Observable event triggered before layout is evaluated
  4713. */
  4714. onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4715. /**
  4716. * BABYLON.Observable event triggered after the layout was evaluated
  4717. */
  4718. onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4719. /**
  4720. * BABYLON.Observable event triggered before the texture is rendered
  4721. */
  4722. onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4723. /**
  4724. * BABYLON.Observable event triggered after the texture was rendered
  4725. */
  4726. onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  4727. /**
  4728. * Gets or sets a boolean defining if alpha is stored as premultiplied
  4729. */
  4730. premulAlpha: boolean;
  4731. /**
  4732. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  4733. * Useful when you want more antialiasing
  4734. */
  4735. get renderScale(): number;
  4736. set renderScale(value: number);
  4737. /** Gets or sets the background color */
  4738. get background(): string;
  4739. set background(value: string);
  4740. /**
  4741. * Gets or sets the ideal width used to design controls.
  4742. * The GUI will then rescale everything accordingly
  4743. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4744. */
  4745. get idealWidth(): number;
  4746. set idealWidth(value: number);
  4747. /**
  4748. * Gets or sets the ideal height used to design controls.
  4749. * The GUI will then rescale everything accordingly
  4750. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4751. */
  4752. get idealHeight(): number;
  4753. set idealHeight(value: number);
  4754. /**
  4755. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  4756. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4757. */
  4758. get useSmallestIdeal(): boolean;
  4759. set useSmallestIdeal(value: boolean);
  4760. /**
  4761. * Gets or sets a boolean indicating if adaptive scaling must be used
  4762. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4763. */
  4764. get renderAtIdealSize(): boolean;
  4765. set renderAtIdealSize(value: boolean);
  4766. /**
  4767. * Gets the ratio used when in "ideal mode"
  4768. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  4769. * */
  4770. get idealRatio(): number;
  4771. /**
  4772. * Gets the underlying layer used to render the texture when in fullscreen mode
  4773. */
  4774. get layer(): BABYLON.Nullable<BABYLON.Layer>;
  4775. /**
  4776. * Gets the root container control
  4777. */
  4778. get rootContainer(): Container;
  4779. /**
  4780. * Returns an array containing the root container.
  4781. * This is mostly used to let the Inspector introspects the ADT
  4782. * @returns an array containing the rootContainer
  4783. */
  4784. getChildren(): Array<Container>;
  4785. /**
  4786. * Will return all controls that are inside this texture
  4787. * @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
  4788. * @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
  4789. * @return all child controls
  4790. */
  4791. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  4792. /**
  4793. * Gets or sets the current focused control
  4794. */
  4795. get focusedControl(): BABYLON.Nullable<IFocusableControl>;
  4796. set focusedControl(control: BABYLON.Nullable<IFocusableControl>);
  4797. /**
  4798. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  4799. */
  4800. get isForeground(): boolean;
  4801. set isForeground(value: boolean);
  4802. /**
  4803. * Gets or set information about clipboardData
  4804. */
  4805. get clipboardData(): string;
  4806. set clipboardData(value: string);
  4807. /**
  4808. * Creates a new AdvancedDynamicTexture
  4809. * @param name defines the name of the texture
  4810. * @param width defines the width of the texture
  4811. * @param height defines the height of the texture
  4812. * @param scene defines the hosting scene
  4813. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  4814. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  4815. */
  4816. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  4817. /**
  4818. * Get the current class name of the texture useful for serialization or dynamic coding.
  4819. * @returns "AdvancedDynamicTexture"
  4820. */
  4821. getClassName(): string;
  4822. /**
  4823. * Function used to execute a function on all controls
  4824. * @param func defines the function to execute
  4825. * @param container defines the container where controls belong. If null the root container will be used
  4826. */
  4827. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  4828. private _useInvalidateRectOptimization;
  4829. /**
  4830. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  4831. */
  4832. get useInvalidateRectOptimization(): boolean;
  4833. set useInvalidateRectOptimization(value: boolean);
  4834. private _invalidatedRectangle;
  4835. /**
  4836. * Invalidates a rectangle area on the gui texture
  4837. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  4838. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  4839. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  4840. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  4841. */
  4842. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  4843. /**
  4844. * Marks the texture as dirty forcing a complete update
  4845. */
  4846. markAsDirty(): void;
  4847. /**
  4848. * Helper function used to create a new style
  4849. * @returns a new style
  4850. * @see http://doc.babylonjs.com/how_to/gui#styles
  4851. */
  4852. createStyle(): Style;
  4853. /**
  4854. * Adds a new control to the root container
  4855. * @param control defines the control to add
  4856. * @returns the current texture
  4857. */
  4858. addControl(control: Control): AdvancedDynamicTexture;
  4859. /**
  4860. * Removes a control from the root container
  4861. * @param control defines the control to remove
  4862. * @returns the current texture
  4863. */
  4864. removeControl(control: Control): AdvancedDynamicTexture;
  4865. /**
  4866. * Release all resources
  4867. */
  4868. dispose(): void;
  4869. private _onResize;
  4870. /** @hidden */
  4871. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  4872. /**
  4873. * Get screen coordinates for a vector3
  4874. * @param position defines the position to project
  4875. * @param worldMatrix defines the world matrix to use
  4876. * @returns the projected position
  4877. */
  4878. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  4879. private _checkUpdate;
  4880. private _clearMeasure;
  4881. private _render;
  4882. /** @hidden */
  4883. _changeCursor(cursor: string): void;
  4884. /** @hidden */
  4885. _registerLastControlDown(control: Control, pointerId: number): void;
  4886. private _doPicking;
  4887. /** @hidden */
  4888. _cleanControlAfterRemovalFromList(list: {
  4889. [pointerId: number]: Control;
  4890. }, control: Control): void;
  4891. /** @hidden */
  4892. _cleanControlAfterRemoval(control: Control): void;
  4893. /** Attach to all scene events required to support pointer events */
  4894. attach(): void;
  4895. /** @hidden */
  4896. private onClipboardCopy;
  4897. /** @hidden */
  4898. private onClipboardCut;
  4899. /** @hidden */
  4900. private onClipboardPaste;
  4901. /**
  4902. * Register the clipboard Events onto the canvas
  4903. */
  4904. registerClipboardEvents(): void;
  4905. /**
  4906. * Unregister the clipboard Events from the canvas
  4907. */
  4908. unRegisterClipboardEvents(): void;
  4909. /**
  4910. * Connect the texture to a hosting mesh to enable interactions
  4911. * @param mesh defines the mesh to attach to
  4912. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  4913. */
  4914. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  4915. /**
  4916. * Move the focus to a specific control
  4917. * @param control defines the control which will receive the focus
  4918. */
  4919. moveFocusToControl(control: IFocusableControl): void;
  4920. private _manageFocus;
  4921. private _attachToOnPointerOut;
  4922. /**
  4923. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  4924. * @param mesh defines the mesh which will receive the texture
  4925. * @param width defines the texture width (1024 by default)
  4926. * @param height defines the texture height (1024 by default)
  4927. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  4928. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  4929. * @returns a new AdvancedDynamicTexture
  4930. */
  4931. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  4932. /**
  4933. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  4934. * In this mode the texture will rely on a layer for its rendering.
  4935. * This allows it to be treated like any other layer.
  4936. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  4937. * LayerMask is set through advancedTexture.layer.layerMask
  4938. * @param name defines name for the texture
  4939. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  4940. * @param scene defines the hsoting scene
  4941. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  4942. * @returns a new AdvancedDynamicTexture
  4943. */
  4944. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  4945. }
  4946. }
  4947. declare module BABYLON.GUI {
  4948. /**
  4949. * Root class used for all 2D controls
  4950. * @see http://doc.babylonjs.com/how_to/gui#controls
  4951. */
  4952. export class Control {
  4953. /** defines the name of the control */
  4954. name?: string | undefined;
  4955. /**
  4956. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  4957. */
  4958. static AllowAlphaInheritance: boolean;
  4959. private _alpha;
  4960. private _alphaSet;
  4961. private _zIndex;
  4962. /** @hidden */
  4963. _host: AdvancedDynamicTexture;
  4964. /** Gets or sets the control parent */
  4965. parent: BABYLON.Nullable<Container>;
  4966. /** @hidden */
  4967. _currentMeasure: Measure;
  4968. private _fontFamily;
  4969. private _fontStyle;
  4970. private _fontWeight;
  4971. private _fontSize;
  4972. private _font;
  4973. /** @hidden */
  4974. _width: ValueAndUnit;
  4975. /** @hidden */
  4976. _height: ValueAndUnit;
  4977. /** @hidden */
  4978. protected _fontOffset: {
  4979. ascent: number;
  4980. height: number;
  4981. descent: number;
  4982. };
  4983. private _color;
  4984. private _style;
  4985. private _styleObserver;
  4986. /** @hidden */
  4987. protected _horizontalAlignment: number;
  4988. /** @hidden */
  4989. protected _verticalAlignment: number;
  4990. /** @hidden */
  4991. protected _isDirty: boolean;
  4992. /** @hidden */
  4993. protected _wasDirty: boolean;
  4994. /** @hidden */
  4995. _tempParentMeasure: Measure;
  4996. /** @hidden */
  4997. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  4998. /** @hidden */
  4999. protected _cachedParentMeasure: Measure;
  5000. private _paddingLeft;
  5001. private _paddingRight;
  5002. private _paddingTop;
  5003. private _paddingBottom;
  5004. /** @hidden */
  5005. _left: ValueAndUnit;
  5006. /** @hidden */
  5007. _top: ValueAndUnit;
  5008. private _scaleX;
  5009. private _scaleY;
  5010. private _rotation;
  5011. private _transformCenterX;
  5012. private _transformCenterY;
  5013. /** @hidden */
  5014. _transformMatrix: Matrix2D;
  5015. /** @hidden */
  5016. protected _invertTransformMatrix: Matrix2D;
  5017. /** @hidden */
  5018. protected _transformedPosition: BABYLON.Vector2;
  5019. private _isMatrixDirty;
  5020. private _cachedOffsetX;
  5021. private _cachedOffsetY;
  5022. private _isVisible;
  5023. private _isHighlighted;
  5024. /** @hidden */
  5025. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  5026. private _fontSet;
  5027. private _dummyVector2;
  5028. private _downCount;
  5029. private _enterCount;
  5030. private _doNotRender;
  5031. private _downPointerIds;
  5032. protected _isEnabled: boolean;
  5033. protected _disabledColor: string;
  5034. /** @hidden */
  5035. protected _rebuildLayout: boolean;
  5036. /** @hidden */
  5037. _customData: any;
  5038. /** @hidden */
  5039. _isClipped: boolean;
  5040. /** @hidden */
  5041. _automaticSize: boolean;
  5042. /** @hidden */
  5043. _tag: any;
  5044. /**
  5045. * 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
  5046. */
  5047. uniqueId: number;
  5048. /**
  5049. * Gets or sets an object used to store user defined information for the node
  5050. */
  5051. metadata: any;
  5052. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  5053. isHitTestVisible: boolean;
  5054. /** Gets or sets a boolean indicating if the control can block pointer events */
  5055. isPointerBlocker: boolean;
  5056. /** Gets or sets a boolean indicating if the control can be focusable */
  5057. isFocusInvisible: boolean;
  5058. /**
  5059. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  5060. * 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
  5061. */
  5062. clipChildren: boolean;
  5063. /**
  5064. * Gets or sets a boolean indicating that control content must be clipped
  5065. * 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
  5066. */
  5067. clipContent: boolean;
  5068. /**
  5069. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  5070. */
  5071. useBitmapCache: boolean;
  5072. private _cacheData;
  5073. private _shadowOffsetX;
  5074. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  5075. get shadowOffsetX(): number;
  5076. set shadowOffsetX(value: number);
  5077. private _shadowOffsetY;
  5078. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  5079. get shadowOffsetY(): number;
  5080. set shadowOffsetY(value: number);
  5081. private _shadowBlur;
  5082. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  5083. get shadowBlur(): number;
  5084. set shadowBlur(value: number);
  5085. private _shadowColor;
  5086. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  5087. get shadowColor(): string;
  5088. set shadowColor(value: string);
  5089. /** Gets or sets the cursor to use when the control is hovered */
  5090. hoverCursor: string;
  5091. /** @hidden */
  5092. protected _linkOffsetX: ValueAndUnit;
  5093. /** @hidden */
  5094. protected _linkOffsetY: ValueAndUnit;
  5095. /** Gets the control type name */
  5096. get typeName(): string;
  5097. /**
  5098. * Get the current class name of the control.
  5099. * @returns current class name
  5100. */
  5101. getClassName(): string;
  5102. /**
  5103. * An event triggered when the pointer move over the control.
  5104. */
  5105. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  5106. /**
  5107. * An event triggered when the pointer move out of the control.
  5108. */
  5109. onPointerOutObservable: BABYLON.Observable<Control>;
  5110. /**
  5111. * An event triggered when the pointer taps the control
  5112. */
  5113. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  5114. /**
  5115. * An event triggered when pointer up
  5116. */
  5117. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  5118. /**
  5119. * An event triggered when a control is clicked on
  5120. */
  5121. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  5122. /**
  5123. * An event triggered when pointer enters the control
  5124. */
  5125. onPointerEnterObservable: BABYLON.Observable<Control>;
  5126. /**
  5127. * An event triggered when the control is marked as dirty
  5128. */
  5129. onDirtyObservable: BABYLON.Observable<Control>;
  5130. /**
  5131. * An event triggered before drawing the control
  5132. */
  5133. onBeforeDrawObservable: BABYLON.Observable<Control>;
  5134. /**
  5135. * An event triggered after the control was drawn
  5136. */
  5137. onAfterDrawObservable: BABYLON.Observable<Control>;
  5138. /**
  5139. * Get the hosting AdvancedDynamicTexture
  5140. */
  5141. get host(): AdvancedDynamicTexture;
  5142. /** Gets or set information about font offsets (used to render and align text) */
  5143. get fontOffset(): {
  5144. ascent: number;
  5145. height: number;
  5146. descent: number;
  5147. };
  5148. set fontOffset(offset: {
  5149. ascent: number;
  5150. height: number;
  5151. descent: number;
  5152. });
  5153. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  5154. get alpha(): number;
  5155. set alpha(value: number);
  5156. /**
  5157. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  5158. */
  5159. get isHighlighted(): boolean;
  5160. set isHighlighted(value: boolean);
  5161. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  5162. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5163. */
  5164. get scaleX(): number;
  5165. set scaleX(value: number);
  5166. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  5167. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5168. */
  5169. get scaleY(): number;
  5170. set scaleY(value: number);
  5171. /** Gets or sets the rotation angle (0 by default)
  5172. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5173. */
  5174. get rotation(): number;
  5175. set rotation(value: number);
  5176. /** Gets or sets the transformation center on Y axis (0 by default)
  5177. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5178. */
  5179. get transformCenterY(): number;
  5180. set transformCenterY(value: number);
  5181. /** Gets or sets the transformation center on X axis (0 by default)
  5182. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  5183. */
  5184. get transformCenterX(): number;
  5185. set transformCenterX(value: number);
  5186. /**
  5187. * Gets or sets the horizontal alignment
  5188. * @see http://doc.babylonjs.com/how_to/gui#alignments
  5189. */
  5190. get horizontalAlignment(): number;
  5191. set horizontalAlignment(value: number);
  5192. /**
  5193. * Gets or sets the vertical alignment
  5194. * @see http://doc.babylonjs.com/how_to/gui#alignments
  5195. */
  5196. get verticalAlignment(): number;
  5197. set verticalAlignment(value: number);
  5198. /**
  5199. * Gets or sets control width
  5200. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5201. */
  5202. get width(): string | number;
  5203. set width(value: string | number);
  5204. /**
  5205. * Gets or sets the control width in pixel
  5206. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5207. */
  5208. get widthInPixels(): number;
  5209. set widthInPixels(value: number);
  5210. /**
  5211. * Gets or sets control height
  5212. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5213. */
  5214. get height(): string | number;
  5215. set height(value: string | number);
  5216. /**
  5217. * Gets or sets control height in pixel
  5218. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5219. */
  5220. get heightInPixels(): number;
  5221. set heightInPixels(value: number);
  5222. /** Gets or set font family */
  5223. get fontFamily(): string;
  5224. set fontFamily(value: string);
  5225. /** Gets or sets font style */
  5226. get fontStyle(): string;
  5227. set fontStyle(value: string);
  5228. /** Gets or sets font weight */
  5229. get fontWeight(): string;
  5230. set fontWeight(value: string);
  5231. /**
  5232. * Gets or sets style
  5233. * @see http://doc.babylonjs.com/how_to/gui#styles
  5234. */
  5235. get style(): BABYLON.Nullable<Style>;
  5236. set style(value: BABYLON.Nullable<Style>);
  5237. /** @hidden */
  5238. get _isFontSizeInPercentage(): boolean;
  5239. /** Gets or sets font size in pixels */
  5240. get fontSizeInPixels(): number;
  5241. set fontSizeInPixels(value: number);
  5242. /** Gets or sets font size */
  5243. get fontSize(): string | number;
  5244. set fontSize(value: string | number);
  5245. /** Gets or sets foreground color */
  5246. get color(): string;
  5247. set color(value: string);
  5248. /** Gets or sets z index which is used to reorder controls on the z axis */
  5249. get zIndex(): number;
  5250. set zIndex(value: number);
  5251. /** Gets or sets a boolean indicating if the control can be rendered */
  5252. get notRenderable(): boolean;
  5253. set notRenderable(value: boolean);
  5254. /** Gets or sets a boolean indicating if the control is visible */
  5255. get isVisible(): boolean;
  5256. set isVisible(value: boolean);
  5257. /** Gets a boolean indicating that the control needs to update its rendering */
  5258. get isDirty(): boolean;
  5259. /**
  5260. * Gets the current linked mesh (or null if none)
  5261. */
  5262. get linkedMesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  5263. /**
  5264. * Gets or sets a value indicating the padding to use on the left of the control
  5265. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5266. */
  5267. get paddingLeft(): string | number;
  5268. set paddingLeft(value: string | number);
  5269. /**
  5270. * Gets or sets a value indicating the padding in pixels to use on the left of the control
  5271. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5272. */
  5273. get paddingLeftInPixels(): number;
  5274. set paddingLeftInPixels(value: number);
  5275. /**
  5276. * Gets or sets a value indicating the padding to use on the right of the control
  5277. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5278. */
  5279. get paddingRight(): string | number;
  5280. set paddingRight(value: string | number);
  5281. /**
  5282. * Gets or sets a value indicating the padding in pixels to use on the right of the control
  5283. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5284. */
  5285. get paddingRightInPixels(): number;
  5286. set paddingRightInPixels(value: number);
  5287. /**
  5288. * Gets or sets a value indicating the padding to use on the top of the control
  5289. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5290. */
  5291. get paddingTop(): string | number;
  5292. set paddingTop(value: string | number);
  5293. /**
  5294. * Gets or sets a value indicating the padding in pixels to use on the top of the control
  5295. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5296. */
  5297. get paddingTopInPixels(): number;
  5298. set paddingTopInPixels(value: number);
  5299. /**
  5300. * Gets or sets a value indicating the padding to use on the bottom of the control
  5301. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5302. */
  5303. get paddingBottom(): string | number;
  5304. set paddingBottom(value: string | number);
  5305. /**
  5306. * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
  5307. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5308. */
  5309. get paddingBottomInPixels(): number;
  5310. set paddingBottomInPixels(value: number);
  5311. /**
  5312. * Gets or sets a value indicating the left coordinate of the control
  5313. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5314. */
  5315. get left(): string | number;
  5316. set left(value: string | number);
  5317. /**
  5318. * Gets or sets a value indicating the left coordinate in pixels of the control
  5319. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5320. */
  5321. get leftInPixels(): number;
  5322. set leftInPixels(value: number);
  5323. /**
  5324. * Gets or sets a value indicating the top coordinate of the control
  5325. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5326. */
  5327. get top(): string | number;
  5328. set top(value: string | number);
  5329. /**
  5330. * Gets or sets a value indicating the top coordinate in pixels of the control
  5331. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  5332. */
  5333. get topInPixels(): number;
  5334. set topInPixels(value: number);
  5335. /**
  5336. * Gets or sets a value indicating the offset on X axis to the linked mesh
  5337. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5338. */
  5339. get linkOffsetX(): string | number;
  5340. set linkOffsetX(value: string | number);
  5341. /**
  5342. * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
  5343. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5344. */
  5345. get linkOffsetXInPixels(): number;
  5346. set linkOffsetXInPixels(value: number);
  5347. /**
  5348. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  5349. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5350. */
  5351. get linkOffsetY(): string | number;
  5352. set linkOffsetY(value: string | number);
  5353. /**
  5354. * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
  5355. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5356. */
  5357. get linkOffsetYInPixels(): number;
  5358. set linkOffsetYInPixels(value: number);
  5359. /** Gets the center coordinate on X axis */
  5360. get centerX(): number;
  5361. /** Gets the center coordinate on Y axis */
  5362. get centerY(): number;
  5363. /** Gets or sets if control is Enabled*/
  5364. get isEnabled(): boolean;
  5365. set isEnabled(value: boolean);
  5366. /** Gets or sets background color of control if it's disabled*/
  5367. get disabledColor(): string;
  5368. set disabledColor(value: string);
  5369. /**
  5370. * Creates a new control
  5371. * @param name defines the name of the control
  5372. */
  5373. constructor(
  5374. /** defines the name of the control */
  5375. name?: string | undefined);
  5376. /** @hidden */
  5377. protected _getTypeName(): string;
  5378. /**
  5379. * Gets the first ascendant in the hierarchy of the given type
  5380. * @param className defines the required type
  5381. * @returns the ascendant or null if not found
  5382. */
  5383. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  5384. /** @hidden */
  5385. _resetFontCache(): void;
  5386. /**
  5387. * Determines if a container is an ascendant of the current control
  5388. * @param container defines the container to look for
  5389. * @returns true if the container is one of the ascendant of the control
  5390. */
  5391. isAscendant(container: Control): boolean;
  5392. /**
  5393. * Gets coordinates in local control space
  5394. * @param globalCoordinates defines the coordinates to transform
  5395. * @returns the new coordinates in local space
  5396. */
  5397. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  5398. /**
  5399. * Gets coordinates in local control space
  5400. * @param globalCoordinates defines the coordinates to transform
  5401. * @param result defines the target vector2 where to store the result
  5402. * @returns the current control
  5403. */
  5404. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  5405. /**
  5406. * Gets coordinates in parent local control space
  5407. * @param globalCoordinates defines the coordinates to transform
  5408. * @returns the new coordinates in parent local space
  5409. */
  5410. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  5411. /**
  5412. * Move the current control to a vector3 position projected onto the screen.
  5413. * @param position defines the target position
  5414. * @param scene defines the hosting scene
  5415. */
  5416. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  5417. /**
  5418. * Will store all controls that have this control as ascendant in a given array
  5419. * @param results defines the array where to store the descendants
  5420. * @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
  5421. * @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
  5422. */
  5423. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  5424. /**
  5425. * Will return all controls that have this control as ascendant
  5426. * @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
  5427. * @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
  5428. * @return all child controls
  5429. */
  5430. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  5431. /**
  5432. * Link current control with a target mesh
  5433. * @param mesh defines the mesh to link with
  5434. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  5435. */
  5436. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  5437. /** @hidden */
  5438. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  5439. /** @hidden */
  5440. _offsetLeft(offset: number): void;
  5441. /** @hidden */
  5442. _offsetTop(offset: number): void;
  5443. /** @hidden */
  5444. _markMatrixAsDirty(): void;
  5445. /** @hidden */
  5446. _flagDescendantsAsMatrixDirty(): void;
  5447. /** @hidden */
  5448. _intersectsRect(rect: Measure): boolean;
  5449. /** @hidden */
  5450. protected invalidateRect(): void;
  5451. /** @hidden */
  5452. _markAsDirty(force?: boolean): void;
  5453. /** @hidden */
  5454. _markAllAsDirty(): void;
  5455. /** @hidden */
  5456. _link(host: AdvancedDynamicTexture): void;
  5457. /** @hidden */
  5458. protected _transform(context?: CanvasRenderingContext2D): void;
  5459. /** @hidden */
  5460. _renderHighlight(context: CanvasRenderingContext2D): void;
  5461. /** @hidden */
  5462. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  5463. /** @hidden */
  5464. protected _applyStates(context: CanvasRenderingContext2D): void;
  5465. /** @hidden */
  5466. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  5467. /** @hidden */
  5468. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5469. protected _evaluateClippingState(parentMeasure: Measure): void;
  5470. /** @hidden */
  5471. _measure(): void;
  5472. /** @hidden */
  5473. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5474. /** @hidden */
  5475. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5476. /** @hidden */
  5477. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5478. /** @hidden */
  5479. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  5480. private static _ClipMeasure;
  5481. private _tmpMeasureA;
  5482. private _clip;
  5483. /** @hidden */
  5484. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): boolean;
  5485. /** @hidden */
  5486. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  5487. /**
  5488. * Tests if a given coordinates belong to the current control
  5489. * @param x defines x coordinate to test
  5490. * @param y defines y coordinate to test
  5491. * @returns true if the coordinates are inside the control
  5492. */
  5493. contains(x: number, y: number): boolean;
  5494. /** @hidden */
  5495. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  5496. /** @hidden */
  5497. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  5498. /** @hidden */
  5499. _onPointerEnter(target: Control): boolean;
  5500. /** @hidden */
  5501. _onPointerOut(target: Control, force?: boolean): void;
  5502. /** @hidden */
  5503. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  5504. /** @hidden */
  5505. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5506. /** @hidden */
  5507. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  5508. /** @hidden */
  5509. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  5510. private _prepareFont;
  5511. /** Releases associated resources */
  5512. dispose(): void;
  5513. private static _HORIZONTAL_ALIGNMENT_LEFT;
  5514. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  5515. private static _HORIZONTAL_ALIGNMENT_CENTER;
  5516. private static _VERTICAL_ALIGNMENT_TOP;
  5517. private static _VERTICAL_ALIGNMENT_BOTTOM;
  5518. private static _VERTICAL_ALIGNMENT_CENTER;
  5519. /** HORIZONTAL_ALIGNMENT_LEFT */
  5520. static get HORIZONTAL_ALIGNMENT_LEFT(): number;
  5521. /** HORIZONTAL_ALIGNMENT_RIGHT */
  5522. static get HORIZONTAL_ALIGNMENT_RIGHT(): number;
  5523. /** HORIZONTAL_ALIGNMENT_CENTER */
  5524. static get HORIZONTAL_ALIGNMENT_CENTER(): number;
  5525. /** VERTICAL_ALIGNMENT_TOP */
  5526. static get VERTICAL_ALIGNMENT_TOP(): number;
  5527. /** VERTICAL_ALIGNMENT_BOTTOM */
  5528. static get VERTICAL_ALIGNMENT_BOTTOM(): number;
  5529. /** VERTICAL_ALIGNMENT_CENTER */
  5530. static get VERTICAL_ALIGNMENT_CENTER(): number;
  5531. private static _FontHeightSizes;
  5532. /** @hidden */
  5533. static _GetFontOffset(font: string): {
  5534. ascent: number;
  5535. height: number;
  5536. descent: number;
  5537. };
  5538. /**
  5539. * Creates a stack panel that can be used to render headers
  5540. * @param control defines the control to associate with the header
  5541. * @param text defines the text of the header
  5542. * @param size defines the size of the header
  5543. * @param options defines options used to configure the header
  5544. * @returns a new StackPanel
  5545. * @ignore
  5546. * @hidden
  5547. */
  5548. static AddHeader: (control: Control, text: string, size: string | number, options: {
  5549. isHorizontal: boolean;
  5550. controlFirst: boolean;
  5551. }) => any;
  5552. /** @hidden */
  5553. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  5554. }
  5555. }
  5556. declare module BABYLON.GUI {
  5557. /**
  5558. * Root class for 2D containers
  5559. * @see http://doc.babylonjs.com/how_to/gui#containers
  5560. */
  5561. export class Container extends Control {
  5562. name?: string | undefined;
  5563. /** @hidden */
  5564. _children: Control[];
  5565. /** @hidden */
  5566. protected _measureForChildren: Measure;
  5567. /** @hidden */
  5568. protected _background: string;
  5569. /** @hidden */
  5570. protected _adaptWidthToChildren: boolean;
  5571. /** @hidden */
  5572. protected _adaptHeightToChildren: boolean;
  5573. /**
  5574. * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
  5575. */
  5576. logLayoutCycleErrors: boolean;
  5577. /**
  5578. * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
  5579. */
  5580. maxLayoutCycle: number;
  5581. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  5582. get adaptHeightToChildren(): boolean;
  5583. set adaptHeightToChildren(value: boolean);
  5584. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  5585. get adaptWidthToChildren(): boolean;
  5586. set adaptWidthToChildren(value: boolean);
  5587. /** Gets or sets background color */
  5588. get background(): string;
  5589. set background(value: string);
  5590. /** Gets the list of children */
  5591. get children(): Control[];
  5592. /**
  5593. * Creates a new Container
  5594. * @param name defines the name of the container
  5595. */
  5596. constructor(name?: string | undefined);
  5597. protected _getTypeName(): string;
  5598. _flagDescendantsAsMatrixDirty(): void;
  5599. /**
  5600. * Gets a child using its name
  5601. * @param name defines the child name to look for
  5602. * @returns the child control if found
  5603. */
  5604. getChildByName(name: string): BABYLON.Nullable<Control>;
  5605. /**
  5606. * Gets a child using its type and its name
  5607. * @param name defines the child name to look for
  5608. * @param type defines the child type to look for
  5609. * @returns the child control if found
  5610. */
  5611. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  5612. /**
  5613. * Search for a specific control in children
  5614. * @param control defines the control to look for
  5615. * @returns true if the control is in child list
  5616. */
  5617. containsControl(control: Control): boolean;
  5618. /**
  5619. * Adds a new control to the current container
  5620. * @param control defines the control to add
  5621. * @returns the current container
  5622. */
  5623. addControl(control: BABYLON.Nullable<Control>): Container;
  5624. /**
  5625. * Removes all controls from the current container
  5626. * @returns the current container
  5627. */
  5628. clearControls(): Container;
  5629. /**
  5630. * Removes a control from the current container
  5631. * @param control defines the control to remove
  5632. * @returns the current container
  5633. */
  5634. removeControl(control: Control): Container;
  5635. /** @hidden */
  5636. _reOrderControl(control: Control): void;
  5637. /** @hidden */
  5638. _offsetLeft(offset: number): void;
  5639. /** @hidden */
  5640. _offsetTop(offset: number): void;
  5641. /** @hidden */
  5642. _markAllAsDirty(): void;
  5643. /** @hidden */
  5644. protected _localDraw(context: CanvasRenderingContext2D): void;
  5645. /** @hidden */
  5646. _link(host: AdvancedDynamicTexture): void;
  5647. /** @hidden */
  5648. protected _beforeLayout(): void;
  5649. /** @hidden */
  5650. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5651. /** @hidden */
  5652. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  5653. protected _postMeasure(): void;
  5654. /** @hidden */
  5655. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  5656. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  5657. /** @hidden */
  5658. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  5659. /** @hidden */
  5660. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5661. /** Releases associated resources */
  5662. dispose(): void;
  5663. }
  5664. }
  5665. declare module BABYLON.GUI {
  5666. /** Class used to create rectangle container */
  5667. export class Rectangle extends Container {
  5668. name?: string | undefined;
  5669. private _thickness;
  5670. private _cornerRadius;
  5671. /** Gets or sets border thickness */
  5672. get thickness(): number;
  5673. set thickness(value: number);
  5674. /** Gets or sets the corner radius angle */
  5675. get cornerRadius(): number;
  5676. set cornerRadius(value: number);
  5677. /**
  5678. * Creates a new Rectangle
  5679. * @param name defines the control name
  5680. */
  5681. constructor(name?: string | undefined);
  5682. protected _getTypeName(): string;
  5683. protected _localDraw(context: CanvasRenderingContext2D): void;
  5684. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5685. private _drawRoundedRect;
  5686. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  5687. }
  5688. }
  5689. declare module BABYLON.GUI {
  5690. /**
  5691. * Enum that determines the text-wrapping mode to use.
  5692. */
  5693. export enum TextWrapping {
  5694. /**
  5695. * Clip the text when it's larger than Control.width; this is the default mode.
  5696. */
  5697. Clip = 0,
  5698. /**
  5699. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  5700. */
  5701. WordWrap = 1,
  5702. /**
  5703. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  5704. */
  5705. Ellipsis = 2
  5706. }
  5707. /**
  5708. * Class used to create text block control
  5709. */
  5710. export class TextBlock extends Control {
  5711. /**
  5712. * Defines the name of the control
  5713. */
  5714. name?: string | undefined;
  5715. private _text;
  5716. private _textWrapping;
  5717. private _textHorizontalAlignment;
  5718. private _textVerticalAlignment;
  5719. private _lines;
  5720. private _resizeToFit;
  5721. private _lineSpacing;
  5722. private _outlineWidth;
  5723. private _outlineColor;
  5724. /**
  5725. * An event triggered after the text is changed
  5726. */
  5727. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  5728. /**
  5729. * An event triggered after the text was broken up into lines
  5730. */
  5731. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  5732. /**
  5733. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  5734. */
  5735. get lines(): any[];
  5736. /**
  5737. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  5738. */
  5739. get resizeToFit(): boolean;
  5740. /**
  5741. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  5742. */
  5743. set resizeToFit(value: boolean);
  5744. /**
  5745. * Gets or sets a boolean indicating if text must be wrapped
  5746. */
  5747. get textWrapping(): TextWrapping | boolean;
  5748. /**
  5749. * Gets or sets a boolean indicating if text must be wrapped
  5750. */
  5751. set textWrapping(value: TextWrapping | boolean);
  5752. /**
  5753. * Gets or sets text to display
  5754. */
  5755. get text(): string;
  5756. /**
  5757. * Gets or sets text to display
  5758. */
  5759. set text(value: string);
  5760. /**
  5761. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  5762. */
  5763. get textHorizontalAlignment(): number;
  5764. /**
  5765. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  5766. */
  5767. set textHorizontalAlignment(value: number);
  5768. /**
  5769. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  5770. */
  5771. get textVerticalAlignment(): number;
  5772. /**
  5773. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  5774. */
  5775. set textVerticalAlignment(value: number);
  5776. /**
  5777. * Gets or sets line spacing value
  5778. */
  5779. set lineSpacing(value: string | number);
  5780. /**
  5781. * Gets or sets line spacing value
  5782. */
  5783. get lineSpacing(): string | number;
  5784. /**
  5785. * Gets or sets outlineWidth of the text to display
  5786. */
  5787. get outlineWidth(): number;
  5788. /**
  5789. * Gets or sets outlineWidth of the text to display
  5790. */
  5791. set outlineWidth(value: number);
  5792. /**
  5793. * Gets or sets outlineColor of the text to display
  5794. */
  5795. get outlineColor(): string;
  5796. /**
  5797. * Gets or sets outlineColor of the text to display
  5798. */
  5799. set outlineColor(value: string);
  5800. /**
  5801. * Creates a new TextBlock object
  5802. * @param name defines the name of the control
  5803. * @param text defines the text to display (emptry string by default)
  5804. */
  5805. constructor(
  5806. /**
  5807. * Defines the name of the control
  5808. */
  5809. name?: string | undefined, text?: string);
  5810. protected _getTypeName(): string;
  5811. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5812. private _drawText;
  5813. /** @hidden */
  5814. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  5815. protected _applyStates(context: CanvasRenderingContext2D): void;
  5816. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  5817. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  5818. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  5819. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  5820. protected _renderLines(context: CanvasRenderingContext2D): void;
  5821. /**
  5822. * Given a width constraint applied on the text block, find the expected height
  5823. * @returns expected height
  5824. */
  5825. computeExpectedHeight(): number;
  5826. dispose(): void;
  5827. }
  5828. }
  5829. declare module BABYLON.GUI {
  5830. /**
  5831. * Class used to create 2D images
  5832. */
  5833. export class Image extends Control {
  5834. name?: string | undefined;
  5835. private _workingCanvas;
  5836. private _domImage;
  5837. private _imageWidth;
  5838. private _imageHeight;
  5839. private _loaded;
  5840. private _stretch;
  5841. private _source;
  5842. private _autoScale;
  5843. private _sourceLeft;
  5844. private _sourceTop;
  5845. private _sourceWidth;
  5846. private _sourceHeight;
  5847. private _cellWidth;
  5848. private _cellHeight;
  5849. private _cellId;
  5850. private _populateNinePatchSlicesFromImage;
  5851. private _sliceLeft;
  5852. private _sliceRight;
  5853. private _sliceTop;
  5854. private _sliceBottom;
  5855. private _detectPointerOnOpaqueOnly;
  5856. /**
  5857. * BABYLON.Observable notified when the content is loaded
  5858. */
  5859. onImageLoadedObservable: BABYLON.Observable<Image>;
  5860. /**
  5861. * BABYLON.Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed
  5862. */
  5863. onSVGAttributesComputedObservable: BABYLON.Observable<Image>;
  5864. /**
  5865. * Gets a boolean indicating that the content is loaded
  5866. */
  5867. get isLoaded(): boolean;
  5868. /**
  5869. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  5870. */
  5871. get populateNinePatchSlicesFromImage(): boolean;
  5872. set populateNinePatchSlicesFromImage(value: boolean);
  5873. /**
  5874. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  5875. * Beware using this as this will comsume more memory as the image has to be stored twice
  5876. */
  5877. get detectPointerOnOpaqueOnly(): boolean;
  5878. set detectPointerOnOpaqueOnly(value: boolean);
  5879. /**
  5880. * Gets or sets the left value for slicing (9-patch)
  5881. */
  5882. get sliceLeft(): number;
  5883. set sliceLeft(value: number);
  5884. /**
  5885. * Gets or sets the right value for slicing (9-patch)
  5886. */
  5887. get sliceRight(): number;
  5888. set sliceRight(value: number);
  5889. /**
  5890. * Gets or sets the top value for slicing (9-patch)
  5891. */
  5892. get sliceTop(): number;
  5893. set sliceTop(value: number);
  5894. /**
  5895. * Gets or sets the bottom value for slicing (9-patch)
  5896. */
  5897. get sliceBottom(): number;
  5898. set sliceBottom(value: number);
  5899. /**
  5900. * Gets or sets the left coordinate in the source image
  5901. */
  5902. get sourceLeft(): number;
  5903. set sourceLeft(value: number);
  5904. /**
  5905. * Gets or sets the top coordinate in the source image
  5906. */
  5907. get sourceTop(): number;
  5908. set sourceTop(value: number);
  5909. /**
  5910. * Gets or sets the width to capture in the source image
  5911. */
  5912. get sourceWidth(): number;
  5913. set sourceWidth(value: number);
  5914. /**
  5915. * Gets or sets the height to capture in the source image
  5916. */
  5917. get sourceHeight(): number;
  5918. set sourceHeight(value: number);
  5919. /**
  5920. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  5921. * @see http://doc.babylonjs.com/how_to/gui#image
  5922. */
  5923. get autoScale(): boolean;
  5924. set autoScale(value: boolean);
  5925. /** Gets or sets the streching mode used by the image */
  5926. get stretch(): number;
  5927. set stretch(value: number);
  5928. /** @hidden */
  5929. _rotate90(n: number): Image;
  5930. /**
  5931. * Gets or sets the internal DOM image used to render the control
  5932. */
  5933. set domImage(value: HTMLImageElement);
  5934. get domImage(): HTMLImageElement;
  5935. private _onImageLoaded;
  5936. private _extractNinePatchSliceDataFromImage;
  5937. /**
  5938. * Gets or sets image source url
  5939. */
  5940. set source(value: BABYLON.Nullable<string>);
  5941. /**
  5942. * Checks for svg document with icon id present
  5943. */
  5944. private _svgCheck;
  5945. /**
  5946. * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically
  5947. * given external svg file and icon id
  5948. */
  5949. private _getSVGAttribs;
  5950. /**
  5951. * Gets or sets the cell width to use when animation sheet is enabled
  5952. * @see http://doc.babylonjs.com/how_to/gui#image
  5953. */
  5954. get cellWidth(): number;
  5955. set cellWidth(value: number);
  5956. /**
  5957. * Gets or sets the cell height to use when animation sheet is enabled
  5958. * @see http://doc.babylonjs.com/how_to/gui#image
  5959. */
  5960. get cellHeight(): number;
  5961. set cellHeight(value: number);
  5962. /**
  5963. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  5964. * @see http://doc.babylonjs.com/how_to/gui#image
  5965. */
  5966. get cellId(): number;
  5967. set cellId(value: number);
  5968. /**
  5969. * Creates a new Image
  5970. * @param name defines the control name
  5971. * @param url defines the image url
  5972. */
  5973. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  5974. /**
  5975. * Tests if a given coordinates belong to the current control
  5976. * @param x defines x coordinate to test
  5977. * @param y defines y coordinate to test
  5978. * @returns true if the coordinates are inside the control
  5979. */
  5980. contains(x: number, y: number): boolean;
  5981. protected _getTypeName(): string;
  5982. /** Force the control to synchronize with its content */
  5983. synchronizeSizeWithContent(): void;
  5984. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5985. private _prepareWorkingCanvasForOpaqueDetection;
  5986. private _drawImage;
  5987. _draw(context: CanvasRenderingContext2D): void;
  5988. private _renderCornerPatch;
  5989. private _renderNinePatch;
  5990. dispose(): void;
  5991. /** STRETCH_NONE */
  5992. static readonly STRETCH_NONE: number;
  5993. /** STRETCH_FILL */
  5994. static readonly STRETCH_FILL: number;
  5995. /** STRETCH_UNIFORM */
  5996. static readonly STRETCH_UNIFORM: number;
  5997. /** STRETCH_EXTEND */
  5998. static readonly STRETCH_EXTEND: number;
  5999. /** NINE_PATCH */
  6000. static readonly STRETCH_NINE_PATCH: number;
  6001. }
  6002. }
  6003. declare module BABYLON.GUI {
  6004. /**
  6005. * Class used to create 2D buttons
  6006. */
  6007. export class Button extends Rectangle {
  6008. name?: string | undefined;
  6009. /**
  6010. * Function called to generate a pointer enter animation
  6011. */
  6012. pointerEnterAnimation: () => void;
  6013. /**
  6014. * Function called to generate a pointer out animation
  6015. */
  6016. pointerOutAnimation: () => void;
  6017. /**
  6018. * Function called to generate a pointer down animation
  6019. */
  6020. pointerDownAnimation: () => void;
  6021. /**
  6022. * Function called to generate a pointer up animation
  6023. */
  6024. pointerUpAnimation: () => void;
  6025. /**
  6026. * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
  6027. */
  6028. delegatePickingToChildren: boolean;
  6029. private _image;
  6030. /**
  6031. * Returns the image part of the button (if any)
  6032. */
  6033. get image(): BABYLON.Nullable<Image>;
  6034. private _textBlock;
  6035. /**
  6036. * Returns the image part of the button (if any)
  6037. */
  6038. get textBlock(): BABYLON.Nullable<TextBlock>;
  6039. /**
  6040. * Creates a new Button
  6041. * @param name defines the name of the button
  6042. */
  6043. constructor(name?: string | undefined);
  6044. protected _getTypeName(): string;
  6045. /** @hidden */
  6046. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  6047. /** @hidden */
  6048. _onPointerEnter(target: Control): boolean;
  6049. /** @hidden */
  6050. _onPointerOut(target: Control, force?: boolean): void;
  6051. /** @hidden */
  6052. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6053. /** @hidden */
  6054. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6055. /**
  6056. * Creates a new button made with an image and a text
  6057. * @param name defines the name of the button
  6058. * @param text defines the text of the button
  6059. * @param imageUrl defines the url of the image
  6060. * @returns a new Button
  6061. */
  6062. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  6063. /**
  6064. * Creates a new button made with an image
  6065. * @param name defines the name of the button
  6066. * @param imageUrl defines the url of the image
  6067. * @returns a new Button
  6068. */
  6069. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  6070. /**
  6071. * Creates a new button made with a text
  6072. * @param name defines the name of the button
  6073. * @param text defines the text of the button
  6074. * @returns a new Button
  6075. */
  6076. static CreateSimpleButton(name: string, text: string): Button;
  6077. /**
  6078. * Creates a new button made with an image and a centered text
  6079. * @param name defines the name of the button
  6080. * @param text defines the text of the button
  6081. * @param imageUrl defines the url of the image
  6082. * @returns a new Button
  6083. */
  6084. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  6085. }
  6086. }
  6087. declare module BABYLON.GUI {
  6088. /**
  6089. * Class used to create a 2D stack panel container
  6090. */
  6091. export class StackPanel extends Container {
  6092. name?: string | undefined;
  6093. private _isVertical;
  6094. private _manualWidth;
  6095. private _manualHeight;
  6096. private _doNotTrackManualChanges;
  6097. /**
  6098. * Gets or sets a boolean indicating that layou warnings should be ignored
  6099. */
  6100. ignoreLayoutWarnings: boolean;
  6101. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  6102. get isVertical(): boolean;
  6103. set isVertical(value: boolean);
  6104. /**
  6105. * Gets or sets panel width.
  6106. * This value should not be set when in horizontal mode as it will be computed automatically
  6107. */
  6108. set width(value: string | number);
  6109. get width(): string | number;
  6110. /**
  6111. * Gets or sets panel height.
  6112. * This value should not be set when in vertical mode as it will be computed automatically
  6113. */
  6114. set height(value: string | number);
  6115. get height(): string | number;
  6116. /**
  6117. * Creates a new StackPanel
  6118. * @param name defines control name
  6119. */
  6120. constructor(name?: string | undefined);
  6121. protected _getTypeName(): string;
  6122. /** @hidden */
  6123. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6124. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6125. protected _postMeasure(): void;
  6126. }
  6127. }
  6128. declare module BABYLON.GUI {
  6129. /**
  6130. * Class used to represent a 2D checkbox
  6131. */
  6132. export class Checkbox extends Control {
  6133. name?: string | undefined;
  6134. private _isChecked;
  6135. private _background;
  6136. private _checkSizeRatio;
  6137. private _thickness;
  6138. /** Gets or sets border thickness */
  6139. get thickness(): number;
  6140. set thickness(value: number);
  6141. /**
  6142. * BABYLON.Observable raised when isChecked property changes
  6143. */
  6144. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  6145. /** Gets or sets a value indicating the ratio between overall size and check size */
  6146. get checkSizeRatio(): number;
  6147. set checkSizeRatio(value: number);
  6148. /** Gets or sets background color */
  6149. get background(): string;
  6150. set background(value: string);
  6151. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  6152. get isChecked(): boolean;
  6153. set isChecked(value: boolean);
  6154. /**
  6155. * Creates a new CheckBox
  6156. * @param name defines the control name
  6157. */
  6158. constructor(name?: string | undefined);
  6159. protected _getTypeName(): string;
  6160. /** @hidden */
  6161. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6162. /** @hidden */
  6163. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6164. /**
  6165. * Utility function to easily create a checkbox with a header
  6166. * @param title defines the label to use for the header
  6167. * @param onValueChanged defines the callback to call when value changes
  6168. * @returns a StackPanel containing the checkbox and a textBlock
  6169. */
  6170. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  6171. }
  6172. }
  6173. declare module BABYLON.GUI {
  6174. /**
  6175. * Class used to store key control properties
  6176. */
  6177. export class KeyPropertySet {
  6178. /** Width */
  6179. width?: string;
  6180. /** Height */
  6181. height?: string;
  6182. /** Left padding */
  6183. paddingLeft?: string;
  6184. /** Right padding */
  6185. paddingRight?: string;
  6186. /** Top padding */
  6187. paddingTop?: string;
  6188. /** Bottom padding */
  6189. paddingBottom?: string;
  6190. /** Foreground color */
  6191. color?: string;
  6192. /** Background color */
  6193. background?: string;
  6194. }
  6195. /**
  6196. * Class used to create virtual keyboard
  6197. */
  6198. export class VirtualKeyboard extends StackPanel {
  6199. /** BABYLON.Observable raised when a key is pressed */
  6200. onKeyPressObservable: BABYLON.Observable<string>;
  6201. /** Gets or sets default key button width */
  6202. defaultButtonWidth: string;
  6203. /** Gets or sets default key button height */
  6204. defaultButtonHeight: string;
  6205. /** Gets or sets default key button left padding */
  6206. defaultButtonPaddingLeft: string;
  6207. /** Gets or sets default key button right padding */
  6208. defaultButtonPaddingRight: string;
  6209. /** Gets or sets default key button top padding */
  6210. defaultButtonPaddingTop: string;
  6211. /** Gets or sets default key button bottom padding */
  6212. defaultButtonPaddingBottom: string;
  6213. /** Gets or sets default key button foreground color */
  6214. defaultButtonColor: string;
  6215. /** Gets or sets default key button background color */
  6216. defaultButtonBackground: string;
  6217. /** Gets or sets shift button foreground color */
  6218. shiftButtonColor: string;
  6219. /** Gets or sets shift button thickness*/
  6220. selectedShiftThickness: number;
  6221. /** Gets shift key state */
  6222. shiftState: number;
  6223. protected _getTypeName(): string;
  6224. private _createKey;
  6225. /**
  6226. * Adds a new row of keys
  6227. * @param keys defines the list of keys to add
  6228. * @param propertySets defines the associated property sets
  6229. */
  6230. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  6231. /**
  6232. * Set the shift key to a specific state
  6233. * @param shiftState defines the new shift state
  6234. */
  6235. applyShiftState(shiftState: number): void;
  6236. private _currentlyConnectedInputText;
  6237. private _connectedInputTexts;
  6238. private _onKeyPressObserver;
  6239. /** Gets the input text control currently attached to the keyboard */
  6240. get connectedInputText(): BABYLON.Nullable<InputText>;
  6241. /**
  6242. * Connects the keyboard with an input text control
  6243. *
  6244. * @param input defines the target control
  6245. */
  6246. connect(input: InputText): void;
  6247. /**
  6248. * Disconnects the keyboard from connected InputText controls
  6249. *
  6250. * @param input optionally defines a target control, otherwise all are disconnected
  6251. */
  6252. disconnect(input?: InputText): void;
  6253. private _removeConnectedInputObservables;
  6254. /**
  6255. * Release all resources
  6256. */
  6257. dispose(): void;
  6258. /**
  6259. * Creates a new keyboard using a default layout
  6260. *
  6261. * @param name defines control name
  6262. * @returns a new VirtualKeyboard
  6263. */
  6264. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  6265. }
  6266. }
  6267. declare module BABYLON.GUI {
  6268. /**
  6269. * Class used to create input text control
  6270. */
  6271. export class InputText extends Control implements IFocusableControl {
  6272. name?: string | undefined;
  6273. private _text;
  6274. private _placeholderText;
  6275. private _background;
  6276. private _focusedBackground;
  6277. private _focusedColor;
  6278. private _placeholderColor;
  6279. private _thickness;
  6280. private _margin;
  6281. private _autoStretchWidth;
  6282. private _maxWidth;
  6283. private _isFocused;
  6284. private _blinkTimeout;
  6285. private _blinkIsEven;
  6286. private _cursorOffset;
  6287. private _scrollLeft;
  6288. private _textWidth;
  6289. private _clickedCoordinate;
  6290. private _deadKey;
  6291. private _addKey;
  6292. private _currentKey;
  6293. private _isTextHighlightOn;
  6294. private _textHighlightColor;
  6295. private _highligherOpacity;
  6296. private _highlightedText;
  6297. private _startHighlightIndex;
  6298. private _endHighlightIndex;
  6299. private _cursorIndex;
  6300. private _onFocusSelectAll;
  6301. private _isPointerDown;
  6302. private _onClipboardObserver;
  6303. private _onPointerDblTapObserver;
  6304. /** @hidden */
  6305. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  6306. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  6307. promptMessage: string;
  6308. /** Force disable prompt on mobile device */
  6309. disableMobilePrompt: boolean;
  6310. /** BABYLON.Observable raised when the text changes */
  6311. onTextChangedObservable: BABYLON.Observable<InputText>;
  6312. /** BABYLON.Observable raised just before an entered character is to be added */
  6313. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  6314. /** BABYLON.Observable raised when the control gets the focus */
  6315. onFocusObservable: BABYLON.Observable<InputText>;
  6316. /** BABYLON.Observable raised when the control loses the focus */
  6317. onBlurObservable: BABYLON.Observable<InputText>;
  6318. /**Observable raised when the text is highlighted */
  6319. onTextHighlightObservable: BABYLON.Observable<InputText>;
  6320. /**Observable raised when copy event is triggered */
  6321. onTextCopyObservable: BABYLON.Observable<InputText>;
  6322. /** BABYLON.Observable raised when cut event is triggered */
  6323. onTextCutObservable: BABYLON.Observable<InputText>;
  6324. /** BABYLON.Observable raised when paste event is triggered */
  6325. onTextPasteObservable: BABYLON.Observable<InputText>;
  6326. /** BABYLON.Observable raised when a key event was processed */
  6327. onKeyboardEventProcessedObservable: BABYLON.Observable<KeyboardEvent>;
  6328. /** Gets or sets the maximum width allowed by the control */
  6329. get maxWidth(): string | number;
  6330. /** Gets the maximum width allowed by the control in pixels */
  6331. get maxWidthInPixels(): number;
  6332. set maxWidth(value: string | number);
  6333. /** Gets or sets the text highlighter transparency; default: 0.4 */
  6334. get highligherOpacity(): number;
  6335. set highligherOpacity(value: number);
  6336. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  6337. get onFocusSelectAll(): boolean;
  6338. set onFocusSelectAll(value: boolean);
  6339. /** Gets or sets the text hightlight color */
  6340. get textHighlightColor(): string;
  6341. set textHighlightColor(value: string);
  6342. /** Gets or sets control margin */
  6343. get margin(): string;
  6344. /** Gets control margin in pixels */
  6345. get marginInPixels(): number;
  6346. set margin(value: string);
  6347. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  6348. get autoStretchWidth(): boolean;
  6349. set autoStretchWidth(value: boolean);
  6350. /** Gets or sets border thickness */
  6351. get thickness(): number;
  6352. set thickness(value: number);
  6353. /** Gets or sets the background color when focused */
  6354. get focusedBackground(): string;
  6355. set focusedBackground(value: string);
  6356. /** Gets or sets the background color when focused */
  6357. get focusedColor(): string;
  6358. set focusedColor(value: string);
  6359. /** Gets or sets the background color */
  6360. get background(): string;
  6361. set background(value: string);
  6362. /** Gets or sets the placeholder color */
  6363. get placeholderColor(): string;
  6364. set placeholderColor(value: string);
  6365. /** Gets or sets the text displayed when the control is empty */
  6366. get placeholderText(): string;
  6367. set placeholderText(value: string);
  6368. /** Gets or sets the dead key flag */
  6369. get deadKey(): boolean;
  6370. set deadKey(flag: boolean);
  6371. /** Gets or sets the highlight text */
  6372. get highlightedText(): string;
  6373. set highlightedText(text: string);
  6374. /** Gets or sets if the current key should be added */
  6375. get addKey(): boolean;
  6376. set addKey(flag: boolean);
  6377. /** Gets or sets the value of the current key being entered */
  6378. get currentKey(): string;
  6379. set currentKey(key: string);
  6380. /** Gets or sets the text displayed in the control */
  6381. get text(): string;
  6382. set text(value: string);
  6383. /** Gets or sets control width */
  6384. get width(): string | number;
  6385. set width(value: string | number);
  6386. /**
  6387. * Creates a new InputText
  6388. * @param name defines the control name
  6389. * @param text defines the text of the control
  6390. */
  6391. constructor(name?: string | undefined, text?: string);
  6392. /** @hidden */
  6393. onBlur(): void;
  6394. /** @hidden */
  6395. onFocus(): void;
  6396. protected _getTypeName(): string;
  6397. /**
  6398. * Function called to get the list of controls that should not steal the focus from this control
  6399. * @returns an array of controls
  6400. */
  6401. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  6402. /** @hidden */
  6403. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  6404. /** @hidden */
  6405. private _updateValueFromCursorIndex;
  6406. /** @hidden */
  6407. private _processDblClick;
  6408. /** @hidden */
  6409. private _selectAllText;
  6410. /**
  6411. * Handles the keyboard event
  6412. * @param evt Defines the KeyboardEvent
  6413. */
  6414. processKeyboard(evt: KeyboardEvent): void;
  6415. /** @hidden */
  6416. private _onCopyText;
  6417. /** @hidden */
  6418. private _onCutText;
  6419. /** @hidden */
  6420. private _onPasteText;
  6421. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6422. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6423. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  6424. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6425. protected _beforeRenderText(text: string): string;
  6426. dispose(): void;
  6427. }
  6428. }
  6429. declare module BABYLON.GUI {
  6430. /**
  6431. * Class used to create a 2D grid container
  6432. */
  6433. export class Grid extends Container {
  6434. name?: string | undefined;
  6435. private _rowDefinitions;
  6436. private _columnDefinitions;
  6437. private _cells;
  6438. private _childControls;
  6439. /**
  6440. * Gets the number of columns
  6441. */
  6442. get columnCount(): number;
  6443. /**
  6444. * Gets the number of rows
  6445. */
  6446. get rowCount(): number;
  6447. /** Gets the list of children */
  6448. get children(): Control[];
  6449. /** Gets the list of cells (e.g. the containers) */
  6450. get cells(): {
  6451. [key: string]: Container;
  6452. };
  6453. /**
  6454. * Gets the definition of a specific row
  6455. * @param index defines the index of the row
  6456. * @returns the row definition
  6457. */
  6458. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  6459. /**
  6460. * Gets the definition of a specific column
  6461. * @param index defines the index of the column
  6462. * @returns the column definition
  6463. */
  6464. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  6465. /**
  6466. * Adds a new row to the grid
  6467. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  6468. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  6469. * @returns the current grid
  6470. */
  6471. addRowDefinition(height: number, isPixel?: boolean): Grid;
  6472. /**
  6473. * Adds a new column to the grid
  6474. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  6475. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  6476. * @returns the current grid
  6477. */
  6478. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  6479. /**
  6480. * Update a row definition
  6481. * @param index defines the index of the row to update
  6482. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  6483. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  6484. * @returns the current grid
  6485. */
  6486. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  6487. /**
  6488. * Update a column definition
  6489. * @param index defines the index of the column to update
  6490. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  6491. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  6492. * @returns the current grid
  6493. */
  6494. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  6495. /**
  6496. * Gets the list of children stored in a specific cell
  6497. * @param row defines the row to check
  6498. * @param column defines the column to check
  6499. * @returns the list of controls
  6500. */
  6501. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  6502. /**
  6503. * Gets a string representing the child cell info (row x column)
  6504. * @param child defines the control to get info from
  6505. * @returns a string containing the child cell info (row x column)
  6506. */
  6507. getChildCellInfo(child: Control): string;
  6508. private _removeCell;
  6509. private _offsetCell;
  6510. /**
  6511. * Remove a column definition at specified index
  6512. * @param index defines the index of the column to remove
  6513. * @returns the current grid
  6514. */
  6515. removeColumnDefinition(index: number): Grid;
  6516. /**
  6517. * Remove a row definition at specified index
  6518. * @param index defines the index of the row to remove
  6519. * @returns the current grid
  6520. */
  6521. removeRowDefinition(index: number): Grid;
  6522. /**
  6523. * Adds a new control to the current grid
  6524. * @param control defines the control to add
  6525. * @param row defines the row where to add the control (0 by default)
  6526. * @param column defines the column where to add the control (0 by default)
  6527. * @returns the current grid
  6528. */
  6529. addControl(control: Control, row?: number, column?: number): Grid;
  6530. /**
  6531. * Removes a control from the current container
  6532. * @param control defines the control to remove
  6533. * @returns the current container
  6534. */
  6535. removeControl(control: Control): Container;
  6536. /**
  6537. * Creates a new Grid
  6538. * @param name defines control name
  6539. */
  6540. constructor(name?: string | undefined);
  6541. protected _getTypeName(): string;
  6542. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  6543. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6544. _flagDescendantsAsMatrixDirty(): void;
  6545. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  6546. /** Releases associated resources */
  6547. dispose(): void;
  6548. }
  6549. }
  6550. declare module BABYLON.GUI {
  6551. /** Class used to create color pickers */
  6552. export class ColorPicker extends Control {
  6553. name?: string | undefined;
  6554. private static _Epsilon;
  6555. private _colorWheelCanvas;
  6556. private _value;
  6557. private _tmpColor;
  6558. private _pointerStartedOnSquare;
  6559. private _pointerStartedOnWheel;
  6560. private _squareLeft;
  6561. private _squareTop;
  6562. private _squareSize;
  6563. private _h;
  6564. private _s;
  6565. private _v;
  6566. private _lastPointerDownID;
  6567. /**
  6568. * BABYLON.Observable raised when the value changes
  6569. */
  6570. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  6571. /** Gets or sets the color of the color picker */
  6572. get value(): BABYLON.Color3;
  6573. set value(value: BABYLON.Color3);
  6574. /**
  6575. * Gets or sets control width
  6576. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  6577. */
  6578. get width(): string | number;
  6579. set width(value: string | number);
  6580. /**
  6581. * Gets or sets control height
  6582. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  6583. */
  6584. get height(): string | number;
  6585. /** Gets or sets control height */
  6586. set height(value: string | number);
  6587. /** Gets or sets control size */
  6588. get size(): string | number;
  6589. set size(value: string | number);
  6590. /**
  6591. * Creates a new ColorPicker
  6592. * @param name defines the control name
  6593. */
  6594. constructor(name?: string | undefined);
  6595. protected _getTypeName(): string;
  6596. /** @hidden */
  6597. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6598. private _updateSquareProps;
  6599. private _drawGradientSquare;
  6600. private _drawCircle;
  6601. private _createColorWheelCanvas;
  6602. /** @hidden */
  6603. _draw(context: CanvasRenderingContext2D): void;
  6604. private _pointerIsDown;
  6605. private _updateValueFromPointer;
  6606. private _isPointOnSquare;
  6607. private _isPointOnWheel;
  6608. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6609. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  6610. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6611. /**
  6612. * This function expands the color picker by creating a color picker dialog with manual
  6613. * color value input and the ability to save colors into an array to be used later in
  6614. * subsequent launches of the dialogue.
  6615. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  6616. * @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.
  6617. * @returns picked color as a hex string and the saved colors array as hex strings.
  6618. */
  6619. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  6620. pickerWidth?: string;
  6621. pickerHeight?: string;
  6622. headerHeight?: string;
  6623. lastColor?: string;
  6624. swatchLimit?: number;
  6625. numSwatchesPerLine?: number;
  6626. savedColors?: Array<string>;
  6627. }): Promise<{
  6628. savedColors?: string[];
  6629. pickedColor: string;
  6630. }>;
  6631. }
  6632. }
  6633. declare module BABYLON.GUI {
  6634. /** Class used to create 2D ellipse containers */
  6635. export class Ellipse extends Container {
  6636. name?: string | undefined;
  6637. private _thickness;
  6638. /** Gets or sets border thickness */
  6639. get thickness(): number;
  6640. set thickness(value: number);
  6641. /**
  6642. * Creates a new Ellipse
  6643. * @param name defines the control name
  6644. */
  6645. constructor(name?: string | undefined);
  6646. protected _getTypeName(): string;
  6647. protected _localDraw(context: CanvasRenderingContext2D): void;
  6648. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6649. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  6650. }
  6651. }
  6652. declare module BABYLON.GUI {
  6653. /**
  6654. * Class used to create a password control
  6655. */
  6656. export class InputPassword extends InputText {
  6657. protected _beforeRenderText(text: string): string;
  6658. }
  6659. }
  6660. declare module BABYLON.GUI {
  6661. /** Class used to render 2D lines */
  6662. export class Line extends Control {
  6663. name?: string | undefined;
  6664. private _lineWidth;
  6665. private _x1;
  6666. private _y1;
  6667. private _x2;
  6668. private _y2;
  6669. private _dash;
  6670. private _connectedControl;
  6671. private _connectedControlDirtyObserver;
  6672. /** Gets or sets the dash pattern */
  6673. get dash(): Array<number>;
  6674. set dash(value: Array<number>);
  6675. /** Gets or sets the control connected with the line end */
  6676. get connectedControl(): Control;
  6677. set connectedControl(value: Control);
  6678. /** Gets or sets start coordinates on X axis */
  6679. get x1(): string | number;
  6680. set x1(value: string | number);
  6681. /** Gets or sets start coordinates on Y axis */
  6682. get y1(): string | number;
  6683. set y1(value: string | number);
  6684. /** Gets or sets end coordinates on X axis */
  6685. get x2(): string | number;
  6686. set x2(value: string | number);
  6687. /** Gets or sets end coordinates on Y axis */
  6688. get y2(): string | number;
  6689. set y2(value: string | number);
  6690. /** Gets or sets line width */
  6691. get lineWidth(): number;
  6692. set lineWidth(value: number);
  6693. /** Gets or sets horizontal alignment */
  6694. set horizontalAlignment(value: number);
  6695. /** Gets or sets vertical alignment */
  6696. set verticalAlignment(value: number);
  6697. private get _effectiveX2();
  6698. private get _effectiveY2();
  6699. /**
  6700. * Creates a new Line
  6701. * @param name defines the control name
  6702. */
  6703. constructor(name?: string | undefined);
  6704. protected _getTypeName(): string;
  6705. _draw(context: CanvasRenderingContext2D): void;
  6706. _measure(): void;
  6707. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6708. /**
  6709. * Move one end of the line given 3D cartesian coordinates.
  6710. * @param position Targeted world position
  6711. * @param scene BABYLON.Scene
  6712. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  6713. */
  6714. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  6715. /**
  6716. * Move one end of the line to a position in screen absolute space.
  6717. * @param projectedPosition Position in screen absolute space (X, Y)
  6718. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  6719. */
  6720. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  6721. }
  6722. }
  6723. declare module BABYLON.GUI {
  6724. /**
  6725. * Class used to store a point for a MultiLine object.
  6726. * The point can be pure 2D coordinates, a mesh or a control
  6727. */
  6728. export class MultiLinePoint {
  6729. private _multiLine;
  6730. private _x;
  6731. private _y;
  6732. private _control;
  6733. private _mesh;
  6734. private _controlObserver;
  6735. private _meshObserver;
  6736. /** @hidden */
  6737. _point: BABYLON.Vector2;
  6738. /**
  6739. * Creates a new MultiLinePoint
  6740. * @param multiLine defines the source MultiLine object
  6741. */
  6742. constructor(multiLine: MultiLine);
  6743. /** Gets or sets x coordinate */
  6744. get x(): string | number;
  6745. set x(value: string | number);
  6746. /** Gets or sets y coordinate */
  6747. get y(): string | number;
  6748. set y(value: string | number);
  6749. /** Gets or sets the control associated with this point */
  6750. get control(): BABYLON.Nullable<Control>;
  6751. set control(value: BABYLON.Nullable<Control>);
  6752. /** Gets or sets the mesh associated with this point */
  6753. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  6754. set mesh(value: BABYLON.Nullable<BABYLON.AbstractMesh>);
  6755. /** Resets links */
  6756. resetLinks(): void;
  6757. /**
  6758. * Gets a translation vector
  6759. * @returns the translation vector
  6760. */
  6761. translate(): BABYLON.Vector2;
  6762. private _translatePoint;
  6763. /** Release associated resources */
  6764. dispose(): void;
  6765. }
  6766. }
  6767. declare module BABYLON.GUI {
  6768. /**
  6769. * Class used to create multi line control
  6770. */
  6771. export class MultiLine extends Control {
  6772. name?: string | undefined;
  6773. private _lineWidth;
  6774. private _dash;
  6775. private _points;
  6776. private _minX;
  6777. private _minY;
  6778. private _maxX;
  6779. private _maxY;
  6780. /**
  6781. * Creates a new MultiLine
  6782. * @param name defines the control name
  6783. */
  6784. constructor(name?: string | undefined);
  6785. /** Gets or sets dash pattern */
  6786. get dash(): Array<number>;
  6787. set dash(value: Array<number>);
  6788. /**
  6789. * Gets point stored at specified index
  6790. * @param index defines the index to look for
  6791. * @returns the requested point if found
  6792. */
  6793. getAt(index: number): MultiLinePoint;
  6794. /** Function called when a point is updated */
  6795. onPointUpdate: () => void;
  6796. /**
  6797. * Adds new points to the point collection
  6798. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  6799. * @returns the list of created MultiLinePoint
  6800. */
  6801. add(...items: (AbstractMesh | Control | {
  6802. x: string | number;
  6803. y: string | number;
  6804. })[]): MultiLinePoint[];
  6805. /**
  6806. * Adds a new point to the point collection
  6807. * @param item defines the item (mesh, control or 2d coordiantes) to add
  6808. * @returns the created MultiLinePoint
  6809. */
  6810. push(item?: (AbstractMesh | Control | {
  6811. x: string | number;
  6812. y: string | number;
  6813. })): MultiLinePoint;
  6814. /**
  6815. * Remove a specific value or point from the active point collection
  6816. * @param value defines the value or point to remove
  6817. */
  6818. remove(value: number | MultiLinePoint): void;
  6819. /**
  6820. * Resets this object to initial state (no point)
  6821. */
  6822. reset(): void;
  6823. /**
  6824. * Resets all links
  6825. */
  6826. resetLinks(): void;
  6827. /** Gets or sets line width */
  6828. get lineWidth(): number;
  6829. set lineWidth(value: number);
  6830. set horizontalAlignment(value: number);
  6831. set verticalAlignment(value: number);
  6832. protected _getTypeName(): string;
  6833. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6834. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6835. _measure(): void;
  6836. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  6837. dispose(): void;
  6838. }
  6839. }
  6840. declare module BABYLON.GUI {
  6841. /**
  6842. * Class used to create radio button controls
  6843. */
  6844. export class RadioButton extends Control {
  6845. name?: string | undefined;
  6846. private _isChecked;
  6847. private _background;
  6848. private _checkSizeRatio;
  6849. private _thickness;
  6850. /** Gets or sets border thickness */
  6851. get thickness(): number;
  6852. set thickness(value: number);
  6853. /** Gets or sets group name */
  6854. group: string;
  6855. /** BABYLON.Observable raised when isChecked is changed */
  6856. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  6857. /** Gets or sets a value indicating the ratio between overall size and check size */
  6858. get checkSizeRatio(): number;
  6859. set checkSizeRatio(value: number);
  6860. /** Gets or sets background color */
  6861. get background(): string;
  6862. set background(value: string);
  6863. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  6864. get isChecked(): boolean;
  6865. set isChecked(value: boolean);
  6866. /**
  6867. * Creates a new RadioButton
  6868. * @param name defines the control name
  6869. */
  6870. constructor(name?: string | undefined);
  6871. protected _getTypeName(): string;
  6872. _draw(context: CanvasRenderingContext2D): void;
  6873. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6874. /**
  6875. * Utility function to easily create a radio button with a header
  6876. * @param title defines the label to use for the header
  6877. * @param group defines the group to use for the radio button
  6878. * @param isChecked defines the initial state of the radio button
  6879. * @param onValueChanged defines the callback to call when value changes
  6880. * @returns a StackPanel containing the radio button and a textBlock
  6881. */
  6882. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  6883. }
  6884. }
  6885. declare module BABYLON.GUI {
  6886. /**
  6887. * Class used to create slider controls
  6888. */
  6889. export class BaseSlider extends Control {
  6890. name?: string | undefined;
  6891. protected _thumbWidth: ValueAndUnit;
  6892. private _minimum;
  6893. private _maximum;
  6894. private _value;
  6895. private _isVertical;
  6896. protected _barOffset: ValueAndUnit;
  6897. private _isThumbClamped;
  6898. protected _displayThumb: boolean;
  6899. private _step;
  6900. private _lastPointerDownID;
  6901. protected _effectiveBarOffset: number;
  6902. protected _renderLeft: number;
  6903. protected _renderTop: number;
  6904. protected _renderWidth: number;
  6905. protected _renderHeight: number;
  6906. protected _backgroundBoxLength: number;
  6907. protected _backgroundBoxThickness: number;
  6908. protected _effectiveThumbThickness: number;
  6909. /** BABYLON.Observable raised when the sldier value changes */
  6910. onValueChangedObservable: BABYLON.Observable<number>;
  6911. /** Gets or sets a boolean indicating if the thumb must be rendered */
  6912. get displayThumb(): boolean;
  6913. set displayThumb(value: boolean);
  6914. /** Gets or sets a step to apply to values (0 by default) */
  6915. get step(): number;
  6916. set step(value: number);
  6917. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  6918. get barOffset(): string | number;
  6919. /** Gets main bar offset in pixels*/
  6920. get barOffsetInPixels(): number;
  6921. set barOffset(value: string | number);
  6922. /** Gets or sets thumb width */
  6923. get thumbWidth(): string | number;
  6924. /** Gets thumb width in pixels */
  6925. get thumbWidthInPixels(): number;
  6926. set thumbWidth(value: string | number);
  6927. /** Gets or sets minimum value */
  6928. get minimum(): number;
  6929. set minimum(value: number);
  6930. /** Gets or sets maximum value */
  6931. get maximum(): number;
  6932. set maximum(value: number);
  6933. /** Gets or sets current value */
  6934. get value(): number;
  6935. set value(value: number);
  6936. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  6937. get isVertical(): boolean;
  6938. set isVertical(value: boolean);
  6939. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  6940. get isThumbClamped(): boolean;
  6941. set isThumbClamped(value: boolean);
  6942. /**
  6943. * Creates a new BaseSlider
  6944. * @param name defines the control name
  6945. */
  6946. constructor(name?: string | undefined);
  6947. protected _getTypeName(): string;
  6948. protected _getThumbPosition(): number;
  6949. protected _getThumbThickness(type: string): number;
  6950. protected _prepareRenderingData(type: string): void;
  6951. private _pointerIsDown;
  6952. /** @hidden */
  6953. protected _updateValueFromPointer(x: number, y: number): void;
  6954. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  6955. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number): void;
  6956. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  6957. }
  6958. }
  6959. declare module BABYLON.GUI {
  6960. /**
  6961. * Class used to create slider controls
  6962. */
  6963. export class Slider extends BaseSlider {
  6964. name?: string | undefined;
  6965. private _background;
  6966. private _borderColor;
  6967. private _isThumbCircle;
  6968. protected _displayValueBar: boolean;
  6969. /** Gets or sets a boolean indicating if the value bar must be rendered */
  6970. get displayValueBar(): boolean;
  6971. set displayValueBar(value: boolean);
  6972. /** Gets or sets border color */
  6973. get borderColor(): string;
  6974. set borderColor(value: string);
  6975. /** Gets or sets background color */
  6976. get background(): string;
  6977. set background(value: string);
  6978. /** Gets or sets a boolean indicating if the thumb should be round or square */
  6979. get isThumbCircle(): boolean;
  6980. set isThumbCircle(value: boolean);
  6981. /**
  6982. * Creates a new Slider
  6983. * @param name defines the control name
  6984. */
  6985. constructor(name?: string | undefined);
  6986. protected _getTypeName(): string;
  6987. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  6988. }
  6989. }
  6990. declare module BABYLON.GUI {
  6991. /** Class used to create a RadioGroup
  6992. * which contains groups of radio buttons
  6993. */
  6994. export class SelectorGroup {
  6995. /** name of SelectorGroup */
  6996. name: string;
  6997. private _groupPanel;
  6998. private _selectors;
  6999. private _groupHeader;
  7000. /**
  7001. * Creates a new SelectorGroup
  7002. * @param name of group, used as a group heading
  7003. */
  7004. constructor(
  7005. /** name of SelectorGroup */
  7006. name: string);
  7007. /** Gets the groupPanel of the SelectorGroup */
  7008. get groupPanel(): StackPanel;
  7009. /** Gets the selectors array */
  7010. get selectors(): StackPanel[];
  7011. /** Gets and sets the group header */
  7012. get header(): string;
  7013. set header(label: string);
  7014. /** @hidden */
  7015. private _addGroupHeader;
  7016. /** @hidden*/
  7017. _getSelector(selectorNb: number): StackPanel | undefined;
  7018. /** Removes the selector at the given position
  7019. * @param selectorNb the position of the selector within the group
  7020. */
  7021. removeSelector(selectorNb: number): void;
  7022. }
  7023. /** Class used to create a CheckboxGroup
  7024. * which contains groups of checkbox buttons
  7025. */
  7026. export class CheckboxGroup extends SelectorGroup {
  7027. /** Adds a checkbox as a control
  7028. * @param text is the label for the selector
  7029. * @param func is the function called when the Selector is checked
  7030. * @param checked is true when Selector is checked
  7031. */
  7032. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  7033. /** @hidden */
  7034. _setSelectorLabel(selectorNb: number, label: string): void;
  7035. /** @hidden */
  7036. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7037. /** @hidden */
  7038. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7039. /** @hidden */
  7040. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7041. }
  7042. /** Class used to create a RadioGroup
  7043. * which contains groups of radio buttons
  7044. */
  7045. export class RadioGroup extends SelectorGroup {
  7046. private _selectNb;
  7047. /** Adds a radio button as a control
  7048. * @param label is the label for the selector
  7049. * @param func is the function called when the Selector is checked
  7050. * @param checked is true when Selector is checked
  7051. */
  7052. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  7053. /** @hidden */
  7054. _setSelectorLabel(selectorNb: number, label: string): void;
  7055. /** @hidden */
  7056. _setSelectorLabelColor(selectorNb: number, color: string): void;
  7057. /** @hidden */
  7058. _setSelectorButtonColor(selectorNb: number, color: string): void;
  7059. /** @hidden */
  7060. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  7061. }
  7062. /** Class used to create a SliderGroup
  7063. * which contains groups of slider buttons
  7064. */
  7065. export class SliderGroup extends SelectorGroup {
  7066. /**
  7067. * Adds a slider to the SelectorGroup
  7068. * @param label is the label for the SliderBar
  7069. * @param func is the function called when the Slider moves
  7070. * @param unit is a string describing the units used, eg degrees or metres
  7071. * @param min is the minimum value for the Slider
  7072. * @param max is the maximum value for the Slider
  7073. * @param value is the start value for the Slider between min and max
  7074. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  7075. */
  7076. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): 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 hold the controls for the checkboxes, radio buttons and sliders
  7087. * @see http://doc.babylonjs.com/how_to/selector
  7088. */
  7089. export class SelectionPanel extends Rectangle {
  7090. /** name of SelectionPanel */
  7091. name: string;
  7092. /** an array of SelectionGroups */
  7093. groups: SelectorGroup[];
  7094. private _panel;
  7095. private _buttonColor;
  7096. private _buttonBackground;
  7097. private _headerColor;
  7098. private _barColor;
  7099. private _barHeight;
  7100. private _spacerHeight;
  7101. private _labelColor;
  7102. private _groups;
  7103. private _bars;
  7104. /**
  7105. * Creates a new SelectionPanel
  7106. * @param name of SelectionPanel
  7107. * @param groups is an array of SelectionGroups
  7108. */
  7109. constructor(
  7110. /** name of SelectionPanel */
  7111. name: string,
  7112. /** an array of SelectionGroups */
  7113. groups?: SelectorGroup[]);
  7114. protected _getTypeName(): string;
  7115. /** Gets or sets the headerColor */
  7116. get headerColor(): string;
  7117. set headerColor(color: string);
  7118. private _setHeaderColor;
  7119. /** Gets or sets the button color */
  7120. get buttonColor(): string;
  7121. set buttonColor(color: string);
  7122. private _setbuttonColor;
  7123. /** Gets or sets the label color */
  7124. get labelColor(): string;
  7125. set labelColor(color: string);
  7126. private _setLabelColor;
  7127. /** Gets or sets the button background */
  7128. get buttonBackground(): string;
  7129. set buttonBackground(color: string);
  7130. private _setButtonBackground;
  7131. /** Gets or sets the color of separator bar */
  7132. get barColor(): string;
  7133. set barColor(color: string);
  7134. private _setBarColor;
  7135. /** Gets or sets the height of separator bar */
  7136. get barHeight(): string;
  7137. set barHeight(value: string);
  7138. private _setBarHeight;
  7139. /** Gets or sets the height of spacers*/
  7140. get spacerHeight(): string;
  7141. set spacerHeight(value: string);
  7142. private _setSpacerHeight;
  7143. /** Adds a bar between groups */
  7144. private _addSpacer;
  7145. /** Add a group to the selection panel
  7146. * @param group is the selector group to add
  7147. */
  7148. addGroup(group: SelectorGroup): void;
  7149. /** Remove the group from the given position
  7150. * @param groupNb is the position of the group in the list
  7151. */
  7152. removeGroup(groupNb: number): void;
  7153. /** Change a group header label
  7154. * @param label is the new group header label
  7155. * @param groupNb is the number of the group to relabel
  7156. * */
  7157. setHeaderName(label: string, groupNb: number): void;
  7158. /** Change selector label to the one given
  7159. * @param label is the new selector label
  7160. * @param groupNb is the number of the groupcontaining the selector
  7161. * @param selectorNb is the number of the selector within a group to relabel
  7162. * */
  7163. relabel(label: string, groupNb: number, selectorNb: number): void;
  7164. /** For a given group position remove the selector at the given position
  7165. * @param groupNb is the number of the group to remove the selector from
  7166. * @param selectorNb is the number of the selector within the group
  7167. */
  7168. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  7169. /** For a given group position of correct type add a checkbox button
  7170. * @param groupNb is the number of the group to remove the selector from
  7171. * @param label is the label for the selector
  7172. * @param func is the function called when the Selector is checked
  7173. * @param checked is true when Selector is checked
  7174. */
  7175. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  7176. /** For a given group position of correct type add a radio button
  7177. * @param groupNb is the number of the group to remove the selector from
  7178. * @param label is the label for the selector
  7179. * @param func is the function called when the Selector is checked
  7180. * @param checked is true when Selector is checked
  7181. */
  7182. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  7183. /**
  7184. * For a given slider group add a slider
  7185. * @param groupNb is the number of the group to add the slider to
  7186. * @param label is the label for the Slider
  7187. * @param func is the function called when the Slider moves
  7188. * @param unit is a string describing the units used, eg degrees or metres
  7189. * @param min is the minimum value for the Slider
  7190. * @param max is the maximum value for the Slider
  7191. * @param value is the start value for the Slider between min and max
  7192. * @param onVal is the function used to format the value displayed, eg radians to degrees
  7193. */
  7194. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  7195. }
  7196. }
  7197. declare module BABYLON.GUI {
  7198. /**
  7199. * Class used to hold a the container for ScrollViewer
  7200. * @hidden
  7201. */
  7202. export class _ScrollViewerWindow extends Container {
  7203. parentClientWidth: number;
  7204. parentClientHeight: number;
  7205. private _freezeControls;
  7206. private _parentMeasure;
  7207. private _oldLeft;
  7208. private _oldTop;
  7209. get freezeControls(): boolean;
  7210. set freezeControls(value: boolean);
  7211. private _bucketWidth;
  7212. private _bucketHeight;
  7213. private _buckets;
  7214. private _bucketLen;
  7215. get bucketWidth(): number;
  7216. get bucketHeight(): number;
  7217. setBucketSizes(width: number, height: number): void;
  7218. private _useBuckets;
  7219. private _makeBuckets;
  7220. private _dispatchInBuckets;
  7221. private _updateMeasures;
  7222. private _updateChildrenMeasures;
  7223. /**
  7224. * Creates a new ScrollViewerWindow
  7225. * @param name of ScrollViewerWindow
  7226. */
  7227. constructor(name?: string);
  7228. protected _getTypeName(): string;
  7229. /** @hidden */
  7230. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7231. /** @hidden */
  7232. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  7233. private _scrollChildren;
  7234. private _scrollChildrenWithBuckets;
  7235. /** @hidden */
  7236. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  7237. protected _postMeasure(): void;
  7238. }
  7239. }
  7240. declare module BABYLON.GUI {
  7241. /**
  7242. * Class used to create slider controls
  7243. */
  7244. export class ScrollBar extends BaseSlider {
  7245. name?: string | undefined;
  7246. private _background;
  7247. private _borderColor;
  7248. private _tempMeasure;
  7249. /** Gets or sets border color */
  7250. get borderColor(): string;
  7251. set borderColor(value: string);
  7252. /** Gets or sets background color */
  7253. get background(): string;
  7254. set background(value: string);
  7255. /**
  7256. * Creates a new Slider
  7257. * @param name defines the control name
  7258. */
  7259. constructor(name?: string | undefined);
  7260. protected _getTypeName(): string;
  7261. protected _getThumbThickness(): number;
  7262. _draw(context: CanvasRenderingContext2D): void;
  7263. private _first;
  7264. private _originX;
  7265. private _originY;
  7266. /** @hidden */
  7267. protected _updateValueFromPointer(x: number, y: number): void;
  7268. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  7269. }
  7270. }
  7271. declare module BABYLON.GUI {
  7272. /**
  7273. * Class used to create slider controls
  7274. */
  7275. export class ImageScrollBar extends BaseSlider {
  7276. name?: string | undefined;
  7277. private _backgroundBaseImage;
  7278. private _backgroundImage;
  7279. private _thumbImage;
  7280. private _thumbBaseImage;
  7281. private _thumbLength;
  7282. private _thumbHeight;
  7283. private _barImageHeight;
  7284. private _tempMeasure;
  7285. /**
  7286. * Gets or sets the image used to render the background for horizontal bar
  7287. */
  7288. get backgroundImage(): Image;
  7289. set backgroundImage(value: Image);
  7290. /**
  7291. * Gets or sets the image used to render the thumb
  7292. */
  7293. get thumbImage(): Image;
  7294. set thumbImage(value: Image);
  7295. /**
  7296. * Gets or sets the length of the thumb
  7297. */
  7298. get thumbLength(): number;
  7299. set thumbLength(value: number);
  7300. /**
  7301. * Gets or sets the height of the thumb
  7302. */
  7303. get thumbHeight(): number;
  7304. set thumbHeight(value: number);
  7305. /**
  7306. * Gets or sets the height of the bar image
  7307. */
  7308. get barImageHeight(): number;
  7309. set barImageHeight(value: number);
  7310. /**
  7311. * Creates a new ImageScrollBar
  7312. * @param name defines the control name
  7313. */
  7314. constructor(name?: string | undefined);
  7315. protected _getTypeName(): string;
  7316. protected _getThumbThickness(): number;
  7317. _draw(context: CanvasRenderingContext2D): void;
  7318. private _first;
  7319. private _originX;
  7320. private _originY;
  7321. /** @hidden */
  7322. protected _updateValueFromPointer(x: number, y: number): void;
  7323. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  7324. }
  7325. }
  7326. declare module BABYLON.GUI {
  7327. /**
  7328. * Class used to hold a viewer window and sliders in a grid
  7329. */
  7330. export class ScrollViewer extends Rectangle {
  7331. private _grid;
  7332. private _horizontalBarSpace;
  7333. private _verticalBarSpace;
  7334. private _dragSpace;
  7335. private _horizontalBar;
  7336. private _verticalBar;
  7337. private _barColor;
  7338. private _barBackground;
  7339. private _barImage;
  7340. private _barBackgroundImage;
  7341. private _barSize;
  7342. private _window;
  7343. private _pointerIsOver;
  7344. private _wheelPrecision;
  7345. private _onPointerObserver;
  7346. private _clientWidth;
  7347. private _clientHeight;
  7348. private _useImageBar;
  7349. private _thumbLength;
  7350. private _thumbHeight;
  7351. private _barImageHeight;
  7352. /**
  7353. * Gets the horizontal scrollbar
  7354. */
  7355. get horizontalBar(): ScrollBar | ImageScrollBar;
  7356. /**
  7357. * Gets the vertical scrollbar
  7358. */
  7359. get verticalBar(): ScrollBar | ImageScrollBar;
  7360. /**
  7361. * Adds a new control to the current container
  7362. * @param control defines the control to add
  7363. * @returns the current container
  7364. */
  7365. addControl(control: BABYLON.Nullable<Control>): Container;
  7366. /**
  7367. * Removes a control from the current container
  7368. * @param control defines the control to remove
  7369. * @returns the current container
  7370. */
  7371. removeControl(control: Control): Container;
  7372. /** Gets the list of children */
  7373. get children(): Control[];
  7374. _flagDescendantsAsMatrixDirty(): void;
  7375. /**
  7376. * Freezes or unfreezes the controls in the window.
  7377. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  7378. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  7379. */
  7380. get freezeControls(): boolean;
  7381. set freezeControls(value: boolean);
  7382. /** Gets the bucket width */
  7383. get bucketWidth(): number;
  7384. /** Gets the bucket height */
  7385. get bucketHeight(): number;
  7386. /**
  7387. * Sets the bucket sizes.
  7388. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  7389. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  7390. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  7391. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  7392. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  7393. * used), that's why it is not enabled by default.
  7394. * @param width width of the bucket
  7395. * @param height height of the bucket
  7396. */
  7397. setBucketSizes(width: number, height: number): void;
  7398. private _forceHorizontalBar;
  7399. private _forceVerticalBar;
  7400. /**
  7401. * Forces the horizontal scroll bar to be displayed
  7402. */
  7403. get forceHorizontalBar(): boolean;
  7404. set forceHorizontalBar(value: boolean);
  7405. /**
  7406. * Forces the vertical scroll bar to be displayed
  7407. */
  7408. get forceVerticalBar(): boolean;
  7409. set forceVerticalBar(value: boolean);
  7410. /**
  7411. * Creates a new ScrollViewer
  7412. * @param name of ScrollViewer
  7413. */
  7414. constructor(name?: string, isImageBased?: boolean);
  7415. /** Reset the scroll viewer window to initial size */
  7416. resetWindow(): void;
  7417. protected _getTypeName(): string;
  7418. private _buildClientSizes;
  7419. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  7420. protected _postMeasure(): void;
  7421. /**
  7422. * Gets or sets the mouse wheel precision
  7423. * from 0 to 1 with a default value of 0.05
  7424. * */
  7425. get wheelPrecision(): number;
  7426. set wheelPrecision(value: number);
  7427. /** Gets or sets the scroll bar container background color */
  7428. get scrollBackground(): string;
  7429. set scrollBackground(color: string);
  7430. /** Gets or sets the bar color */
  7431. get barColor(): string;
  7432. set barColor(color: string);
  7433. /** Gets or sets the bar image */
  7434. get thumbImage(): Image;
  7435. set thumbImage(value: Image);
  7436. /** Gets or sets the size of the bar */
  7437. get barSize(): number;
  7438. set barSize(value: number);
  7439. /** Gets or sets the length of the thumb */
  7440. get thumbLength(): number;
  7441. set thumbLength(value: number);
  7442. /** Gets or sets the height of the thumb */
  7443. get thumbHeight(): number;
  7444. set thumbHeight(value: number);
  7445. /** Gets or sets the height of the bar image */
  7446. get barImageHeight(): number;
  7447. set barImageHeight(value: number);
  7448. /** Gets or sets the bar background */
  7449. get barBackground(): string;
  7450. set barBackground(color: string);
  7451. /** Gets or sets the bar background image */
  7452. get barImage(): Image;
  7453. set barImage(value: Image);
  7454. private _setWindowPosition;
  7455. /** @hidden */
  7456. private _updateScroller;
  7457. _link(host: AdvancedDynamicTexture): void;
  7458. /** @hidden */
  7459. private _addBar;
  7460. /** @hidden */
  7461. private _attachWheel;
  7462. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  7463. /** Releases associated resources */
  7464. dispose(): void;
  7465. }
  7466. }
  7467. declare module BABYLON.GUI {
  7468. /** Class used to render a grid */
  7469. export class DisplayGrid extends Control {
  7470. name?: string | undefined;
  7471. private _cellWidth;
  7472. private _cellHeight;
  7473. private _minorLineTickness;
  7474. private _minorLineColor;
  7475. private _majorLineTickness;
  7476. private _majorLineColor;
  7477. private _majorLineFrequency;
  7478. private _background;
  7479. private _displayMajorLines;
  7480. private _displayMinorLines;
  7481. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  7482. get displayMinorLines(): boolean;
  7483. set displayMinorLines(value: boolean);
  7484. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  7485. get displayMajorLines(): boolean;
  7486. set displayMajorLines(value: boolean);
  7487. /** Gets or sets background color (Black by default) */
  7488. get background(): string;
  7489. set background(value: string);
  7490. /** Gets or sets the width of each cell (20 by default) */
  7491. get cellWidth(): number;
  7492. set cellWidth(value: number);
  7493. /** Gets or sets the height of each cell (20 by default) */
  7494. get cellHeight(): number;
  7495. set cellHeight(value: number);
  7496. /** Gets or sets the tickness of minor lines (1 by default) */
  7497. get minorLineTickness(): number;
  7498. set minorLineTickness(value: number);
  7499. /** Gets or sets the color of minor lines (DarkGray by default) */
  7500. get minorLineColor(): string;
  7501. set minorLineColor(value: string);
  7502. /** Gets or sets the tickness of major lines (2 by default) */
  7503. get majorLineTickness(): number;
  7504. set majorLineTickness(value: number);
  7505. /** Gets or sets the color of major lines (White by default) */
  7506. get majorLineColor(): string;
  7507. set majorLineColor(value: string);
  7508. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  7509. get majorLineFrequency(): number;
  7510. set majorLineFrequency(value: number);
  7511. /**
  7512. * Creates a new GridDisplayRectangle
  7513. * @param name defines the control name
  7514. */
  7515. constructor(name?: string | undefined);
  7516. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7517. protected _getTypeName(): string;
  7518. }
  7519. }
  7520. declare module BABYLON.GUI {
  7521. /**
  7522. * Class used to create slider controls based on images
  7523. */
  7524. export class ImageBasedSlider extends BaseSlider {
  7525. name?: string | undefined;
  7526. private _backgroundImage;
  7527. private _thumbImage;
  7528. private _valueBarImage;
  7529. private _tempMeasure;
  7530. get displayThumb(): boolean;
  7531. set displayThumb(value: boolean);
  7532. /**
  7533. * Gets or sets the image used to render the background
  7534. */
  7535. get backgroundImage(): Image;
  7536. set backgroundImage(value: Image);
  7537. /**
  7538. * Gets or sets the image used to render the value bar
  7539. */
  7540. get valueBarImage(): Image;
  7541. set valueBarImage(value: Image);
  7542. /**
  7543. * Gets or sets the image used to render the thumb
  7544. */
  7545. get thumbImage(): Image;
  7546. set thumbImage(value: Image);
  7547. /**
  7548. * Creates a new ImageBasedSlider
  7549. * @param name defines the control name
  7550. */
  7551. constructor(name?: string | undefined);
  7552. protected _getTypeName(): string;
  7553. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  7554. }
  7555. }
  7556. declare module BABYLON.GUI {
  7557. /**
  7558. * Forcing an export so that this code will execute
  7559. * @hidden
  7560. */
  7561. const name = "Statics";
  7562. }
  7563. declare module BABYLON.GUI {
  7564. /**
  7565. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  7566. */
  7567. export class AdvancedDynamicTextureInstrumentation implements BABYLON.IDisposable {
  7568. /**
  7569. * Define the instrumented AdvancedDynamicTexture.
  7570. */
  7571. texture: AdvancedDynamicTexture;
  7572. private _captureRenderTime;
  7573. private _renderTime;
  7574. private _captureLayoutTime;
  7575. private _layoutTime;
  7576. private _onBeginRenderObserver;
  7577. private _onEndRenderObserver;
  7578. private _onBeginLayoutObserver;
  7579. private _onEndLayoutObserver;
  7580. /**
  7581. * Gets the perf counter used to capture render time
  7582. */
  7583. get renderTimeCounter(): BABYLON.PerfCounter;
  7584. /**
  7585. * Gets the perf counter used to capture layout time
  7586. */
  7587. get layoutTimeCounter(): BABYLON.PerfCounter;
  7588. /**
  7589. * Enable or disable the render time capture
  7590. */
  7591. get captureRenderTime(): boolean;
  7592. set captureRenderTime(value: boolean);
  7593. /**
  7594. * Enable or disable the layout time capture
  7595. */
  7596. get captureLayoutTime(): boolean;
  7597. set captureLayoutTime(value: boolean);
  7598. /**
  7599. * Instantiates a new advanced dynamic texture instrumentation.
  7600. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  7601. * @param texture Defines the AdvancedDynamicTexture to instrument
  7602. */
  7603. constructor(
  7604. /**
  7605. * Define the instrumented AdvancedDynamicTexture.
  7606. */
  7607. texture: AdvancedDynamicTexture);
  7608. /**
  7609. * Dispose and release associated resources.
  7610. */
  7611. dispose(): void;
  7612. }
  7613. }
  7614. declare module BABYLON.GUI {
  7615. /**
  7616. * Class used to load GUI via XML.
  7617. */
  7618. export class XmlLoader {
  7619. private _nodes;
  7620. private _nodeTypes;
  7621. private _isLoaded;
  7622. private _objectAttributes;
  7623. private _parentClass;
  7624. /**
  7625. * Create a new xml loader
  7626. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  7627. */
  7628. constructor(parentClass?: null);
  7629. private _getChainElement;
  7630. private _getClassAttribute;
  7631. private _createGuiElement;
  7632. private _parseGrid;
  7633. private _parseElement;
  7634. private _prepareSourceElement;
  7635. private _parseElementsFromSource;
  7636. private _parseXml;
  7637. /**
  7638. * Gets if the loading has finished.
  7639. * @returns whether the loading has finished or not
  7640. */
  7641. isLoaded(): boolean;
  7642. /**
  7643. * Gets a loaded node / control by id.
  7644. * @param id the Controls id set in the xml
  7645. * @returns element of type Control
  7646. */
  7647. getNodeById(id: string): any;
  7648. /**
  7649. * Gets all loaded nodes / controls
  7650. * @returns Array of controls
  7651. */
  7652. getNodes(): any;
  7653. /**
  7654. * Initiates the xml layout loading
  7655. * @param xmlFile defines the xml layout to load
  7656. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  7657. * @param callback defines the callback called on layout load.
  7658. */
  7659. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  7660. }
  7661. }
  7662. declare module BABYLON.GUI {
  7663. /**
  7664. * Class used to create containers for controls
  7665. */
  7666. export class Container3D extends Control3D {
  7667. private _blockLayout;
  7668. /**
  7669. * Gets the list of child controls
  7670. */
  7671. protected _children: Control3D[];
  7672. /**
  7673. * Gets the list of child controls
  7674. */
  7675. get children(): Array<Control3D>;
  7676. /**
  7677. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  7678. * This is helpful to optimize layout operation when adding multiple children in a row
  7679. */
  7680. get blockLayout(): boolean;
  7681. set blockLayout(value: boolean);
  7682. /**
  7683. * Creates a new container
  7684. * @param name defines the container name
  7685. */
  7686. constructor(name?: string);
  7687. /**
  7688. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  7689. * @returns the current container
  7690. */
  7691. updateLayout(): Container3D;
  7692. /**
  7693. * Gets a boolean indicating if the given control is in the children of this control
  7694. * @param control defines the control to check
  7695. * @returns true if the control is in the child list
  7696. */
  7697. containsControl(control: Control3D): boolean;
  7698. /**
  7699. * Adds a control to the children of this control
  7700. * @param control defines the control to add
  7701. * @returns the current container
  7702. */
  7703. addControl(control: Control3D): Container3D;
  7704. /**
  7705. * This function will be called everytime a new control is added
  7706. */
  7707. protected _arrangeChildren(): void;
  7708. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  7709. /**
  7710. * Removes a control from the children of this control
  7711. * @param control defines the control to remove
  7712. * @returns the current container
  7713. */
  7714. removeControl(control: Control3D): Container3D;
  7715. protected _getTypeName(): string;
  7716. /**
  7717. * Releases all associated resources
  7718. */
  7719. dispose(): void;
  7720. /** Control rotation will remain unchanged */
  7721. static readonly UNSET_ORIENTATION: number;
  7722. /** Control will rotate to make it look at sphere central axis */
  7723. static readonly FACEORIGIN_ORIENTATION: number;
  7724. /** Control will rotate to make it look back at sphere central axis */
  7725. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  7726. /** Control will rotate to look at z axis (0, 0, 1) */
  7727. static readonly FACEFORWARD_ORIENTATION: number;
  7728. /** Control will rotate to look at negative z axis (0, 0, -1) */
  7729. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  7730. }
  7731. }
  7732. declare module BABYLON.GUI {
  7733. /**
  7734. * Class used to manage 3D user interface
  7735. * @see http://doc.babylonjs.com/how_to/gui3d
  7736. */
  7737. export class GUI3DManager implements BABYLON.IDisposable {
  7738. private _scene;
  7739. private _sceneDisposeObserver;
  7740. private _utilityLayer;
  7741. private _rootContainer;
  7742. private _pointerObserver;
  7743. private _pointerOutObserver;
  7744. /** @hidden */
  7745. _lastPickedControl: Control3D;
  7746. /** @hidden */
  7747. _lastControlOver: {
  7748. [pointerId: number]: Control3D;
  7749. };
  7750. /** @hidden */
  7751. _lastControlDown: {
  7752. [pointerId: number]: Control3D;
  7753. };
  7754. /**
  7755. * BABYLON.Observable raised when the point picked by the pointer events changed
  7756. */
  7757. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  7758. /** @hidden */
  7759. _sharedMaterials: {
  7760. [key: string]: BABYLON.Material;
  7761. };
  7762. /** Gets the hosting scene */
  7763. get scene(): BABYLON.Scene;
  7764. /** Gets associated utility layer */
  7765. get utilityLayer(): BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  7766. /**
  7767. * Creates a new GUI3DManager
  7768. * @param scene
  7769. */
  7770. constructor(scene?: BABYLON.Scene);
  7771. private _handlePointerOut;
  7772. private _doPicking;
  7773. /**
  7774. * Gets the root container
  7775. */
  7776. get rootContainer(): Container3D;
  7777. /**
  7778. * Gets a boolean indicating if the given control is in the root child list
  7779. * @param control defines the control to check
  7780. * @returns true if the control is in the root child list
  7781. */
  7782. containsControl(control: Control3D): boolean;
  7783. /**
  7784. * Adds a control to the root child list
  7785. * @param control defines the control to add
  7786. * @returns the current manager
  7787. */
  7788. addControl(control: Control3D): GUI3DManager;
  7789. /**
  7790. * Removes a control from the root child list
  7791. * @param control defines the control to remove
  7792. * @returns the current container
  7793. */
  7794. removeControl(control: Control3D): GUI3DManager;
  7795. /**
  7796. * Releases all associated resources
  7797. */
  7798. dispose(): void;
  7799. }
  7800. }
  7801. declare module BABYLON.GUI {
  7802. /**
  7803. * Class used to transport BABYLON.Vector3 information for pointer events
  7804. */
  7805. export class Vector3WithInfo extends BABYLON.Vector3 {
  7806. /** defines the current mouse button index */
  7807. buttonIndex: number;
  7808. /**
  7809. * Creates a new Vector3WithInfo
  7810. * @param source defines the vector3 data to transport
  7811. * @param buttonIndex defines the current mouse button index
  7812. */
  7813. constructor(source: BABYLON.Vector3,
  7814. /** defines the current mouse button index */
  7815. buttonIndex?: number);
  7816. }
  7817. }
  7818. declare module BABYLON.GUI {
  7819. /**
  7820. * Class used as base class for controls
  7821. */
  7822. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  7823. /** Defines the control name */
  7824. name?: string | undefined;
  7825. /** @hidden */
  7826. _host: GUI3DManager;
  7827. private _node;
  7828. private _downCount;
  7829. private _enterCount;
  7830. private _downPointerIds;
  7831. private _isVisible;
  7832. /** Gets or sets the control position in world space */
  7833. get position(): BABYLON.Vector3;
  7834. set position(value: BABYLON.Vector3);
  7835. /** Gets or sets the control scaling in world space */
  7836. get scaling(): BABYLON.Vector3;
  7837. set scaling(value: BABYLON.Vector3);
  7838. /** Callback used to start pointer enter animation */
  7839. pointerEnterAnimation: () => void;
  7840. /** Callback used to start pointer out animation */
  7841. pointerOutAnimation: () => void;
  7842. /** Callback used to start pointer down animation */
  7843. pointerDownAnimation: () => void;
  7844. /** Callback used to start pointer up animation */
  7845. pointerUpAnimation: () => void;
  7846. /**
  7847. * An event triggered when the pointer move over the control
  7848. */
  7849. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  7850. /**
  7851. * An event triggered when the pointer move out of the control
  7852. */
  7853. onPointerOutObservable: BABYLON.Observable<Control3D>;
  7854. /**
  7855. * An event triggered when the pointer taps the control
  7856. */
  7857. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  7858. /**
  7859. * An event triggered when pointer is up
  7860. */
  7861. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  7862. /**
  7863. * An event triggered when a control is clicked on (with a mouse)
  7864. */
  7865. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  7866. /**
  7867. * An event triggered when pointer enters the control
  7868. */
  7869. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  7870. /**
  7871. * Gets or sets the parent container
  7872. */
  7873. parent: BABYLON.Nullable<Container3D>;
  7874. private _behaviors;
  7875. /**
  7876. * Gets the list of attached behaviors
  7877. * @see http://doc.babylonjs.com/features/behaviour
  7878. */
  7879. get behaviors(): BABYLON.Behavior<Control3D>[];
  7880. /**
  7881. * Attach a behavior to the control
  7882. * @see http://doc.babylonjs.com/features/behaviour
  7883. * @param behavior defines the behavior to attach
  7884. * @returns the current control
  7885. */
  7886. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  7887. /**
  7888. * Remove an attached behavior
  7889. * @see http://doc.babylonjs.com/features/behaviour
  7890. * @param behavior defines the behavior to attach
  7891. * @returns the current control
  7892. */
  7893. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  7894. /**
  7895. * Gets an attached behavior by name
  7896. * @param name defines the name of the behavior to look for
  7897. * @see http://doc.babylonjs.com/features/behaviour
  7898. * @returns null if behavior was not found else the requested behavior
  7899. */
  7900. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  7901. /** Gets or sets a boolean indicating if the control is visible */
  7902. get isVisible(): boolean;
  7903. set isVisible(value: boolean);
  7904. /**
  7905. * Creates a new control
  7906. * @param name defines the control name
  7907. */
  7908. constructor(
  7909. /** Defines the control name */
  7910. name?: string | undefined);
  7911. /**
  7912. * Gets a string representing the class name
  7913. */
  7914. get typeName(): string;
  7915. /**
  7916. * Get the current class name of the control.
  7917. * @returns current class name
  7918. */
  7919. getClassName(): string;
  7920. protected _getTypeName(): string;
  7921. /**
  7922. * Gets the transform node used by this control
  7923. */
  7924. get node(): BABYLON.Nullable<BABYLON.TransformNode>;
  7925. /**
  7926. * Gets the mesh used to render this control
  7927. */
  7928. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  7929. /**
  7930. * Link the control as child of the given node
  7931. * @param node defines the node to link to. Use null to unlink the control
  7932. * @returns the current control
  7933. */
  7934. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  7935. /** @hidden **/
  7936. _prepareNode(scene: BABYLON.Scene): void;
  7937. /**
  7938. * Node creation.
  7939. * Can be overriden by children
  7940. * @param scene defines the scene where the node must be attached
  7941. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  7942. */
  7943. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  7944. /**
  7945. * Affect a material to the given mesh
  7946. * @param mesh defines the mesh which will represent the control
  7947. */
  7948. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  7949. /** @hidden */
  7950. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  7951. /** @hidden */
  7952. _onPointerEnter(target: Control3D): boolean;
  7953. /** @hidden */
  7954. _onPointerOut(target: Control3D): void;
  7955. /** @hidden */
  7956. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  7957. /** @hidden */
  7958. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  7959. /** @hidden */
  7960. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  7961. /** @hidden */
  7962. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  7963. /** @hidden */
  7964. _disposeNode(): void;
  7965. /**
  7966. * Releases all associated resources
  7967. */
  7968. dispose(): void;
  7969. }
  7970. }
  7971. declare module BABYLON.GUI {
  7972. /**
  7973. * Class used as a root to all buttons
  7974. */
  7975. export class AbstractButton3D extends Control3D {
  7976. /**
  7977. * Creates a new button
  7978. * @param name defines the control name
  7979. */
  7980. constructor(name?: string);
  7981. protected _getTypeName(): string;
  7982. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  7983. }
  7984. }
  7985. declare module BABYLON.GUI {
  7986. /**
  7987. * Class used to create a button in 3D
  7988. */
  7989. export class Button3D extends AbstractButton3D {
  7990. /** @hidden */
  7991. protected _currentMaterial: BABYLON.Material;
  7992. private _facadeTexture;
  7993. private _content;
  7994. private _contentResolution;
  7995. private _contentScaleRatio;
  7996. /**
  7997. * Gets or sets the texture resolution used to render content (512 by default)
  7998. */
  7999. get contentResolution(): BABYLON.int;
  8000. set contentResolution(value: BABYLON.int);
  8001. /**
  8002. * Gets or sets the texture scale ratio used to render content (2 by default)
  8003. */
  8004. get contentScaleRatio(): number;
  8005. set contentScaleRatio(value: number);
  8006. protected _disposeFacadeTexture(): void;
  8007. protected _resetContent(): void;
  8008. /**
  8009. * Creates a new button
  8010. * @param name defines the control name
  8011. */
  8012. constructor(name?: string);
  8013. /**
  8014. * Gets or sets the GUI 2D content used to display the button's facade
  8015. */
  8016. get content(): Control;
  8017. set content(value: Control);
  8018. /**
  8019. * Apply the facade texture (created from the content property).
  8020. * This function can be overloaded by child classes
  8021. * @param facadeTexture defines the AdvancedDynamicTexture to use
  8022. */
  8023. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  8024. protected _getTypeName(): string;
  8025. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8026. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  8027. /**
  8028. * Releases all associated resources
  8029. */
  8030. dispose(): void;
  8031. }
  8032. }
  8033. declare module BABYLON.GUI {
  8034. /**
  8035. * Abstract class used to create a container panel deployed on the surface of a volume
  8036. */
  8037. export abstract class VolumeBasedPanel extends Container3D {
  8038. private _columns;
  8039. private _rows;
  8040. private _rowThenColum;
  8041. private _orientation;
  8042. protected _cellWidth: number;
  8043. protected _cellHeight: number;
  8044. /**
  8045. * Gets or sets the distance between elements
  8046. */
  8047. margin: number;
  8048. /**
  8049. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  8050. * | Value | Type | Description |
  8051. * | ----- | ----------------------------------- | ----------- |
  8052. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  8053. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  8054. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  8055. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  8056. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  8057. */
  8058. get orientation(): number;
  8059. set orientation(value: number);
  8060. /**
  8061. * Gets or sets the number of columns requested (10 by default).
  8062. * The panel will automatically compute the number of rows based on number of child controls.
  8063. */
  8064. get columns(): BABYLON.int;
  8065. set columns(value: BABYLON.int);
  8066. /**
  8067. * Gets or sets a the number of rows requested.
  8068. * The panel will automatically compute the number of columns based on number of child controls.
  8069. */
  8070. get rows(): BABYLON.int;
  8071. set rows(value: BABYLON.int);
  8072. /**
  8073. * Creates new VolumeBasedPanel
  8074. */
  8075. constructor();
  8076. protected _arrangeChildren(): void;
  8077. /** Child classes must implement this function to provide correct control positioning */
  8078. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8079. /** Child classes can implement this function to provide additional processing */
  8080. protected _finalProcessing(): void;
  8081. }
  8082. }
  8083. declare module BABYLON.GUI {
  8084. /**
  8085. * Class used to create a container panel deployed on the surface of a cylinder
  8086. */
  8087. export class CylinderPanel extends VolumeBasedPanel {
  8088. private _radius;
  8089. /**
  8090. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  8091. */
  8092. get radius(): BABYLON.float;
  8093. set radius(value: BABYLON.float);
  8094. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8095. private _cylindricalMapping;
  8096. }
  8097. }
  8098. declare module BABYLON.GUI {
  8099. /** @hidden */
  8100. export var fluentVertexShader: {
  8101. name: string;
  8102. shader: string;
  8103. };
  8104. }
  8105. declare module BABYLON.GUI {
  8106. /** @hidden */
  8107. export var fluentPixelShader: {
  8108. name: string;
  8109. shader: string;
  8110. };
  8111. }
  8112. declare module BABYLON.GUI {
  8113. /** @hidden */
  8114. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  8115. INNERGLOW: boolean;
  8116. BORDER: boolean;
  8117. HOVERLIGHT: boolean;
  8118. TEXTURE: boolean;
  8119. constructor();
  8120. }
  8121. /**
  8122. * Class used to render controls with fluent desgin
  8123. */
  8124. export class FluentMaterial extends BABYLON.PushMaterial {
  8125. /**
  8126. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  8127. */
  8128. innerGlowColorIntensity: number;
  8129. /**
  8130. * Gets or sets the inner glow color (white by default)
  8131. */
  8132. innerGlowColor: BABYLON.Color3;
  8133. /**
  8134. * Gets or sets alpha value (default is 1.0)
  8135. */
  8136. alpha: number;
  8137. /**
  8138. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  8139. */
  8140. albedoColor: BABYLON.Color3;
  8141. /**
  8142. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  8143. */
  8144. renderBorders: boolean;
  8145. /**
  8146. * Gets or sets border width (default is 0.5)
  8147. */
  8148. borderWidth: number;
  8149. /**
  8150. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  8151. */
  8152. edgeSmoothingValue: number;
  8153. /**
  8154. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  8155. */
  8156. borderMinValue: number;
  8157. /**
  8158. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  8159. */
  8160. renderHoverLight: boolean;
  8161. /**
  8162. * Gets or sets the radius used to render the hover light (default is 1.0)
  8163. */
  8164. hoverRadius: number;
  8165. /**
  8166. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  8167. */
  8168. hoverColor: BABYLON.Color4;
  8169. /**
  8170. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  8171. */
  8172. hoverPosition: BABYLON.Vector3;
  8173. private _albedoTexture;
  8174. /** Gets or sets the texture to use for albedo color */
  8175. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  8176. /**
  8177. * Creates a new Fluent material
  8178. * @param name defines the name of the material
  8179. * @param scene defines the hosting scene
  8180. */
  8181. constructor(name: string, scene: BABYLON.Scene);
  8182. needAlphaBlending(): boolean;
  8183. needAlphaTesting(): boolean;
  8184. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  8185. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  8186. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  8187. getActiveTextures(): BABYLON.BaseTexture[];
  8188. hasTexture(texture: BABYLON.BaseTexture): boolean;
  8189. dispose(forceDisposeEffect?: boolean): void;
  8190. clone(name: string): FluentMaterial;
  8191. serialize(): any;
  8192. getClassName(): string;
  8193. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  8194. }
  8195. }
  8196. declare module BABYLON.GUI {
  8197. /**
  8198. * Class used to create a holographic button in 3D
  8199. */
  8200. export class HolographicButton extends Button3D {
  8201. private _backPlate;
  8202. private _textPlate;
  8203. private _frontPlate;
  8204. private _text;
  8205. private _imageUrl;
  8206. private _shareMaterials;
  8207. private _frontMaterial;
  8208. private _backMaterial;
  8209. private _plateMaterial;
  8210. private _pickedPointObserver;
  8211. private _tooltipFade;
  8212. private _tooltipTextBlock;
  8213. private _tooltipTexture;
  8214. private _tooltipMesh;
  8215. private _tooltipHoverObserver;
  8216. private _tooltipOutObserver;
  8217. private _disposeTooltip;
  8218. /**
  8219. * Rendering ground id of all the mesh in the button
  8220. */
  8221. set renderingGroupId(id: number);
  8222. get renderingGroupId(): number;
  8223. /**
  8224. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  8225. */
  8226. set tooltipText(text: BABYLON.Nullable<string>);
  8227. get tooltipText(): BABYLON.Nullable<string>;
  8228. /**
  8229. * Gets or sets text for the button
  8230. */
  8231. get text(): string;
  8232. set text(value: string);
  8233. /**
  8234. * Gets or sets the image url for the button
  8235. */
  8236. get imageUrl(): string;
  8237. set imageUrl(value: string);
  8238. /**
  8239. * Gets the back material used by this button
  8240. */
  8241. get backMaterial(): FluentMaterial;
  8242. /**
  8243. * Gets the front material used by this button
  8244. */
  8245. get frontMaterial(): FluentMaterial;
  8246. /**
  8247. * Gets the plate material used by this button
  8248. */
  8249. get plateMaterial(): BABYLON.StandardMaterial;
  8250. /**
  8251. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  8252. */
  8253. get shareMaterials(): boolean;
  8254. /**
  8255. * Creates a new button
  8256. * @param name defines the control name
  8257. */
  8258. constructor(name?: string, shareMaterials?: boolean);
  8259. protected _getTypeName(): string;
  8260. private _rebuildContent;
  8261. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8262. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  8263. private _createBackMaterial;
  8264. private _createFrontMaterial;
  8265. private _createPlateMaterial;
  8266. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  8267. /**
  8268. * Releases all associated resources
  8269. */
  8270. dispose(): void;
  8271. }
  8272. }
  8273. declare module BABYLON.GUI {
  8274. /**
  8275. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  8276. */
  8277. export class MeshButton3D extends Button3D {
  8278. /** @hidden */
  8279. protected _currentMesh: BABYLON.Mesh;
  8280. /**
  8281. * Creates a new 3D button based on a mesh
  8282. * @param mesh mesh to become a 3D button
  8283. * @param name defines the control name
  8284. */
  8285. constructor(mesh: BABYLON.Mesh, name?: string);
  8286. protected _getTypeName(): string;
  8287. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  8288. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  8289. }
  8290. }
  8291. declare module BABYLON.GUI {
  8292. /**
  8293. * Class used to create a container panel deployed on the surface of a plane
  8294. */
  8295. export class PlanePanel extends VolumeBasedPanel {
  8296. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8297. }
  8298. }
  8299. declare module BABYLON.GUI {
  8300. /**
  8301. * Class used to create a container panel where items get randomized planar mapping
  8302. */
  8303. export class ScatterPanel extends VolumeBasedPanel {
  8304. private _iteration;
  8305. /**
  8306. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  8307. */
  8308. get iteration(): BABYLON.float;
  8309. set iteration(value: BABYLON.float);
  8310. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8311. private _scatterMapping;
  8312. protected _finalProcessing(): void;
  8313. }
  8314. }
  8315. declare module BABYLON.GUI {
  8316. /**
  8317. * Class used to create a container panel deployed on the surface of a sphere
  8318. */
  8319. export class SpherePanel extends VolumeBasedPanel {
  8320. private _radius;
  8321. /**
  8322. * Gets or sets the radius of the sphere where to project controls (5 by default)
  8323. */
  8324. get radius(): BABYLON.float;
  8325. set radius(value: BABYLON.float);
  8326. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  8327. private _sphericalMapping;
  8328. }
  8329. }
  8330. declare module BABYLON.GUI {
  8331. /**
  8332. * Class used to create a stack panel in 3D on XY plane
  8333. */
  8334. export class StackPanel3D extends Container3D {
  8335. private _isVertical;
  8336. /**
  8337. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  8338. */
  8339. get isVertical(): boolean;
  8340. set isVertical(value: boolean);
  8341. /**
  8342. * Gets or sets the distance between elements
  8343. */
  8344. margin: number;
  8345. /**
  8346. * Creates new StackPanel
  8347. * @param isVertical
  8348. */
  8349. constructor(isVertical?: boolean);
  8350. protected _arrangeChildren(): void;
  8351. }
  8352. }