babylon.gui.module.d.ts 347 KB

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