babylon.gui.module.d.ts 352 KB

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