babylon.gui.module.d.ts 378 KB

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