babylon.gui.module.d.ts 348 KB

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