babylon.gui.module.d.ts 380 KB

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