babylon.gui.module.d.ts 347 KB

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