babylon.gui.module.d.ts 350 KB

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