babylon.gui.module.d.ts 347 KB

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