babylon.gui.module.d.ts 345 KB

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