babylon.gui.module.d.ts 351 KB

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