babylon.gui.module.d.ts 379 KB

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