babylon.gui.module.d.ts 355 KB

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