babylon.gui.module.d.ts 352 KB

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