babylon.gui.module.d.ts 393 KB

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