babylon.gui.module.d.ts 300 KB

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