babylon.gui.module.d.ts 364 KB

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