babylon.gui.module.d.ts 348 KB

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