babylon.gui.module.d.ts 357 KB

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