babylon.gui.module.d.ts 352 KB

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