babylon.gui.module.d.ts 302 KB

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