babylon.gui.module.d.ts 349 KB

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