babylon.gui.module.d.ts 358 KB

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