babylon.gui.module.d.ts 280 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178
  1. /*Babylon.js GUI*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. // ../../../../Tools/Gulp/2D
  5. declare module 'babylonjs-gui' {
  6. export * from "babylonjs-gui/2D";
  7. export * from "babylonjs-gui/3D";
  8. }
  9. declare module 'babylonjs-gui/2D' {
  10. export * from "babylonjs-gui/2D/controls";
  11. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  12. export * from "babylonjs-gui/2D/math2D";
  13. export * from "babylonjs-gui/2D/measure";
  14. export * from "babylonjs-gui/2D/multiLinePoint";
  15. export * from "babylonjs-gui/2D/style";
  16. export * from "babylonjs-gui/2D/valueAndUnit";
  17. }
  18. declare module 'babylonjs-gui/3D' {
  19. export * from "babylonjs-gui/3D/controls";
  20. export * from "babylonjs-gui/3D/materials";
  21. export * from "babylonjs-gui/3D/gui3DManager";
  22. export * from "babylonjs-gui/3D/vector3WithInfo";
  23. }
  24. declare module 'babylonjs-gui/2D/controls' {
  25. export * from "babylonjs-gui/2D/controls/button";
  26. export * from "babylonjs-gui/2D/controls/checkbox";
  27. export * from "babylonjs-gui/2D/controls/colorpicker";
  28. export * from "babylonjs-gui/2D/controls/container";
  29. export * from "babylonjs-gui/2D/controls/control";
  30. export * from "babylonjs-gui/2D/controls/ellipse";
  31. export * from "babylonjs-gui/2D/controls/grid";
  32. export * from "babylonjs-gui/2D/controls/image";
  33. export * from "babylonjs-gui/2D/controls/inputText";
  34. export * from "babylonjs-gui/2D/controls/inputPassword";
  35. export * from "babylonjs-gui/2D/controls/line";
  36. export * from "babylonjs-gui/2D/controls/multiLine";
  37. export * from "babylonjs-gui/2D/controls/radioButton";
  38. export * from "babylonjs-gui/2D/controls/stackPanel";
  39. export * from "babylonjs-gui/2D/controls/selector";
  40. export * from "babylonjs-gui/2D/controls/scrollViewers/scrollViewer";
  41. export * from "babylonjs-gui/2D/controls/textBlock";
  42. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  43. export * from "babylonjs-gui/2D/controls/rectangle";
  44. export * from "babylonjs-gui/2D/controls/displayGrid";
  45. export * from "babylonjs-gui/2D/controls/sliders/baseSlider";
  46. export * from "babylonjs-gui/2D/controls/sliders/slider";
  47. export * from "babylonjs-gui/2D/controls/sliders/imageBasedSlider";
  48. export * from "babylonjs-gui/2D/controls/statics";
  49. }
  50. declare module 'babylonjs-gui/2D/advancedDynamicTexture' {
  51. import { DynamicTexture, Nullable, Layer, Viewport, Scene, Vector3, Matrix, Vector2, AbstractMesh, Observable, ClipboardInfo } from 'babylonjs';
  52. import { Container } from "babylonjs-gui/2D/controls/container";
  53. import { Control } from "babylonjs-gui/2D/controls/control";
  54. import { Style } from "babylonjs-gui/2D/style";
  55. /**
  56. * Interface used to define a control that can receive focus
  57. */
  58. export interface IFocusableControl {
  59. /**
  60. * Function called when the control receives the focus
  61. */
  62. onFocus(): void;
  63. /**
  64. * Function called when the control loses the focus
  65. */
  66. onBlur(): void;
  67. /**
  68. * Function called to let the control handle keyboard events
  69. * @param evt defines the current keyboard event
  70. */
  71. processKeyboard(evt: KeyboardEvent): void;
  72. /**
  73. * Function called to get the list of controls that should not steal the focus from this control
  74. * @returns an array of controls
  75. */
  76. keepsFocusWith(): Nullable<Control[]>;
  77. }
  78. /**
  79. * Class used to create texture to support 2D GUI elements
  80. * @see http://doc.babylonjs.com/how_to/gui
  81. */
  82. export class AdvancedDynamicTexture extends DynamicTexture {
  83. /** @hidden */
  84. _rootContainer: Container;
  85. /** @hidden */
  86. _lastPickedControl: Control;
  87. /** @hidden */
  88. _lastControlOver: {
  89. [pointerId: number]: Control;
  90. };
  91. /** @hidden */
  92. _lastControlDown: {
  93. [pointerId: number]: Control;
  94. };
  95. /** @hidden */
  96. _capturingControl: {
  97. [pointerId: number]: Control;
  98. };
  99. /** @hidden */
  100. _shouldBlockPointer: boolean;
  101. /** @hidden */
  102. _layerToDispose: Nullable<Layer>;
  103. /** @hidden */
  104. _linkedControls: Control[];
  105. /**
  106. * Observable event triggered each time an clipboard event is received from the rendering canvas
  107. */
  108. onClipboardObservable: Observable<ClipboardInfo>;
  109. /**
  110. * Observable event triggered each time a pointer down is intercepted by a control
  111. */
  112. onControlPickedObservable: Observable<Control>;
  113. /**
  114. * Gets or sets a boolean defining if alpha is stored as premultiplied
  115. */
  116. premulAlpha: boolean;
  117. /**
  118. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  119. * Useful when you want more antialiasing
  120. */
  121. renderScale: number;
  122. /** Gets or sets the background color */
  123. background: string;
  124. /**
  125. * Gets or sets the ideal width used to design controls.
  126. * The GUI will then rescale everything accordingly
  127. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  128. */
  129. idealWidth: number;
  130. /**
  131. * Gets or sets the ideal height used to design controls.
  132. * The GUI will then rescale everything accordingly
  133. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  134. */
  135. idealHeight: number;
  136. /**
  137. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  138. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  139. */
  140. useSmallestIdeal: boolean;
  141. /**
  142. * Gets or sets a boolean indicating if adaptive scaling must be used
  143. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  144. */
  145. renderAtIdealSize: boolean;
  146. /**
  147. * Gets the underlying layer used to render the texture when in fullscreen mode
  148. */
  149. readonly layer: Nullable<Layer>;
  150. /**
  151. * Gets the root container control
  152. */
  153. readonly rootContainer: Container;
  154. /**
  155. * Returns an array containing the root container.
  156. * This is mostly used to let the Inspector introspects the ADT
  157. * @returns an array containing the rootContainer
  158. */
  159. getChildren(): Array<Container>;
  160. /**
  161. * Will return all controls that are inside this texture
  162. * @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
  163. * @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
  164. * @return all child controls
  165. */
  166. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  167. /**
  168. * Gets or sets the current focused control
  169. */
  170. focusedControl: Nullable<IFocusableControl>;
  171. /**
  172. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  173. */
  174. isForeground: boolean;
  175. /**
  176. * Gets or set information about clipboardData
  177. */
  178. clipboardData: string;
  179. /**
  180. * Creates a new AdvancedDynamicTexture
  181. * @param name defines the name of the texture
  182. * @param width defines the width of the texture
  183. * @param height defines the height of the texture
  184. * @param scene defines the hosting scene
  185. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  186. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  187. */
  188. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  189. /**
  190. * Get the current class name of the texture useful for serialization or dynamic coding.
  191. * @returns "AdvancedDynamicTexture"
  192. */
  193. getClassName(): string;
  194. /**
  195. * Function used to execute a function on all controls
  196. * @param func defines the function to execute
  197. * @param container defines the container where controls belong. If null the root container will be used
  198. */
  199. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  200. /**
  201. * Marks the texture as dirty forcing a complete update
  202. */
  203. markAsDirty(): void;
  204. /**
  205. * Helper function used to create a new style
  206. * @returns a new style
  207. * @see http://doc.babylonjs.com/how_to/gui#styles
  208. */
  209. createStyle(): Style;
  210. /**
  211. * Adds a new control to the root container
  212. * @param control defines the control to add
  213. * @returns the current texture
  214. */
  215. addControl(control: Control): AdvancedDynamicTexture;
  216. /**
  217. * Removes a control from the root container
  218. * @param control defines the control to remove
  219. * @returns the current texture
  220. */
  221. removeControl(control: Control): AdvancedDynamicTexture;
  222. /**
  223. * Release all resources
  224. */
  225. dispose(): void;
  226. /** @hidden */
  227. _getGlobalViewport(scene: Scene): Viewport;
  228. /**
  229. * Get screen coordinates for a vector3
  230. * @param position defines the position to project
  231. * @param worldMatrix defines the world matrix to use
  232. * @returns the projected position
  233. */
  234. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  235. /** @hidden */
  236. _changeCursor(cursor: string): void;
  237. /** @hidden */
  238. _registerLastControlDown(control: Control, pointerId: number): void;
  239. /** @hidden */
  240. _cleanControlAfterRemovalFromList(list: {
  241. [pointerId: number]: Control;
  242. }, control: Control): void;
  243. /** @hidden */
  244. _cleanControlAfterRemoval(control: Control): void;
  245. /** Attach to all scene events required to support pointer events */
  246. attach(): void;
  247. /**
  248. * Register the clipboard Events onto the canvas
  249. */
  250. registerClipboardEvents(): void;
  251. /**
  252. * Unregister the clipboard Events from the canvas
  253. */
  254. unRegisterClipboardEvents(): void;
  255. /**
  256. * Connect the texture to a hosting mesh to enable interactions
  257. * @param mesh defines the mesh to attach to
  258. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  259. */
  260. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  261. /**
  262. * Move the focus to a specific control
  263. * @param control defines the control which will receive the focus
  264. */
  265. moveFocusToControl(control: IFocusableControl): void;
  266. /**
  267. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  268. * @param mesh defines the mesh which will receive the texture
  269. * @param width defines the texture width (1024 by default)
  270. * @param height defines the texture height (1024 by default)
  271. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  272. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  273. * @returns a new AdvancedDynamicTexture
  274. */
  275. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  276. /**
  277. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  278. * In this mode the texture will rely on a layer for its rendering.
  279. * This allows it to be treated like any other layer.
  280. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  281. * LayerMask is set through advancedTexture.layer.layerMask
  282. * @param name defines name for the texture
  283. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  284. * @param scene defines the hsoting scene
  285. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  286. * @returns a new AdvancedDynamicTexture
  287. */
  288. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  289. }
  290. }
  291. declare module 'babylonjs-gui/2D/math2D' {
  292. import { Vector2, Nullable } from "babylonjs";
  293. /**
  294. * Class used to transport Vector2 information for pointer events
  295. */
  296. export class Vector2WithInfo extends Vector2 {
  297. /** defines the current mouse button index */
  298. buttonIndex: number;
  299. /**
  300. * Creates a new Vector2WithInfo
  301. * @param source defines the vector2 data to transport
  302. * @param buttonIndex defines the current mouse button index
  303. */
  304. constructor(source: Vector2,
  305. /** defines the current mouse button index */
  306. buttonIndex?: number);
  307. }
  308. /** Class used to provide 2D matrix features */
  309. export class Matrix2D {
  310. /** Gets the internal array of 6 floats used to store matrix data */
  311. m: Float32Array;
  312. /**
  313. * Creates a new matrix
  314. * @param m00 defines value for (0, 0)
  315. * @param m01 defines value for (0, 1)
  316. * @param m10 defines value for (1, 0)
  317. * @param m11 defines value for (1, 1)
  318. * @param m20 defines value for (2, 0)
  319. * @param m21 defines value for (2, 1)
  320. */
  321. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  322. /**
  323. * Fills the matrix from direct values
  324. * @param m00 defines value for (0, 0)
  325. * @param m01 defines value for (0, 1)
  326. * @param m10 defines value for (1, 0)
  327. * @param m11 defines value for (1, 1)
  328. * @param m20 defines value for (2, 0)
  329. * @param m21 defines value for (2, 1)
  330. * @returns the current modified matrix
  331. */
  332. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  333. /**
  334. * Gets matrix determinant
  335. * @returns the determinant
  336. */
  337. determinant(): number;
  338. /**
  339. * Inverses the matrix and stores it in a target matrix
  340. * @param result defines the target matrix
  341. * @returns the current matrix
  342. */
  343. invertToRef(result: Matrix2D): Matrix2D;
  344. /**
  345. * Multiplies the current matrix with another one
  346. * @param other defines the second operand
  347. * @param result defines the target matrix
  348. * @returns the current matrix
  349. */
  350. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  351. /**
  352. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  353. * @param x defines the x coordinate to transform
  354. * @param y defines the x coordinate to transform
  355. * @param result defines the target vector2
  356. * @returns the current matrix
  357. */
  358. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  359. /**
  360. * Creates an identity matrix
  361. * @returns a new matrix
  362. */
  363. static Identity(): Matrix2D;
  364. /**
  365. * Creates a translation matrix and stores it in a target matrix
  366. * @param x defines the x coordinate of the translation
  367. * @param y defines the y coordinate of the translation
  368. * @param result defines the target matrix
  369. */
  370. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  371. /**
  372. * Creates a scaling matrix and stores it in a target matrix
  373. * @param x defines the x coordinate of the scaling
  374. * @param y defines the y coordinate of the scaling
  375. * @param result defines the target matrix
  376. */
  377. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  378. /**
  379. * Creates a rotation matrix and stores it in a target matrix
  380. * @param angle defines the rotation angle
  381. * @param result defines the target matrix
  382. */
  383. static RotationToRef(angle: number, result: Matrix2D): void;
  384. /**
  385. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  386. * @param tx defines the x coordinate of the translation
  387. * @param ty defines the y coordinate of the translation
  388. * @param angle defines the rotation angle
  389. * @param scaleX defines the x coordinate of the scaling
  390. * @param scaleY defines the y coordinate of the scaling
  391. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  392. * @param result defines the target matrix
  393. */
  394. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  395. }
  396. }
  397. declare module 'babylonjs-gui/2D/measure' {
  398. /**
  399. * Class used to store 2D control sizes
  400. */
  401. export class Measure {
  402. /** defines left coordinate */
  403. left: number;
  404. /** defines top coordinate */
  405. top: number;
  406. /** defines width dimension */
  407. width: number;
  408. /** defines height dimension */
  409. height: number;
  410. /**
  411. * Creates a new measure
  412. * @param left defines left coordinate
  413. * @param top defines top coordinate
  414. * @param width defines width dimension
  415. * @param height defines height dimension
  416. */
  417. constructor(
  418. /** defines left coordinate */
  419. left: number,
  420. /** defines top coordinate */
  421. top: number,
  422. /** defines width dimension */
  423. width: number,
  424. /** defines height dimension */
  425. height: number);
  426. /**
  427. * Copy from another measure
  428. * @param other defines the other measure to copy from
  429. */
  430. copyFrom(other: Measure): void;
  431. /**
  432. * Copy from a group of 4 floats
  433. * @param left defines left coordinate
  434. * @param top defines top coordinate
  435. * @param width defines width dimension
  436. * @param height defines height dimension
  437. */
  438. copyFromFloats(left: number, top: number, width: number, height: number): void;
  439. /**
  440. * Check equality between this measure and another one
  441. * @param other defines the other measures
  442. * @returns true if both measures are equals
  443. */
  444. isEqualsTo(other: Measure): boolean;
  445. /**
  446. * Creates an empty measure
  447. * @returns a new measure
  448. */
  449. static Empty(): Measure;
  450. }
  451. }
  452. declare module 'babylonjs-gui/2D/multiLinePoint' {
  453. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  454. import { Control } from "babylonjs-gui/2D/controls/control";
  455. import { AbstractMesh, Nullable, Vector2 } from "babylonjs";
  456. /**
  457. * Class used to store a point for a MultiLine object.
  458. * The point can be pure 2D coordinates, a mesh or a control
  459. */
  460. export class MultiLinePoint {
  461. /** @hidden */
  462. _point: Vector2;
  463. /**
  464. * Creates a new MultiLinePoint
  465. * @param multiLine defines the source MultiLine object
  466. */
  467. constructor(multiLine: MultiLine);
  468. /** Gets or sets x coordinate */
  469. x: string | number;
  470. /** Gets or sets y coordinate */
  471. y: string | number;
  472. /** Gets or sets the control associated with this point */
  473. control: Nullable<Control>;
  474. /** Gets or sets the mesh associated with this point */
  475. mesh: Nullable<AbstractMesh>;
  476. /** Resets links */
  477. resetLinks(): void;
  478. /**
  479. * Gets a translation vector
  480. * @returns the translation vector
  481. */
  482. translate(): Vector2;
  483. /** Release associated resources */
  484. dispose(): void;
  485. }
  486. }
  487. declare module 'babylonjs-gui/2D/style' {
  488. import { IDisposable, Observable } from "babylonjs";
  489. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  490. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  491. /**
  492. * Define a style used by control to automatically setup properties based on a template.
  493. * Only support font related properties so far
  494. */
  495. export class Style implements IDisposable {
  496. /** @hidden */
  497. _host: AdvancedDynamicTexture;
  498. /** @hidden */
  499. _fontSize: ValueAndUnit;
  500. /**
  501. * Observable raised when the style values are changed
  502. */
  503. onChangedObservable: Observable<Style>;
  504. /**
  505. * Creates a new style object
  506. * @param host defines the AdvancedDynamicTexture which hosts this style
  507. */
  508. constructor(host: AdvancedDynamicTexture);
  509. /**
  510. * Gets or sets the font size
  511. */
  512. fontSize: string | number;
  513. /**
  514. * Gets or sets the font family
  515. */
  516. fontFamily: string;
  517. /**
  518. * Gets or sets the font style
  519. */
  520. fontStyle: string;
  521. /** Gets or sets font weight */
  522. fontWeight: string;
  523. /** Dispose all associated resources */
  524. dispose(): void;
  525. }
  526. }
  527. declare module 'babylonjs-gui/2D/valueAndUnit' {
  528. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  529. /**
  530. * Class used to specific a value and its associated unit
  531. */
  532. export class ValueAndUnit {
  533. /** defines the unit to store */
  534. unit: number;
  535. /** defines a boolean indicating if the value can be negative */
  536. negativeValueAllowed: boolean;
  537. /**
  538. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  539. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  540. */
  541. ignoreAdaptiveScaling: boolean;
  542. /**
  543. * Creates a new ValueAndUnit
  544. * @param value defines the value to store
  545. * @param unit defines the unit to store
  546. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  547. */
  548. constructor(value: number,
  549. /** defines the unit to store */
  550. unit?: number,
  551. /** defines a boolean indicating if the value can be negative */
  552. negativeValueAllowed?: boolean);
  553. /** Gets a boolean indicating if the value is a percentage */
  554. readonly isPercentage: boolean;
  555. /** Gets a boolean indicating if the value is store as pixel */
  556. readonly isPixel: boolean;
  557. /** Gets direct internal value */
  558. readonly internalValue: number;
  559. /**
  560. * Gets value as pixel
  561. * @param host defines the root host
  562. * @param refValue defines the reference value for percentages
  563. * @returns the value as pixel
  564. */
  565. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  566. /**
  567. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  568. * @param value defines the value to store
  569. * @param unit defines the unit to store
  570. * @returns the current ValueAndUnit
  571. */
  572. updateInPlace(value: number, unit?: number): ValueAndUnit;
  573. /**
  574. * Gets the value accordingly to its unit
  575. * @param host defines the root host
  576. * @returns the value
  577. */
  578. getValue(host: AdvancedDynamicTexture): number;
  579. /**
  580. * Gets a string representation of the value
  581. * @param host defines the root host
  582. * @returns a string
  583. */
  584. toString(host: AdvancedDynamicTexture): string;
  585. /**
  586. * Store a value parsed from a string
  587. * @param source defines the source string
  588. * @returns true if the value was successfully parsed
  589. */
  590. fromString(source: string | number): boolean;
  591. /** UNITMODE_PERCENTAGE */
  592. static readonly UNITMODE_PERCENTAGE: number;
  593. /** UNITMODE_PIXEL */
  594. static readonly UNITMODE_PIXEL: number;
  595. }
  596. }
  597. declare module 'babylonjs-gui/3D/controls' {
  598. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  599. export * from "babylonjs-gui/3D/controls/button3D";
  600. export * from "babylonjs-gui/3D/controls/container3D";
  601. export * from "babylonjs-gui/3D/controls/control3D";
  602. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  603. export * from "babylonjs-gui/3D/controls/holographicButton";
  604. export * from "babylonjs-gui/3D/controls/meshButton3D";
  605. export * from "babylonjs-gui/3D/controls/planePanel";
  606. export * from "babylonjs-gui/3D/controls/scatterPanel";
  607. export * from "babylonjs-gui/3D/controls/spherePanel";
  608. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  609. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  610. }
  611. declare module 'babylonjs-gui/3D/materials' {
  612. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  613. }
  614. declare module 'babylonjs-gui/3D/gui3DManager' {
  615. import { IDisposable, Scene, Nullable, UtilityLayerRenderer, Observable, Vector3, Material } from "babylonjs";
  616. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  617. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  618. /**
  619. * Class used to manage 3D user interface
  620. * @see http://doc.babylonjs.com/how_to/gui3d
  621. */
  622. export class GUI3DManager implements IDisposable {
  623. /** @hidden */
  624. _lastPickedControl: Control3D;
  625. /** @hidden */
  626. _lastControlOver: {
  627. [pointerId: number]: Control3D;
  628. };
  629. /** @hidden */
  630. _lastControlDown: {
  631. [pointerId: number]: Control3D;
  632. };
  633. /**
  634. * Observable raised when the point picked by the pointer events changed
  635. */
  636. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  637. /** @hidden */
  638. _sharedMaterials: {
  639. [key: string]: Material;
  640. };
  641. /** Gets the hosting scene */
  642. readonly scene: Scene;
  643. /** Gets associated utility layer */
  644. readonly utilityLayer: Nullable<UtilityLayerRenderer>;
  645. /**
  646. * Creates a new GUI3DManager
  647. * @param scene
  648. */
  649. constructor(scene?: Scene);
  650. /**
  651. * Gets the root container
  652. */
  653. readonly rootContainer: Container3D;
  654. /**
  655. * Gets a boolean indicating if the given control is in the root child list
  656. * @param control defines the control to check
  657. * @returns true if the control is in the root child list
  658. */
  659. containsControl(control: Control3D): boolean;
  660. /**
  661. * Adds a control to the root child list
  662. * @param control defines the control to add
  663. * @returns the current manager
  664. */
  665. addControl(control: Control3D): GUI3DManager;
  666. /**
  667. * Removes a control from the root child list
  668. * @param control defines the control to remove
  669. * @returns the current container
  670. */
  671. removeControl(control: Control3D): GUI3DManager;
  672. /**
  673. * Releases all associated resources
  674. */
  675. dispose(): void;
  676. }
  677. }
  678. declare module 'babylonjs-gui/3D/vector3WithInfo' {
  679. import { Vector3 } from "babylonjs";
  680. /**
  681. * Class used to transport Vector3 information for pointer events
  682. */
  683. export class Vector3WithInfo extends Vector3 {
  684. /** defines the current mouse button index */
  685. buttonIndex: number;
  686. /**
  687. * Creates a new Vector3WithInfo
  688. * @param source defines the vector3 data to transport
  689. * @param buttonIndex defines the current mouse button index
  690. */
  691. constructor(source: Vector3,
  692. /** defines the current mouse button index */
  693. buttonIndex?: number);
  694. }
  695. }
  696. declare module 'babylonjs-gui/2D/controls/button' {
  697. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  698. import { Control } from "babylonjs-gui/2D/controls/control";
  699. import { TextBlock } from "babylonjs-gui/2D/controls/textBlock";
  700. import { Image } from "babylonjs-gui/2D/controls/image";
  701. import { Vector2, Nullable } from "babylonjs";
  702. /**
  703. * Class used to create 2D buttons
  704. */
  705. export class Button extends Rectangle {
  706. name?: string | undefined;
  707. /**
  708. * Function called to generate a pointer enter animation
  709. */
  710. pointerEnterAnimation: () => void;
  711. /**
  712. * Function called to generate a pointer out animation
  713. */
  714. pointerOutAnimation: () => void;
  715. /**
  716. * Function called to generate a pointer down animation
  717. */
  718. pointerDownAnimation: () => void;
  719. /**
  720. * Function called to generate a pointer up animation
  721. */
  722. pointerUpAnimation: () => void;
  723. /**
  724. * Returns the image part of the button (if any)
  725. */
  726. readonly image: Nullable<Image>;
  727. /**
  728. * Returns the image part of the button (if any)
  729. */
  730. readonly textBlock: Nullable<TextBlock>;
  731. /**
  732. * Creates a new Button
  733. * @param name defines the name of the button
  734. */
  735. constructor(name?: string | undefined);
  736. protected _getTypeName(): string;
  737. /** @hidden */
  738. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  739. /** @hidden */
  740. _onPointerEnter(target: Control): boolean;
  741. /** @hidden */
  742. _onPointerOut(target: Control): void;
  743. /** @hidden */
  744. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  745. /** @hidden */
  746. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  747. /**
  748. * Creates a new button made with an image and a text
  749. * @param name defines the name of the button
  750. * @param text defines the text of the button
  751. * @param imageUrl defines the url of the image
  752. * @returns a new Button
  753. */
  754. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  755. /**
  756. * Creates a new button made with an image
  757. * @param name defines the name of the button
  758. * @param imageUrl defines the url of the image
  759. * @returns a new Button
  760. */
  761. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  762. /**
  763. * Creates a new button made with a text
  764. * @param name defines the name of the button
  765. * @param text defines the text of the button
  766. * @returns a new Button
  767. */
  768. static CreateSimpleButton(name: string, text: string): Button;
  769. /**
  770. * Creates a new button made with an image and a centered text
  771. * @param name defines the name of the button
  772. * @param text defines the text of the button
  773. * @param imageUrl defines the url of the image
  774. * @returns a new Button
  775. */
  776. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  777. }
  778. }
  779. declare module 'babylonjs-gui/2D/controls/checkbox' {
  780. import { Control } from "babylonjs-gui/2D/controls/control";
  781. import { Observable, Vector2 } from "babylonjs";
  782. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  783. /**
  784. * Class used to represent a 2D checkbox
  785. */
  786. export class Checkbox extends Control {
  787. name?: string | undefined;
  788. /** Gets or sets border thickness */
  789. thickness: number;
  790. /**
  791. * Observable raised when isChecked property changes
  792. */
  793. onIsCheckedChangedObservable: Observable<boolean>;
  794. /** Gets or sets a value indicating the ratio between overall size and check size */
  795. checkSizeRatio: number;
  796. /** Gets or sets background color */
  797. background: string;
  798. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  799. isChecked: boolean;
  800. /**
  801. * Creates a new CheckBox
  802. * @param name defines the control name
  803. */
  804. constructor(name?: string | undefined);
  805. protected _getTypeName(): string;
  806. /** @hidden */
  807. _draw(context: CanvasRenderingContext2D): void;
  808. /** @hidden */
  809. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  810. /**
  811. * Utility function to easily create a checkbox with a header
  812. * @param title defines the label to use for the header
  813. * @param onValueChanged defines the callback to call when value changes
  814. * @returns a StackPanel containing the checkbox and a textBlock
  815. */
  816. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  817. }
  818. }
  819. declare module 'babylonjs-gui/2D/controls/colorpicker' {
  820. import { Control } from "babylonjs-gui/2D/controls/control";
  821. import { Color3, Observable, Vector2 } from "babylonjs";
  822. import { Measure } from "babylonjs-gui/2D/measure";
  823. /** Class used to create color pickers */
  824. export class ColorPicker extends Control {
  825. name?: string | undefined;
  826. /**
  827. * Observable raised when the value changes
  828. */
  829. onValueChangedObservable: Observable<Color3>;
  830. /** Gets or sets the color of the color picker */
  831. value: Color3;
  832. /**
  833. * Gets or sets control width
  834. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  835. */
  836. width: string | number;
  837. /** Gets or sets control height */
  838. height: string | number;
  839. /** Gets or sets control size */
  840. size: string | number;
  841. /**
  842. * Creates a new ColorPicker
  843. * @param name defines the control name
  844. */
  845. constructor(name?: string | undefined);
  846. protected _getTypeName(): string;
  847. /** @hidden */
  848. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  849. /** @hidden */
  850. _draw(context: CanvasRenderingContext2D): void;
  851. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  852. _onPointerMove(target: Control, coordinates: Vector2): void;
  853. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  854. }
  855. }
  856. declare module 'babylonjs-gui/2D/controls/container' {
  857. import { Control } from "babylonjs-gui/2D/controls/control";
  858. import { Measure } from "babylonjs-gui/2D/measure";
  859. import { Nullable } from "babylonjs";
  860. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  861. /**
  862. * Root class for 2D containers
  863. * @see http://doc.babylonjs.com/how_to/gui#containers
  864. */
  865. export class Container extends Control {
  866. name?: string | undefined;
  867. /** @hidden */
  868. protected _children: Control[];
  869. /** @hidden */
  870. protected _measureForChildren: Measure;
  871. /** @hidden */
  872. protected _background: string;
  873. /** @hidden */
  874. protected _adaptWidthToChildren: boolean;
  875. /** @hidden */
  876. protected _adaptHeightToChildren: boolean;
  877. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  878. adaptHeightToChildren: boolean;
  879. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  880. adaptWidthToChildren: boolean;
  881. /** Gets or sets background color */
  882. background: string;
  883. /** Gets the list of children */
  884. readonly children: Control[];
  885. /**
  886. * Creates a new Container
  887. * @param name defines the name of the container
  888. */
  889. constructor(name?: string | undefined);
  890. protected _getTypeName(): string;
  891. _flagDescendantsAsMatrixDirty(): void;
  892. /**
  893. * Gets a child using its name
  894. * @param name defines the child name to look for
  895. * @returns the child control if found
  896. */
  897. getChildByName(name: string): Nullable<Control>;
  898. /**
  899. * Gets a child using its type and its name
  900. * @param name defines the child name to look for
  901. * @param type defines the child type to look for
  902. * @returns the child control if found
  903. */
  904. getChildByType(name: string, type: string): Nullable<Control>;
  905. /**
  906. * Search for a specific control in children
  907. * @param control defines the control to look for
  908. * @returns true if the control is in child list
  909. */
  910. containsControl(control: Control): boolean;
  911. /**
  912. * Adds a new control to the current container
  913. * @param control defines the control to add
  914. * @returns the current container
  915. */
  916. addControl(control: Nullable<Control>): Container;
  917. /**
  918. * Removes all controls from the current container
  919. * @returns the current container
  920. */
  921. clearControls(): Container;
  922. /**
  923. * Removes a control from the current container
  924. * @param control defines the control to remove
  925. * @returns the current container
  926. */
  927. removeControl(control: Control): Container;
  928. /** @hidden */
  929. _reOrderControl(control: Control): void;
  930. /** @hidden */
  931. _offsetLeft(offset: number): void;
  932. /** @hidden */
  933. _offsetTop(offset: number): void;
  934. /** @hidden */
  935. _markAllAsDirty(): void;
  936. /** @hidden */
  937. protected _localDraw(context: CanvasRenderingContext2D): void;
  938. /** @hidden */
  939. _link(host: AdvancedDynamicTexture): void;
  940. /** @hidden */
  941. protected _beforeLayout(): void;
  942. /** @hidden */
  943. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  944. protected _postMeasure(): void;
  945. /** @hidden */
  946. _draw(context: CanvasRenderingContext2D): void;
  947. /** @hidden */
  948. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  949. /** @hidden */
  950. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  951. /** @hidden */
  952. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  953. /** Releases associated resources */
  954. dispose(): void;
  955. }
  956. }
  957. declare module 'babylonjs-gui/2D/controls/control' {
  958. import { Container } from "babylonjs-gui/2D/controls/container";
  959. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  960. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  961. import { Nullable, Vector2, AbstractMesh, Observable, Vector3, Scene } from "babylonjs";
  962. import { Measure } from "babylonjs-gui/2D/measure";
  963. import { Style } from "babylonjs-gui/2D/style";
  964. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  965. /**
  966. * Root class used for all 2D controls
  967. * @see http://doc.babylonjs.com/how_to/gui#controls
  968. */
  969. export class Control {
  970. /** defines the name of the control */
  971. name?: string | undefined;
  972. /**
  973. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  974. */
  975. static AllowAlphaInheritance: boolean;
  976. /** @hidden */
  977. _host: AdvancedDynamicTexture;
  978. /** Gets or sets the control parent */
  979. parent: Nullable<Container>;
  980. /** @hidden */
  981. _currentMeasure: Measure;
  982. /** @hidden */
  983. _width: ValueAndUnit;
  984. /** @hidden */
  985. _height: ValueAndUnit;
  986. /** @hidden */
  987. protected _fontOffset: {
  988. ascent: number;
  989. height: number;
  990. descent: number;
  991. };
  992. /** @hidden */
  993. protected _horizontalAlignment: number;
  994. /** @hidden */
  995. protected _verticalAlignment: number;
  996. /** @hidden */
  997. protected _isDirty: boolean;
  998. /** @hidden */
  999. protected _wasDirty: boolean;
  1000. /** @hidden */
  1001. _tempParentMeasure: Measure;
  1002. /** @hidden */
  1003. protected _cachedParentMeasure: Measure;
  1004. /** @hidden */
  1005. _left: ValueAndUnit;
  1006. /** @hidden */
  1007. _top: ValueAndUnit;
  1008. /** @hidden */
  1009. protected _invertTransformMatrix: Matrix2D;
  1010. /** @hidden */
  1011. protected _transformedPosition: Vector2;
  1012. /** @hidden */
  1013. _linkedMesh: Nullable<AbstractMesh>;
  1014. protected _isEnabled: boolean;
  1015. protected _disabledColor: string;
  1016. /** @hidden */
  1017. protected _rebuildLayout: boolean;
  1018. /** @hidden */
  1019. _isClipped: boolean;
  1020. /** @hidden */
  1021. _tag: any;
  1022. /**
  1023. * 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
  1024. */
  1025. uniqueId: number;
  1026. /**
  1027. * Gets or sets an object used to store user defined information for the node
  1028. */
  1029. metadata: any;
  1030. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  1031. isHitTestVisible: boolean;
  1032. /** Gets or sets a boolean indicating if the control can block pointer events */
  1033. isPointerBlocker: boolean;
  1034. /** Gets or sets a boolean indicating if the control can be focusable */
  1035. isFocusInvisible: boolean;
  1036. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  1037. clipChildren: boolean;
  1038. /**
  1039. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  1040. */
  1041. useBitmapCache: boolean;
  1042. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  1043. shadowOffsetX: number;
  1044. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  1045. shadowOffsetY: number;
  1046. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  1047. shadowBlur: number;
  1048. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  1049. shadowColor: string;
  1050. /** Gets or sets the cursor to use when the control is hovered */
  1051. hoverCursor: string;
  1052. /** @hidden */
  1053. protected _linkOffsetX: ValueAndUnit;
  1054. /** @hidden */
  1055. protected _linkOffsetY: ValueAndUnit;
  1056. /** Gets the control type name */
  1057. readonly typeName: string;
  1058. /**
  1059. * Get the current class name of the control.
  1060. * @returns current class name
  1061. */
  1062. getClassName(): string;
  1063. /**
  1064. * An event triggered when the pointer move over the control.
  1065. */
  1066. onPointerMoveObservable: Observable<Vector2>;
  1067. /**
  1068. * An event triggered when the pointer move out of the control.
  1069. */
  1070. onPointerOutObservable: Observable<Control>;
  1071. /**
  1072. * An event triggered when the pointer taps the control
  1073. */
  1074. onPointerDownObservable: Observable<Vector2WithInfo>;
  1075. /**
  1076. * An event triggered when pointer up
  1077. */
  1078. onPointerUpObservable: Observable<Vector2WithInfo>;
  1079. /**
  1080. * An event triggered when a control is clicked on
  1081. */
  1082. onPointerClickObservable: Observable<Vector2WithInfo>;
  1083. /**
  1084. * An event triggered when pointer enters the control
  1085. */
  1086. onPointerEnterObservable: Observable<Control>;
  1087. /**
  1088. * An event triggered when the control is marked as dirty
  1089. */
  1090. onDirtyObservable: Observable<Control>;
  1091. /**
  1092. * An event triggered before drawing the control
  1093. */
  1094. onBeforeDrawObservable: Observable<Control>;
  1095. /**
  1096. * An event triggered after the control was drawn
  1097. */
  1098. onAfterDrawObservable: Observable<Control>;
  1099. /**
  1100. * Get the hosting AdvancedDynamicTexture
  1101. */
  1102. readonly host: AdvancedDynamicTexture;
  1103. /** Gets or set information about font offsets (used to render and align text) */
  1104. fontOffset: {
  1105. ascent: number;
  1106. height: number;
  1107. descent: number;
  1108. };
  1109. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  1110. alpha: number;
  1111. /**
  1112. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  1113. */
  1114. isHighlighted: boolean;
  1115. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  1116. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1117. */
  1118. scaleX: number;
  1119. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  1120. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1121. */
  1122. scaleY: number;
  1123. /** Gets or sets the rotation angle (0 by default)
  1124. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1125. */
  1126. rotation: number;
  1127. /** Gets or sets the transformation center on Y axis (0 by default)
  1128. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1129. */
  1130. transformCenterY: number;
  1131. /** Gets or sets the transformation center on X axis (0 by default)
  1132. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1133. */
  1134. transformCenterX: number;
  1135. /**
  1136. * Gets or sets the horizontal alignment
  1137. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1138. */
  1139. horizontalAlignment: number;
  1140. /**
  1141. * Gets or sets the vertical alignment
  1142. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1143. */
  1144. verticalAlignment: number;
  1145. /**
  1146. * Gets or sets control width
  1147. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1148. */
  1149. width: string | number;
  1150. /**
  1151. * Gets control width in pixel
  1152. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1153. */
  1154. readonly widthInPixels: number;
  1155. /**
  1156. * Gets or sets control height
  1157. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1158. */
  1159. height: string | number;
  1160. /**
  1161. * Gets control height in pixel
  1162. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1163. */
  1164. readonly heightInPixels: number;
  1165. /** Gets or set font family */
  1166. fontFamily: string;
  1167. /** Gets or sets font style */
  1168. fontStyle: string;
  1169. /** Gets or sets font weight */
  1170. fontWeight: string;
  1171. /**
  1172. * Gets or sets style
  1173. * @see http://doc.babylonjs.com/how_to/gui#styles
  1174. */
  1175. style: Nullable<Style>;
  1176. /** @hidden */
  1177. readonly _isFontSizeInPercentage: boolean;
  1178. /** Gets font size in pixels */
  1179. readonly fontSizeInPixels: number;
  1180. /** Gets or sets font size */
  1181. fontSize: string | number;
  1182. /** Gets or sets foreground color */
  1183. color: string;
  1184. /** Gets or sets z index which is used to reorder controls on the z axis */
  1185. zIndex: number;
  1186. /** Gets or sets a boolean indicating if the control can be rendered */
  1187. notRenderable: boolean;
  1188. /** Gets or sets a boolean indicating if the control is visible */
  1189. isVisible: boolean;
  1190. /** Gets a boolean indicating that the control needs to update its rendering */
  1191. readonly isDirty: boolean;
  1192. /**
  1193. * Gets the current linked mesh (or null if none)
  1194. */
  1195. readonly linkedMesh: Nullable<AbstractMesh>;
  1196. /**
  1197. * Gets or sets a value indicating the padding to use on the left of the control
  1198. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1199. */
  1200. paddingLeft: string | number;
  1201. /**
  1202. * Gets a value indicating the padding in pixels to use on the left of the control
  1203. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1204. */
  1205. readonly paddingLeftInPixels: number;
  1206. /**
  1207. * Gets or sets a value indicating the padding to use on the right of the control
  1208. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1209. */
  1210. paddingRight: string | number;
  1211. /**
  1212. * Gets a value indicating the padding in pixels to use on the right of the control
  1213. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1214. */
  1215. readonly paddingRightInPixels: number;
  1216. /**
  1217. * Gets or sets a value indicating the padding to use on the top of the control
  1218. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1219. */
  1220. paddingTop: string | number;
  1221. /**
  1222. * Gets a value indicating the padding in pixels to use on the top of the control
  1223. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1224. */
  1225. readonly paddingTopInPixels: number;
  1226. /**
  1227. * Gets or sets a value indicating the padding to use on the bottom of the control
  1228. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1229. */
  1230. paddingBottom: string | number;
  1231. /**
  1232. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1233. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1234. */
  1235. readonly paddingBottomInPixels: number;
  1236. /**
  1237. * Gets or sets a value indicating the left coordinate of the control
  1238. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1239. */
  1240. left: string | number;
  1241. /**
  1242. * Gets a value indicating the left coordinate in pixels of the control
  1243. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1244. */
  1245. readonly leftInPixels: number;
  1246. /**
  1247. * Gets or sets a value indicating the top coordinate of the control
  1248. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1249. */
  1250. top: string | number;
  1251. /**
  1252. * Gets a value indicating the top coordinate in pixels of the control
  1253. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1254. */
  1255. readonly topInPixels: number;
  1256. /**
  1257. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1258. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1259. */
  1260. linkOffsetX: string | number;
  1261. /**
  1262. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1263. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1264. */
  1265. readonly linkOffsetXInPixels: number;
  1266. /**
  1267. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1268. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1269. */
  1270. linkOffsetY: string | number;
  1271. /**
  1272. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1273. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1274. */
  1275. readonly linkOffsetYInPixels: number;
  1276. /** Gets the center coordinate on X axis */
  1277. readonly centerX: number;
  1278. /** Gets the center coordinate on Y axis */
  1279. readonly centerY: number;
  1280. /** Gets or sets if control is Enabled*/
  1281. isEnabled: boolean;
  1282. /** Gets or sets background color of control if it's disabled*/
  1283. disabledColor: string;
  1284. /**
  1285. * Creates a new control
  1286. * @param name defines the name of the control
  1287. */
  1288. constructor(
  1289. /** defines the name of the control */
  1290. name?: string | undefined);
  1291. /** @hidden */
  1292. protected _getTypeName(): string;
  1293. /**
  1294. * Gets the first ascendant in the hierarchy of the given type
  1295. * @param className defines the required type
  1296. * @returns the ascendant or null if not found
  1297. */
  1298. getAscendantOfClass(className: string): Nullable<Control>;
  1299. /** @hidden */
  1300. _resetFontCache(): void;
  1301. /**
  1302. * Determines if a container is an ascendant of the current control
  1303. * @param container defines the container to look for
  1304. * @returns true if the container is one of the ascendant of the control
  1305. */
  1306. isAscendant(container: Control): boolean;
  1307. /**
  1308. * Gets coordinates in local control space
  1309. * @param globalCoordinates defines the coordinates to transform
  1310. * @returns the new coordinates in local space
  1311. */
  1312. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1313. /**
  1314. * Gets coordinates in local control space
  1315. * @param globalCoordinates defines the coordinates to transform
  1316. * @param result defines the target vector2 where to store the result
  1317. * @returns the current control
  1318. */
  1319. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1320. /**
  1321. * Gets coordinates in parent local control space
  1322. * @param globalCoordinates defines the coordinates to transform
  1323. * @returns the new coordinates in parent local space
  1324. */
  1325. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1326. /**
  1327. * Move the current control to a vector3 position projected onto the screen.
  1328. * @param position defines the target position
  1329. * @param scene defines the hosting scene
  1330. */
  1331. moveToVector3(position: Vector3, scene: Scene): void;
  1332. /** @hidden */
  1333. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1334. /**
  1335. * Will return all controls that have this control as ascendant
  1336. * @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
  1337. * @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
  1338. * @return all child controls
  1339. */
  1340. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1341. /**
  1342. * Link current control with a target mesh
  1343. * @param mesh defines the mesh to link with
  1344. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1345. */
  1346. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  1347. /** @hidden */
  1348. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1349. /** @hidden */
  1350. _offsetLeft(offset: number): void;
  1351. /** @hidden */
  1352. _offsetTop(offset: number): void;
  1353. /** @hidden */
  1354. _markMatrixAsDirty(): void;
  1355. /** @hidden */
  1356. _flagDescendantsAsMatrixDirty(): void;
  1357. /** @hidden */
  1358. _markAsDirty(force?: boolean): void;
  1359. /** @hidden */
  1360. _markAllAsDirty(): void;
  1361. /** @hidden */
  1362. _link(host: AdvancedDynamicTexture): void;
  1363. /** @hidden */
  1364. protected _transform(context: CanvasRenderingContext2D): void;
  1365. /** @hidden */
  1366. _renderHighlight(context: CanvasRenderingContext2D): void;
  1367. /** @hidden */
  1368. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1369. /** @hidden */
  1370. protected _applyStates(context: CanvasRenderingContext2D): void;
  1371. /** @hidden */
  1372. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1373. /** @hidden */
  1374. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1375. /** @hidden */
  1376. _measure(): void;
  1377. /** @hidden */
  1378. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1379. /** @hidden */
  1380. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1381. /** @hidden */
  1382. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1383. /** @hidden */
  1384. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1385. /** @hidden */
  1386. _render(context: CanvasRenderingContext2D): boolean;
  1387. /** @hidden */
  1388. _draw(context: CanvasRenderingContext2D): void;
  1389. /**
  1390. * Tests if a given coordinates belong to the current control
  1391. * @param x defines x coordinate to test
  1392. * @param y defines y coordinate to test
  1393. * @returns true if the coordinates are inside the control
  1394. */
  1395. contains(x: number, y: number): boolean;
  1396. /** @hidden */
  1397. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1398. /** @hidden */
  1399. _onPointerMove(target: Control, coordinates: Vector2): void;
  1400. /** @hidden */
  1401. _onPointerEnter(target: Control): boolean;
  1402. /** @hidden */
  1403. _onPointerOut(target: Control): void;
  1404. /** @hidden */
  1405. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1406. /** @hidden */
  1407. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1408. /** @hidden */
  1409. _forcePointerUp(pointerId?: Nullable<number>): void;
  1410. /** @hidden */
  1411. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1412. /** Releases associated resources */
  1413. dispose(): void;
  1414. /** HORIZONTAL_ALIGNMENT_LEFT */
  1415. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1416. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1417. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1418. /** HORIZONTAL_ALIGNMENT_CENTER */
  1419. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1420. /** VERTICAL_ALIGNMENT_TOP */
  1421. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1422. /** VERTICAL_ALIGNMENT_BOTTOM */
  1423. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1424. /** VERTICAL_ALIGNMENT_CENTER */
  1425. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1426. /** @hidden */
  1427. static _GetFontOffset(font: string): {
  1428. ascent: number;
  1429. height: number;
  1430. descent: number;
  1431. };
  1432. /**
  1433. * Creates a stack panel that can be used to render headers
  1434. * @param control defines the control to associate with the header
  1435. * @param text defines the text of the header
  1436. * @param size defines the size of the header
  1437. * @param options defines options used to configure the header
  1438. * @returns a new StackPanel
  1439. * @ignore
  1440. * @hidden
  1441. */
  1442. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1443. isHorizontal: boolean;
  1444. controlFirst: boolean;
  1445. }) => any;
  1446. /** @hidden */
  1447. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1448. }
  1449. }
  1450. declare module 'babylonjs-gui/2D/controls/ellipse' {
  1451. import { Container } from "babylonjs-gui/2D/controls/container";
  1452. import { Measure } from "babylonjs-gui/2D/measure";
  1453. /** Class used to create 2D ellipse containers */
  1454. export class Ellipse extends Container {
  1455. name?: string | undefined;
  1456. /** Gets or sets border thickness */
  1457. thickness: number;
  1458. /**
  1459. * Creates a new Ellipse
  1460. * @param name defines the control name
  1461. */
  1462. constructor(name?: string | undefined);
  1463. protected _getTypeName(): string;
  1464. protected _localDraw(context: CanvasRenderingContext2D): void;
  1465. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1466. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1467. }
  1468. }
  1469. declare module 'babylonjs-gui/2D/controls/grid' {
  1470. import { Container } from "babylonjs-gui/2D/controls/container";
  1471. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  1472. import { Control } from "babylonjs-gui/2D/controls/control";
  1473. import { Measure } from "babylonjs-gui/2D/measure";
  1474. import { Nullable } from "babylonjs";
  1475. /**
  1476. * Class used to create a 2D grid container
  1477. */
  1478. export class Grid extends Container {
  1479. name?: string | undefined;
  1480. /**
  1481. * Gets the number of columns
  1482. */
  1483. readonly columnCount: number;
  1484. /**
  1485. * Gets the number of rows
  1486. */
  1487. readonly rowCount: number;
  1488. /** Gets the list of children */
  1489. readonly children: Control[];
  1490. /**
  1491. * Gets the definition of a specific row
  1492. * @param index defines the index of the row
  1493. * @returns the row definition
  1494. */
  1495. getRowDefinition(index: number): Nullable<ValueAndUnit>;
  1496. /**
  1497. * Gets the definition of a specific column
  1498. * @param index defines the index of the column
  1499. * @returns the column definition
  1500. */
  1501. getColumnDefinition(index: number): Nullable<ValueAndUnit>;
  1502. /**
  1503. * Adds a new row to the grid
  1504. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1505. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1506. * @returns the current grid
  1507. */
  1508. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1509. /**
  1510. * Adds a new column to the grid
  1511. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1512. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1513. * @returns the current grid
  1514. */
  1515. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1516. /**
  1517. * Update a row definition
  1518. * @param index defines the index of the row to update
  1519. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1520. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1521. * @returns the current grid
  1522. */
  1523. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1524. /**
  1525. * Update a column definition
  1526. * @param index defines the index of the column to update
  1527. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1528. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1529. * @returns the current grid
  1530. */
  1531. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1532. /**
  1533. * Gets the list of children stored in a specific cell
  1534. * @param row defines the row to check
  1535. * @param column defines the column to check
  1536. * @returns the list of controls
  1537. */
  1538. getChildrenAt(row: number, column: number): Nullable<Array<Control>>;
  1539. /**
  1540. * Gets a string representing the child cell info (row x column)
  1541. * @param child defines the control to get info from
  1542. * @returns a string containing the child cell info (row x column)
  1543. */
  1544. getChildCellInfo(child: Control): string;
  1545. /**
  1546. * Remove a column definition at specified index
  1547. * @param index defines the index of the column to remove
  1548. * @returns the current grid
  1549. */
  1550. removeColumnDefinition(index: number): Grid;
  1551. /**
  1552. * Remove a row definition at specified index
  1553. * @param index defines the index of the row to remove
  1554. * @returns the current grid
  1555. */
  1556. removeRowDefinition(index: number): Grid;
  1557. /**
  1558. * Adds a new control to the current grid
  1559. * @param control defines the control to add
  1560. * @param row defines the row where to add the control (0 by default)
  1561. * @param column defines the column where to add the control (0 by default)
  1562. * @returns the current grid
  1563. */
  1564. addControl(control: Control, row?: number, column?: number): Grid;
  1565. /**
  1566. * Removes a control from the current container
  1567. * @param control defines the control to remove
  1568. * @returns the current container
  1569. */
  1570. removeControl(control: Control): Container;
  1571. /**
  1572. * Creates a new Grid
  1573. * @param name defines control name
  1574. */
  1575. constructor(name?: string | undefined);
  1576. protected _getTypeName(): string;
  1577. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  1578. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1579. _flagDescendantsAsMatrixDirty(): void;
  1580. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1581. /** Releases associated resources */
  1582. dispose(): void;
  1583. }
  1584. }
  1585. declare module 'babylonjs-gui/2D/controls/image' {
  1586. import { Control } from "babylonjs-gui/2D/controls/control";
  1587. import { Nullable, Observable } from "babylonjs";
  1588. import { Measure } from "2D";
  1589. /**
  1590. * Class used to create 2D images
  1591. */
  1592. export class Image extends Control {
  1593. name?: string | undefined;
  1594. /**
  1595. * Observable notified when the content is loaded
  1596. */
  1597. onImageLoadedObservable: Observable<Image>;
  1598. /**
  1599. * Gets a boolean indicating that the content is loaded
  1600. */
  1601. readonly isLoaded: boolean;
  1602. /**
  1603. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  1604. */
  1605. populateNinePatchSlicesFromImage: boolean;
  1606. /**
  1607. * Gets or sets the left value for slicing (9-patch)
  1608. */
  1609. sliceLeft: number;
  1610. /**
  1611. * Gets or sets the right value for slicing (9-patch)
  1612. */
  1613. sliceRight: number;
  1614. /**
  1615. * Gets or sets the top value for slicing (9-patch)
  1616. */
  1617. sliceTop: number;
  1618. /**
  1619. * Gets or sets the bottom value for slicing (9-patch)
  1620. */
  1621. sliceBottom: number;
  1622. /**
  1623. * Gets or sets the left coordinate in the source image
  1624. */
  1625. sourceLeft: number;
  1626. /**
  1627. * Gets or sets the top coordinate in the source image
  1628. */
  1629. sourceTop: number;
  1630. /**
  1631. * Gets or sets the width to capture in the source image
  1632. */
  1633. sourceWidth: number;
  1634. /**
  1635. * Gets or sets the height to capture in the source image
  1636. */
  1637. sourceHeight: number;
  1638. /**
  1639. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1640. * @see http://doc.babylonjs.com/how_to/gui#image
  1641. */
  1642. autoScale: boolean;
  1643. /** Gets or sets the streching mode used by the image */
  1644. stretch: number;
  1645. /**
  1646. * Gets or sets the internal DOM image used to render the control
  1647. */
  1648. domImage: HTMLImageElement;
  1649. /**
  1650. * Gets or sets image source url
  1651. */
  1652. source: Nullable<string>;
  1653. /**
  1654. * Gets or sets the cell width to use when animation sheet is enabled
  1655. * @see http://doc.babylonjs.com/how_to/gui#image
  1656. */
  1657. cellWidth: number;
  1658. /**
  1659. * Gets or sets the cell height to use when animation sheet is enabled
  1660. * @see http://doc.babylonjs.com/how_to/gui#image
  1661. */
  1662. cellHeight: number;
  1663. /**
  1664. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1665. * @see http://doc.babylonjs.com/how_to/gui#image
  1666. */
  1667. cellId: number;
  1668. /**
  1669. * Creates a new Image
  1670. * @param name defines the control name
  1671. * @param url defines the image url
  1672. */
  1673. constructor(name?: string | undefined, url?: Nullable<string>);
  1674. protected _getTypeName(): string;
  1675. /** Force the control to synchronize with its content */
  1676. synchronizeSizeWithContent(): void;
  1677. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1678. _draw(context: CanvasRenderingContext2D): void;
  1679. dispose(): void;
  1680. /** STRETCH_NONE */
  1681. static readonly STRETCH_NONE: number;
  1682. /** STRETCH_FILL */
  1683. static readonly STRETCH_FILL: number;
  1684. /** STRETCH_UNIFORM */
  1685. static readonly STRETCH_UNIFORM: number;
  1686. /** STRETCH_EXTEND */
  1687. static readonly STRETCH_EXTEND: number;
  1688. /** NINE_PATCH */
  1689. static readonly STRETCH_NINE_PATCH: number;
  1690. }
  1691. }
  1692. declare module 'babylonjs-gui/2D/controls/inputText' {
  1693. import { Control } from "babylonjs-gui/2D/controls/control";
  1694. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  1695. import { Nullable, Observable, Vector2 } from 'babylonjs';
  1696. import { VirtualKeyboard } from "babylonjs-gui/2D/controls/virtualKeyboard";
  1697. /**
  1698. * Class used to create input text control
  1699. */
  1700. export class InputText extends Control implements IFocusableControl {
  1701. name?: string | undefined;
  1702. /** @hidden */
  1703. _connectedVirtualKeyboard: Nullable<VirtualKeyboard>;
  1704. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1705. promptMessage: string;
  1706. /** Observable raised when the text changes */
  1707. onTextChangedObservable: Observable<InputText>;
  1708. /** Observable raised just before an entered character is to be added */
  1709. onBeforeKeyAddObservable: Observable<InputText>;
  1710. /** Observable raised when the control gets the focus */
  1711. onFocusObservable: Observable<InputText>;
  1712. /** Observable raised when the control loses the focus */
  1713. onBlurObservable: Observable<InputText>;
  1714. /**Observable raised when the text is highlighted */
  1715. onTextHighlightObservable: Observable<InputText>;
  1716. /**Observable raised when copy event is triggered */
  1717. onTextCopyObservable: Observable<InputText>;
  1718. /** Observable raised when cut event is triggered */
  1719. onTextCutObservable: Observable<InputText>;
  1720. /** Observable raised when paste event is triggered */
  1721. onTextPasteObservable: Observable<InputText>;
  1722. /** Observable raised when a key event was processed */
  1723. onKeyboardEventProcessedObservable: Observable<KeyboardEvent>;
  1724. /** Gets or sets the maximum width allowed by the control */
  1725. maxWidth: string | number;
  1726. /** Gets the maximum width allowed by the control in pixels */
  1727. readonly maxWidthInPixels: number;
  1728. /** Gets or sets the text highlighter transparency; default: 0.4 */
  1729. highligherOpacity: number;
  1730. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  1731. onFocusSelectAll: boolean;
  1732. /** Gets or sets the text hightlight color */
  1733. textHighlightColor: string;
  1734. /** Gets or sets control margin */
  1735. margin: string;
  1736. /** Gets control margin in pixels */
  1737. readonly marginInPixels: number;
  1738. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1739. autoStretchWidth: boolean;
  1740. /** Gets or sets border thickness */
  1741. thickness: number;
  1742. /** Gets or sets the background color when focused */
  1743. focusedBackground: string;
  1744. /** Gets or sets the background color when focused */
  1745. focusedColor: string;
  1746. /** Gets or sets the background color */
  1747. background: string;
  1748. /** Gets or sets the placeholder color */
  1749. placeholderColor: string;
  1750. /** Gets or sets the text displayed when the control is empty */
  1751. placeholderText: string;
  1752. /** Gets or sets the dead key flag */
  1753. deadKey: boolean;
  1754. /** Gets or sets the highlight text */
  1755. highlightedText: string;
  1756. /** Gets or sets if the current key should be added */
  1757. addKey: boolean;
  1758. /** Gets or sets the value of the current key being entered */
  1759. currentKey: string;
  1760. /** Gets or sets the text displayed in the control */
  1761. text: string;
  1762. /** Gets or sets control width */
  1763. width: string | number;
  1764. /**
  1765. * Creates a new InputText
  1766. * @param name defines the control name
  1767. * @param text defines the text of the control
  1768. */
  1769. constructor(name?: string | undefined, text?: string);
  1770. /** @hidden */
  1771. onBlur(): void;
  1772. /** @hidden */
  1773. onFocus(): void;
  1774. protected _getTypeName(): string;
  1775. /**
  1776. * Function called to get the list of controls that should not steal the focus from this control
  1777. * @returns an array of controls
  1778. */
  1779. keepsFocusWith(): Nullable<Control[]>;
  1780. /** @hidden */
  1781. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  1782. /**
  1783. * Handles the keyboard event
  1784. * @param evt Defines the KeyboardEvent
  1785. */
  1786. processKeyboard(evt: KeyboardEvent): void;
  1787. _draw(context: CanvasRenderingContext2D): void;
  1788. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1789. _onPointerMove(target: Control, coordinates: Vector2): void;
  1790. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1791. protected _beforeRenderText(text: string): string;
  1792. dispose(): void;
  1793. }
  1794. }
  1795. declare module 'babylonjs-gui/2D/controls/inputPassword' {
  1796. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1797. /**
  1798. * Class used to create a password control
  1799. */
  1800. export class InputPassword extends InputText {
  1801. protected _beforeRenderText(text: string): string;
  1802. }
  1803. }
  1804. declare module 'babylonjs-gui/2D/controls/line' {
  1805. import { Control } from "babylonjs-gui/2D/controls/control";
  1806. import { Vector3, Scene } from "babylonjs";
  1807. import { Measure } from "babylonjs-gui/2D/measure";
  1808. /** Class used to render 2D lines */
  1809. export class Line extends Control {
  1810. name?: string | undefined;
  1811. /** Gets or sets the dash pattern */
  1812. dash: Array<number>;
  1813. /** Gets or sets the control connected with the line end */
  1814. connectedControl: Control;
  1815. /** Gets or sets start coordinates on X axis */
  1816. x1: string | number;
  1817. /** Gets or sets start coordinates on Y axis */
  1818. y1: string | number;
  1819. /** Gets or sets end coordinates on X axis */
  1820. x2: string | number;
  1821. /** Gets or sets end coordinates on Y axis */
  1822. y2: string | number;
  1823. /** Gets or sets line width */
  1824. lineWidth: number;
  1825. /** Gets or sets horizontal alignment */
  1826. horizontalAlignment: number;
  1827. /** Gets or sets vertical alignment */
  1828. verticalAlignment: number;
  1829. /**
  1830. * Creates a new Line
  1831. * @param name defines the control name
  1832. */
  1833. constructor(name?: string | undefined);
  1834. protected _getTypeName(): string;
  1835. _draw(context: CanvasRenderingContext2D): void;
  1836. _measure(): void;
  1837. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1838. /**
  1839. * Move one end of the line given 3D cartesian coordinates.
  1840. * @param position Targeted world position
  1841. * @param scene Scene
  1842. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1843. */
  1844. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  1845. /**
  1846. * Move one end of the line to a position in screen absolute space.
  1847. * @param projectedPosition Position in screen absolute space (X, Y)
  1848. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1849. */
  1850. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  1851. }
  1852. }
  1853. declare module 'babylonjs-gui/2D/controls/multiLine' {
  1854. import { Control } from "babylonjs-gui/2D/controls/control";
  1855. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  1856. import { AbstractMesh } from "babylonjs";
  1857. import { Measure } from "babylonjs-gui/2D/measure";
  1858. /**
  1859. * Class used to create multi line control
  1860. */
  1861. export class MultiLine extends Control {
  1862. name?: string | undefined;
  1863. /**
  1864. * Creates a new MultiLine
  1865. * @param name defines the control name
  1866. */
  1867. constructor(name?: string | undefined);
  1868. /** Gets or sets dash pattern */
  1869. dash: Array<number>;
  1870. /**
  1871. * Gets point stored at specified index
  1872. * @param index defines the index to look for
  1873. * @returns the requested point if found
  1874. */
  1875. getAt(index: number): MultiLinePoint;
  1876. /** Function called when a point is updated */
  1877. onPointUpdate: () => void;
  1878. /**
  1879. * Adds new points to the point collection
  1880. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1881. * @returns the list of created MultiLinePoint
  1882. */
  1883. add(...items: (AbstractMesh | Control | {
  1884. x: string | number;
  1885. y: string | number;
  1886. })[]): MultiLinePoint[];
  1887. /**
  1888. * Adds a new point to the point collection
  1889. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1890. * @returns the created MultiLinePoint
  1891. */
  1892. push(item?: (AbstractMesh | Control | {
  1893. x: string | number;
  1894. y: string | number;
  1895. })): MultiLinePoint;
  1896. /**
  1897. * Remove a specific value or point from the active point collection
  1898. * @param value defines the value or point to remove
  1899. */
  1900. remove(value: number | MultiLinePoint): void;
  1901. /**
  1902. * Resets this object to initial state (no point)
  1903. */
  1904. reset(): void;
  1905. /**
  1906. * Resets all links
  1907. */
  1908. resetLinks(): void;
  1909. /** Gets or sets line width */
  1910. lineWidth: number;
  1911. horizontalAlignment: number;
  1912. verticalAlignment: number;
  1913. protected _getTypeName(): string;
  1914. _draw(context: CanvasRenderingContext2D): void;
  1915. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1916. _measure(): void;
  1917. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1918. dispose(): void;
  1919. }
  1920. }
  1921. declare module 'babylonjs-gui/2D/controls/radioButton' {
  1922. import { Control } from "babylonjs-gui/2D/controls/control";
  1923. import { Observable, Vector2 } from "babylonjs";
  1924. import { StackPanel } from "babylonjs-gui/2D/controls";
  1925. /**
  1926. * Class used to create radio button controls
  1927. */
  1928. export class RadioButton extends Control {
  1929. name?: string | undefined;
  1930. /** Gets or sets border thickness */
  1931. thickness: number;
  1932. /** Gets or sets group name */
  1933. group: string;
  1934. /** Observable raised when isChecked is changed */
  1935. onIsCheckedChangedObservable: Observable<boolean>;
  1936. /** Gets or sets a value indicating the ratio between overall size and check size */
  1937. checkSizeRatio: number;
  1938. /** Gets or sets background color */
  1939. background: string;
  1940. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1941. isChecked: boolean;
  1942. /**
  1943. * Creates a new RadioButton
  1944. * @param name defines the control name
  1945. */
  1946. constructor(name?: string | undefined);
  1947. protected _getTypeName(): string;
  1948. _draw(context: CanvasRenderingContext2D): void;
  1949. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1950. /**
  1951. * Utility function to easily create a radio button with a header
  1952. * @param title defines the label to use for the header
  1953. * @param group defines the group to use for the radio button
  1954. * @param isChecked defines the initial state of the radio button
  1955. * @param onValueChanged defines the callback to call when value changes
  1956. * @returns a StackPanel containing the radio button and a textBlock
  1957. */
  1958. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  1959. }
  1960. }
  1961. declare module 'babylonjs-gui/2D/controls/stackPanel' {
  1962. import { Container } from "babylonjs-gui/2D/controls/container";
  1963. import { Measure } from "babylonjs-gui/2D/measure";
  1964. /**
  1965. * Class used to create a 2D stack panel container
  1966. */
  1967. export class StackPanel extends Container {
  1968. name?: string | undefined;
  1969. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1970. isVertical: boolean;
  1971. /**
  1972. * Gets or sets panel width.
  1973. * This value should not be set when in horizontal mode as it will be computed automatically
  1974. */
  1975. width: string | number;
  1976. /**
  1977. * Gets or sets panel height.
  1978. * This value should not be set when in vertical mode as it will be computed automatically
  1979. */
  1980. height: string | number;
  1981. /**
  1982. * Creates a new StackPanel
  1983. * @param name defines control name
  1984. */
  1985. constructor(name?: string | undefined);
  1986. protected _getTypeName(): string;
  1987. /** @hidden */
  1988. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1989. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1990. protected _postMeasure(): void;
  1991. }
  1992. }
  1993. declare module 'babylonjs-gui/2D/controls/selector' {
  1994. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  1995. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1996. /** Class used to create a RadioGroup
  1997. * which contains groups of radio buttons
  1998. */
  1999. export class SelectorGroup {
  2000. /** name of SelectorGroup */
  2001. name: string;
  2002. /**
  2003. * Creates a new SelectorGroup
  2004. * @param name of group, used as a group heading
  2005. */
  2006. constructor(
  2007. /** name of SelectorGroup */
  2008. name: string);
  2009. /** Gets the groupPanel of the SelectorGroup */
  2010. readonly groupPanel: StackPanel;
  2011. /** Gets the selectors array */
  2012. readonly selectors: StackPanel[];
  2013. /** Gets and sets the group header */
  2014. header: string;
  2015. /** @hidden*/
  2016. _getSelector(selectorNb: number): StackPanel | undefined;
  2017. /** Removes the selector at the given position
  2018. * @param selectorNb the position of the selector within the group
  2019. */
  2020. removeSelector(selectorNb: number): void;
  2021. }
  2022. /** Class used to create a CheckboxGroup
  2023. * which contains groups of checkbox buttons
  2024. */
  2025. export class CheckboxGroup extends SelectorGroup {
  2026. /** Adds a checkbox as a control
  2027. * @param text is the label for the selector
  2028. * @param func is the function called when the Selector is checked
  2029. * @param checked is true when Selector is checked
  2030. */
  2031. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  2032. /** @hidden */
  2033. _setSelectorLabel(selectorNb: number, label: string): void;
  2034. /** @hidden */
  2035. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2036. /** @hidden */
  2037. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2038. /** @hidden */
  2039. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2040. }
  2041. /** Class used to create a RadioGroup
  2042. * which contains groups of radio buttons
  2043. */
  2044. export class RadioGroup extends SelectorGroup {
  2045. /** Adds a radio button as a control
  2046. * @param label is the label for the selector
  2047. * @param func is the function called when the Selector is checked
  2048. * @param checked is true when Selector is checked
  2049. */
  2050. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  2051. /** @hidden */
  2052. _setSelectorLabel(selectorNb: number, label: string): void;
  2053. /** @hidden */
  2054. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2055. /** @hidden */
  2056. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2057. /** @hidden */
  2058. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2059. }
  2060. /** Class used to create a SliderGroup
  2061. * which contains groups of slider buttons
  2062. */
  2063. export class SliderGroup extends SelectorGroup {
  2064. /**
  2065. * Adds a slider to the SelectorGroup
  2066. * @param label is the label for the SliderBar
  2067. * @param func is the function called when the Slider moves
  2068. * @param unit is a string describing the units used, eg degrees or metres
  2069. * @param min is the minimum value for the Slider
  2070. * @param max is the maximum value for the Slider
  2071. * @param value is the start value for the Slider between min and max
  2072. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  2073. */
  2074. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  2075. /** @hidden */
  2076. _setSelectorLabel(selectorNb: number, label: string): void;
  2077. /** @hidden */
  2078. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2079. /** @hidden */
  2080. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2081. /** @hidden */
  2082. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2083. }
  2084. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  2085. * @see http://doc.babylonjs.com/how_to/selector
  2086. */
  2087. export class SelectionPanel extends Rectangle {
  2088. /** name of SelectionPanel */
  2089. name: string;
  2090. /** an array of SelectionGroups */
  2091. groups: SelectorGroup[];
  2092. /**
  2093. * Creates a new SelectionPanel
  2094. * @param name of SelectionPanel
  2095. * @param groups is an array of SelectionGroups
  2096. */
  2097. constructor(
  2098. /** name of SelectionPanel */
  2099. name: string,
  2100. /** an array of SelectionGroups */
  2101. groups?: SelectorGroup[]);
  2102. protected _getTypeName(): string;
  2103. /** Gets or sets the headerColor */
  2104. headerColor: string;
  2105. /** Gets or sets the button color */
  2106. buttonColor: string;
  2107. /** Gets or sets the label color */
  2108. labelColor: string;
  2109. /** Gets or sets the button background */
  2110. buttonBackground: string;
  2111. /** Gets or sets the color of separator bar */
  2112. barColor: string;
  2113. /** Gets or sets the height of separator bar */
  2114. barHeight: string;
  2115. /** Gets or sets the height of spacers*/
  2116. spacerHeight: string;
  2117. /** Add a group to the selection panel
  2118. * @param group is the selector group to add
  2119. */
  2120. addGroup(group: SelectorGroup): void;
  2121. /** Remove the group from the given position
  2122. * @param groupNb is the position of the group in the list
  2123. */
  2124. removeGroup(groupNb: number): void;
  2125. /** Change a group header label
  2126. * @param label is the new group header label
  2127. * @param groupNb is the number of the group to relabel
  2128. * */
  2129. setHeaderName(label: string, groupNb: number): void;
  2130. /** Change selector label to the one given
  2131. * @param label is the new selector label
  2132. * @param groupNb is the number of the groupcontaining the selector
  2133. * @param selectorNb is the number of the selector within a group to relabel
  2134. * */
  2135. relabel(label: string, groupNb: number, selectorNb: number): void;
  2136. /** For a given group position remove the selector at the given position
  2137. * @param groupNb is the number of the group to remove the selector from
  2138. * @param selectorNb is the number of the selector within the group
  2139. */
  2140. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  2141. /** For a given group position of correct type add a checkbox button
  2142. * @param groupNb is the number of the group to remove the selector from
  2143. * @param label is the label for the selector
  2144. * @param func is the function called when the Selector is checked
  2145. * @param checked is true when Selector is checked
  2146. */
  2147. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2148. /** For a given group position of correct type add a radio button
  2149. * @param groupNb is the number of the group to remove the selector from
  2150. * @param label is the label for the selector
  2151. * @param func is the function called when the Selector is checked
  2152. * @param checked is true when Selector is checked
  2153. */
  2154. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2155. /**
  2156. * For a given slider group add a slider
  2157. * @param groupNb is the number of the group to add the slider to
  2158. * @param label is the label for the Slider
  2159. * @param func is the function called when the Slider moves
  2160. * @param unit is a string describing the units used, eg degrees or metres
  2161. * @param min is the minimum value for the Slider
  2162. * @param max is the maximum value for the Slider
  2163. * @param value is the start value for the Slider between min and max
  2164. * @param onVal is the function used to format the value displayed, eg radians to degrees
  2165. */
  2166. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  2167. }
  2168. }
  2169. declare module 'babylonjs-gui/2D/controls/scrollViewers/scrollViewer' {
  2170. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  2171. import { Control } from "babylonjs-gui/2D/controls/control";
  2172. import { Container } from "babylonjs-gui/2D/controls/container";
  2173. import { Nullable } from "babylonjs";
  2174. import { AdvancedDynamicTexture, Measure } from "2D";
  2175. /**
  2176. * Class used to hold a viewer window and sliders in a grid
  2177. */
  2178. export class ScrollViewer extends Rectangle {
  2179. /**
  2180. * Adds a new control to the current container
  2181. * @param control defines the control to add
  2182. * @returns the current container
  2183. */
  2184. addControl(control: Nullable<Control>): Container;
  2185. /**
  2186. * Removes a control from the current container
  2187. * @param control defines the control to remove
  2188. * @returns the current container
  2189. */
  2190. removeControl(control: Control): Container;
  2191. /** Gets the list of children */
  2192. readonly children: Control[];
  2193. _flagDescendantsAsMatrixDirty(): void;
  2194. /**
  2195. * Creates a new ScrollViewer
  2196. * @param name of ScrollViewer
  2197. */
  2198. constructor(name?: string);
  2199. /** Reset the scroll viewer window to initial size */
  2200. resetWindow(): void;
  2201. protected _getTypeName(): string;
  2202. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2203. protected _postMeasure(): void;
  2204. /**
  2205. * Gets or sets the mouse wheel precision
  2206. * from 0 to 1 with a default value of 0.05
  2207. * */
  2208. wheelPrecision: number;
  2209. /** Gets or sets the bar color */
  2210. barColor: string;
  2211. /** Gets or sets the size of the bar */
  2212. barSize: number;
  2213. /** Gets or sets the bar background */
  2214. barBackground: string;
  2215. _link(host: AdvancedDynamicTexture): void;
  2216. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2217. /** Releases associated resources */
  2218. dispose(): void;
  2219. }
  2220. }
  2221. declare module 'babylonjs-gui/2D/controls/textBlock' {
  2222. import { Observable } from "babylonjs";
  2223. import { Measure } from "babylonjs-gui/2D/measure";
  2224. import { Control } from "babylonjs-gui/2D/controls/control";
  2225. /**
  2226. * Enum that determines the text-wrapping mode to use.
  2227. */
  2228. export enum TextWrapping {
  2229. /**
  2230. * Clip the text when it's larger than Control.width; this is the default mode.
  2231. */
  2232. Clip = 0,
  2233. /**
  2234. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  2235. */
  2236. WordWrap = 1,
  2237. /**
  2238. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  2239. */
  2240. Ellipsis = 2
  2241. }
  2242. /**
  2243. * Class used to create text block control
  2244. */
  2245. export class TextBlock extends Control {
  2246. /**
  2247. * Defines the name of the control
  2248. */
  2249. name?: string | undefined;
  2250. /**
  2251. * An event triggered after the text is changed
  2252. */
  2253. onTextChangedObservable: Observable<TextBlock>;
  2254. /**
  2255. * An event triggered after the text was broken up into lines
  2256. */
  2257. onLinesReadyObservable: Observable<TextBlock>;
  2258. /**
  2259. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  2260. */
  2261. readonly lines: any[];
  2262. /**
  2263. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  2264. */
  2265. resizeToFit: boolean;
  2266. /**
  2267. * Gets or sets a boolean indicating if text must be wrapped
  2268. */
  2269. textWrapping: TextWrapping | boolean;
  2270. /**
  2271. * Gets or sets text to display
  2272. */
  2273. text: string;
  2274. /**
  2275. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  2276. */
  2277. textHorizontalAlignment: number;
  2278. /**
  2279. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  2280. */
  2281. textVerticalAlignment: number;
  2282. /**
  2283. * Gets or sets line spacing value
  2284. */
  2285. lineSpacing: string | number;
  2286. /**
  2287. * Gets or sets outlineWidth of the text to display
  2288. */
  2289. outlineWidth: number;
  2290. /**
  2291. * Gets or sets outlineColor of the text to display
  2292. */
  2293. outlineColor: string;
  2294. /**
  2295. * Creates a new TextBlock object
  2296. * @param name defines the name of the control
  2297. * @param text defines the text to display (emptry string by default)
  2298. */
  2299. constructor(
  2300. /**
  2301. * Defines the name of the control
  2302. */
  2303. name?: string | undefined, text?: string);
  2304. protected _getTypeName(): string;
  2305. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2306. /** @hidden */
  2307. _draw(context: CanvasRenderingContext2D): void;
  2308. protected _applyStates(context: CanvasRenderingContext2D): void;
  2309. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  2310. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  2311. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  2312. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  2313. protected _renderLines(context: CanvasRenderingContext2D): void;
  2314. /**
  2315. * Given a width constraint applied on the text block, find the expected height
  2316. * @returns expected height
  2317. */
  2318. computeExpectedHeight(): number;
  2319. dispose(): void;
  2320. }
  2321. }
  2322. declare module 'babylonjs-gui/2D/controls/virtualKeyboard' {
  2323. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2324. import { Observable, Nullable } from "babylonjs";
  2325. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  2326. /**
  2327. * Class used to store key control properties
  2328. */
  2329. export class KeyPropertySet {
  2330. /** Width */
  2331. width?: string;
  2332. /** Height */
  2333. height?: string;
  2334. /** Left padding */
  2335. paddingLeft?: string;
  2336. /** Right padding */
  2337. paddingRight?: string;
  2338. /** Top padding */
  2339. paddingTop?: string;
  2340. /** Bottom padding */
  2341. paddingBottom?: string;
  2342. /** Foreground color */
  2343. color?: string;
  2344. /** Background color */
  2345. background?: string;
  2346. }
  2347. /**
  2348. * Class used to create virtual keyboard
  2349. */
  2350. export class VirtualKeyboard extends StackPanel {
  2351. /** Observable raised when a key is pressed */
  2352. onKeyPressObservable: Observable<string>;
  2353. /** Gets or sets default key button width */
  2354. defaultButtonWidth: string;
  2355. /** Gets or sets default key button height */
  2356. defaultButtonHeight: string;
  2357. /** Gets or sets default key button left padding */
  2358. defaultButtonPaddingLeft: string;
  2359. /** Gets or sets default key button right padding */
  2360. defaultButtonPaddingRight: string;
  2361. /** Gets or sets default key button top padding */
  2362. defaultButtonPaddingTop: string;
  2363. /** Gets or sets default key button bottom padding */
  2364. defaultButtonPaddingBottom: string;
  2365. /** Gets or sets default key button foreground color */
  2366. defaultButtonColor: string;
  2367. /** Gets or sets default key button background color */
  2368. defaultButtonBackground: string;
  2369. /** Gets or sets shift button foreground color */
  2370. shiftButtonColor: string;
  2371. /** Gets or sets shift button thickness*/
  2372. selectedShiftThickness: number;
  2373. /** Gets shift key state */
  2374. shiftState: number;
  2375. protected _getTypeName(): string;
  2376. /**
  2377. * Adds a new row of keys
  2378. * @param keys defines the list of keys to add
  2379. * @param propertySets defines the associated property sets
  2380. */
  2381. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2382. /**
  2383. * Set the shift key to a specific state
  2384. * @param shiftState defines the new shift state
  2385. */
  2386. applyShiftState(shiftState: number): void;
  2387. /** Gets the input text control currently attached to the keyboard */
  2388. readonly connectedInputText: Nullable<InputText>;
  2389. /**
  2390. * Connects the keyboard with an input text control
  2391. *
  2392. * @param input defines the target control
  2393. */
  2394. connect(input: InputText): void;
  2395. /**
  2396. * Disconnects the keyboard from connected InputText controls
  2397. *
  2398. * @param input optionally defines a target control, otherwise all are disconnected
  2399. */
  2400. disconnect(input?: InputText): void;
  2401. /**
  2402. * Release all resources
  2403. */
  2404. dispose(): void;
  2405. /**
  2406. * Creates a new keyboard using a default layout
  2407. *
  2408. * @param name defines control name
  2409. * @returns a new VirtualKeyboard
  2410. */
  2411. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2412. }
  2413. }
  2414. declare module 'babylonjs-gui/2D/controls/rectangle' {
  2415. import { Container } from "babylonjs-gui/2D/controls/container";
  2416. import { Measure } from "babylonjs-gui/2D/measure";
  2417. /** Class used to create rectangle container */
  2418. export class Rectangle extends Container {
  2419. name?: string | undefined;
  2420. /** Gets or sets border thickness */
  2421. thickness: number;
  2422. /** Gets or sets the corner radius angle */
  2423. cornerRadius: number;
  2424. /**
  2425. * Creates a new Rectangle
  2426. * @param name defines the control name
  2427. */
  2428. constructor(name?: string | undefined);
  2429. protected _getTypeName(): string;
  2430. protected _localDraw(context: CanvasRenderingContext2D): void;
  2431. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2432. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2433. }
  2434. }
  2435. declare module 'babylonjs-gui/2D/controls/displayGrid' {
  2436. import { Control } from "babylonjs-gui/2D/controls";
  2437. /** Class used to render a grid */
  2438. export class DisplayGrid extends Control {
  2439. name?: string | undefined;
  2440. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  2441. displayMinorLines: boolean;
  2442. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  2443. displayMajorLines: boolean;
  2444. /** Gets or sets background color (Black by default) */
  2445. background: string;
  2446. /** Gets or sets the width of each cell (20 by default) */
  2447. cellWidth: number;
  2448. /** Gets or sets the height of each cell (20 by default) */
  2449. cellHeight: number;
  2450. /** Gets or sets the tickness of minor lines (1 by default) */
  2451. minorLineTickness: number;
  2452. /** Gets or sets the color of minor lines (DarkGray by default) */
  2453. minorLineColor: string;
  2454. /** Gets or sets the tickness of major lines (2 by default) */
  2455. majorLineTickness: number;
  2456. /** Gets or sets the color of major lines (White by default) */
  2457. majorLineColor: string;
  2458. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  2459. majorLineFrequency: number;
  2460. /**
  2461. * Creates a new GridDisplayRectangle
  2462. * @param name defines the control name
  2463. */
  2464. constructor(name?: string | undefined);
  2465. _draw(context: CanvasRenderingContext2D): void;
  2466. protected _getTypeName(): string;
  2467. }
  2468. }
  2469. declare module 'babylonjs-gui/2D/controls/sliders/baseSlider' {
  2470. import { Control } from "babylonjs-gui/2D/controls/control";
  2471. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  2472. import { Observable, Vector2 } from "babylonjs";
  2473. /**
  2474. * Class used to create slider controls
  2475. */
  2476. export class BaseSlider extends Control {
  2477. name?: string | undefined;
  2478. protected _thumbWidth: ValueAndUnit;
  2479. protected _barOffset: ValueAndUnit;
  2480. protected _displayThumb: boolean;
  2481. protected _effectiveBarOffset: number;
  2482. protected _renderLeft: number;
  2483. protected _renderTop: number;
  2484. protected _renderWidth: number;
  2485. protected _renderHeight: number;
  2486. protected _backgroundBoxLength: number;
  2487. protected _backgroundBoxThickness: number;
  2488. protected _effectiveThumbThickness: number;
  2489. /** Observable raised when the sldier value changes */
  2490. onValueChangedObservable: Observable<number>;
  2491. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2492. displayThumb: boolean;
  2493. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2494. barOffset: string | number;
  2495. /** Gets main bar offset in pixels*/
  2496. readonly barOffsetInPixels: number;
  2497. /** Gets or sets thumb width */
  2498. thumbWidth: string | number;
  2499. /** Gets thumb width in pixels */
  2500. readonly thumbWidthInPixels: number;
  2501. /** Gets or sets minimum value */
  2502. minimum: number;
  2503. /** Gets or sets maximum value */
  2504. maximum: number;
  2505. /** Gets or sets current value */
  2506. value: number;
  2507. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2508. isVertical: boolean;
  2509. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2510. isThumbClamped: boolean;
  2511. /**
  2512. * Creates a new BaseSlider
  2513. * @param name defines the control name
  2514. */
  2515. constructor(name?: string | undefined);
  2516. protected _getTypeName(): string;
  2517. protected _getThumbPosition(): number;
  2518. protected _getThumbThickness(type: string): number;
  2519. protected _prepareRenderingData(type: string): void;
  2520. /** @hidden */
  2521. protected _updateValueFromPointer(x: number, y: number): void;
  2522. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2523. _onPointerMove(target: Control, coordinates: Vector2): void;
  2524. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2525. }
  2526. }
  2527. declare module 'babylonjs-gui/2D/controls/sliders/slider' {
  2528. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  2529. /**
  2530. * Class used to create slider controls
  2531. */
  2532. export class Slider extends BaseSlider {
  2533. name?: string | undefined;
  2534. protected _displayValueBar: boolean;
  2535. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2536. displayValueBar: boolean;
  2537. /** Gets or sets border color */
  2538. borderColor: string;
  2539. /** Gets or sets background color */
  2540. background: string;
  2541. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2542. isThumbCircle: boolean;
  2543. /**
  2544. * Creates a new Slider
  2545. * @param name defines the control name
  2546. */
  2547. constructor(name?: string | undefined);
  2548. protected _getTypeName(): string;
  2549. _draw(context: CanvasRenderingContext2D): void;
  2550. }
  2551. }
  2552. declare module 'babylonjs-gui/2D/controls/sliders/imageBasedSlider' {
  2553. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  2554. import { Image } from "babylonjs-gui/2D/controls/image";
  2555. /**
  2556. * Class used to create slider controls based on images
  2557. */
  2558. export class ImageBasedSlider extends BaseSlider {
  2559. name?: string | undefined;
  2560. displayThumb: boolean;
  2561. /**
  2562. * Gets or sets the image used to render the background
  2563. */
  2564. backgroundImage: Image;
  2565. /**
  2566. * Gets or sets the image used to render the value bar
  2567. */
  2568. valueBarImage: Image;
  2569. /**
  2570. * Gets or sets the image used to render the thumb
  2571. */
  2572. thumbImage: Image;
  2573. /**
  2574. * Creates a new ImageBasedSlider
  2575. * @param name defines the control name
  2576. */
  2577. constructor(name?: string | undefined);
  2578. protected _getTypeName(): string;
  2579. _draw(context: CanvasRenderingContext2D): void;
  2580. }
  2581. }
  2582. declare module 'babylonjs-gui/2D/controls/statics' {
  2583. /**
  2584. * Forcing an export so that this code will execute
  2585. * @hidden
  2586. */
  2587. const name = "Statics";
  2588. export { name };
  2589. }
  2590. declare module 'babylonjs-gui/3D/controls/abstractButton3D' {
  2591. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2592. import { TransformNode, Scene } from "babylonjs";
  2593. /**
  2594. * Class used as a root to all buttons
  2595. */
  2596. export class AbstractButton3D extends Control3D {
  2597. /**
  2598. * Creates a new button
  2599. * @param name defines the control name
  2600. */
  2601. constructor(name?: string);
  2602. protected _getTypeName(): string;
  2603. protected _createNode(scene: Scene): TransformNode;
  2604. }
  2605. }
  2606. declare module 'babylonjs-gui/3D/controls/button3D' {
  2607. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  2608. import { Material, int, Scene, TransformNode, AbstractMesh } from "babylonjs";
  2609. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2610. import { Control } from "babylonjs-gui/2D/controls/control";
  2611. /**
  2612. * Class used to create a button in 3D
  2613. */
  2614. export class Button3D extends AbstractButton3D {
  2615. /** @hidden */
  2616. protected _currentMaterial: Material;
  2617. /**
  2618. * Gets or sets the texture resolution used to render content (512 by default)
  2619. */
  2620. contentResolution: int;
  2621. /**
  2622. * Gets or sets the texture scale ratio used to render content (2 by default)
  2623. */
  2624. contentScaleRatio: number;
  2625. protected _disposeFacadeTexture(): void;
  2626. protected _resetContent(): void;
  2627. /**
  2628. * Creates a new button
  2629. * @param name defines the control name
  2630. */
  2631. constructor(name?: string);
  2632. /**
  2633. * Gets or sets the GUI 2D content used to display the button's facade
  2634. */
  2635. content: Control;
  2636. /**
  2637. * Apply the facade texture (created from the content property).
  2638. * This function can be overloaded by child classes
  2639. * @param facadeTexture defines the AdvancedDynamicTexture to use
  2640. */
  2641. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2642. protected _getTypeName(): string;
  2643. protected _createNode(scene: Scene): TransformNode;
  2644. protected _affectMaterial(mesh: AbstractMesh): void;
  2645. /**
  2646. * Releases all associated resources
  2647. */
  2648. dispose(): void;
  2649. }
  2650. }
  2651. declare module 'babylonjs-gui/3D/controls/container3D' {
  2652. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2653. import { Scene, Nullable, TransformNode } from "babylonjs";
  2654. /**
  2655. * Class used to create containers for controls
  2656. */
  2657. export class Container3D extends Control3D {
  2658. /**
  2659. * Gets the list of child controls
  2660. */
  2661. protected _children: Control3D[];
  2662. /**
  2663. * Gets the list of child controls
  2664. */
  2665. readonly children: Array<Control3D>;
  2666. /**
  2667. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2668. * This is helpful to optimize layout operation when adding multiple children in a row
  2669. */
  2670. blockLayout: boolean;
  2671. /**
  2672. * Creates a new container
  2673. * @param name defines the container name
  2674. */
  2675. constructor(name?: string);
  2676. /**
  2677. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2678. * @returns the current container
  2679. */
  2680. updateLayout(): Container3D;
  2681. /**
  2682. * Gets a boolean indicating if the given control is in the children of this control
  2683. * @param control defines the control to check
  2684. * @returns true if the control is in the child list
  2685. */
  2686. containsControl(control: Control3D): boolean;
  2687. /**
  2688. * Adds a control to the children of this control
  2689. * @param control defines the control to add
  2690. * @returns the current container
  2691. */
  2692. addControl(control: Control3D): Container3D;
  2693. /**
  2694. * This function will be called everytime a new control is added
  2695. */
  2696. protected _arrangeChildren(): void;
  2697. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2698. /**
  2699. * Removes a control from the children of this control
  2700. * @param control defines the control to remove
  2701. * @returns the current container
  2702. */
  2703. removeControl(control: Control3D): Container3D;
  2704. protected _getTypeName(): string;
  2705. /**
  2706. * Releases all associated resources
  2707. */
  2708. dispose(): void;
  2709. /** Control rotation will remain unchanged */
  2710. static readonly UNSET_ORIENTATION: number;
  2711. /** Control will rotate to make it look at sphere central axis */
  2712. static readonly FACEORIGIN_ORIENTATION: number;
  2713. /** Control will rotate to make it look back at sphere central axis */
  2714. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2715. /** Control will rotate to look at z axis (0, 0, 1) */
  2716. static readonly FACEFORWARD_ORIENTATION: number;
  2717. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2718. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2719. }
  2720. }
  2721. declare module 'babylonjs-gui/3D/controls/control3D' {
  2722. import { IDisposable, IBehaviorAware, Nullable, TransformNode, Vector3, Observable, Behavior, AbstractMesh, Scene } from "babylonjs";
  2723. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  2724. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  2725. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2726. /**
  2727. * Class used as base class for controls
  2728. */
  2729. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  2730. /** Defines the control name */
  2731. name?: string | undefined;
  2732. /** @hidden */
  2733. _host: GUI3DManager;
  2734. /** Gets or sets the control position in world space */
  2735. position: Vector3;
  2736. /** Gets or sets the control scaling in world space */
  2737. scaling: Vector3;
  2738. /** Callback used to start pointer enter animation */
  2739. pointerEnterAnimation: () => void;
  2740. /** Callback used to start pointer out animation */
  2741. pointerOutAnimation: () => void;
  2742. /** Callback used to start pointer down animation */
  2743. pointerDownAnimation: () => void;
  2744. /** Callback used to start pointer up animation */
  2745. pointerUpAnimation: () => void;
  2746. /**
  2747. * An event triggered when the pointer move over the control
  2748. */
  2749. onPointerMoveObservable: Observable<Vector3>;
  2750. /**
  2751. * An event triggered when the pointer move out of the control
  2752. */
  2753. onPointerOutObservable: Observable<Control3D>;
  2754. /**
  2755. * An event triggered when the pointer taps the control
  2756. */
  2757. onPointerDownObservable: Observable<Vector3WithInfo>;
  2758. /**
  2759. * An event triggered when pointer is up
  2760. */
  2761. onPointerUpObservable: Observable<Vector3WithInfo>;
  2762. /**
  2763. * An event triggered when a control is clicked on (with a mouse)
  2764. */
  2765. onPointerClickObservable: Observable<Vector3WithInfo>;
  2766. /**
  2767. * An event triggered when pointer enters the control
  2768. */
  2769. onPointerEnterObservable: Observable<Control3D>;
  2770. /**
  2771. * Gets or sets the parent container
  2772. */
  2773. parent: Nullable<Container3D>;
  2774. /**
  2775. * Gets the list of attached behaviors
  2776. * @see http://doc.babylonjs.com/features/behaviour
  2777. */
  2778. readonly behaviors: Behavior<Control3D>[];
  2779. /**
  2780. * Attach a behavior to the control
  2781. * @see http://doc.babylonjs.com/features/behaviour
  2782. * @param behavior defines the behavior to attach
  2783. * @returns the current control
  2784. */
  2785. addBehavior(behavior: Behavior<Control3D>): Control3D;
  2786. /**
  2787. * Remove an attached behavior
  2788. * @see http://doc.babylonjs.com/features/behaviour
  2789. * @param behavior defines the behavior to attach
  2790. * @returns the current control
  2791. */
  2792. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  2793. /**
  2794. * Gets an attached behavior by name
  2795. * @param name defines the name of the behavior to look for
  2796. * @see http://doc.babylonjs.com/features/behaviour
  2797. * @returns null if behavior was not found else the requested behavior
  2798. */
  2799. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  2800. /** Gets or sets a boolean indicating if the control is visible */
  2801. isVisible: boolean;
  2802. /**
  2803. * Creates a new control
  2804. * @param name defines the control name
  2805. */
  2806. constructor(
  2807. /** Defines the control name */
  2808. name?: string | undefined);
  2809. /**
  2810. * Gets a string representing the class name
  2811. */
  2812. readonly typeName: string;
  2813. /**
  2814. * Get the current class name of the control.
  2815. * @returns current class name
  2816. */
  2817. getClassName(): string;
  2818. protected _getTypeName(): string;
  2819. /**
  2820. * Gets the transform node used by this control
  2821. */
  2822. readonly node: Nullable<TransformNode>;
  2823. /**
  2824. * Gets the mesh used to render this control
  2825. */
  2826. readonly mesh: Nullable<AbstractMesh>;
  2827. /**
  2828. * Link the control as child of the given node
  2829. * @param node defines the node to link to. Use null to unlink the control
  2830. * @returns the current control
  2831. */
  2832. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  2833. /** @hidden **/
  2834. _prepareNode(scene: Scene): void;
  2835. /**
  2836. * Node creation.
  2837. * Can be overriden by children
  2838. * @param scene defines the scene where the node must be attached
  2839. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  2840. */
  2841. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2842. /**
  2843. * Affect a material to the given mesh
  2844. * @param mesh defines the mesh which will represent the control
  2845. */
  2846. protected _affectMaterial(mesh: AbstractMesh): void;
  2847. /** @hidden */
  2848. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  2849. /** @hidden */
  2850. _onPointerEnter(target: Control3D): boolean;
  2851. /** @hidden */
  2852. _onPointerOut(target: Control3D): void;
  2853. /** @hidden */
  2854. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  2855. /** @hidden */
  2856. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2857. /** @hidden */
  2858. forcePointerUp(pointerId?: Nullable<number>): void;
  2859. /** @hidden */
  2860. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  2861. /** @hidden */
  2862. _disposeNode(): void;
  2863. /**
  2864. * Releases all associated resources
  2865. */
  2866. dispose(): void;
  2867. }
  2868. }
  2869. declare module 'babylonjs-gui/3D/controls/cylinderPanel' {
  2870. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2871. import { float, Vector3 } from "babylonjs";
  2872. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2873. /**
  2874. * Class used to create a container panel deployed on the surface of a cylinder
  2875. */
  2876. export class CylinderPanel extends VolumeBasedPanel {
  2877. /**
  2878. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2879. */
  2880. radius: float;
  2881. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2882. }
  2883. }
  2884. declare module 'babylonjs-gui/3D/controls/holographicButton' {
  2885. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2886. import { Mesh, StandardMaterial, Nullable, Scene, TransformNode } from "babylonjs";
  2887. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  2888. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2889. /**
  2890. * Class used to create a holographic button in 3D
  2891. */
  2892. export class HolographicButton extends Button3D {
  2893. /**
  2894. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  2895. */
  2896. tooltipText: Nullable<string>;
  2897. /**
  2898. * Gets or sets text for the button
  2899. */
  2900. text: string;
  2901. /**
  2902. * Gets or sets the image url for the button
  2903. */
  2904. imageUrl: string;
  2905. /**
  2906. * Gets the back material used by this button
  2907. */
  2908. readonly backMaterial: FluentMaterial;
  2909. /**
  2910. * Gets the front material used by this button
  2911. */
  2912. readonly frontMaterial: FluentMaterial;
  2913. /**
  2914. * Gets the plate material used by this button
  2915. */
  2916. readonly plateMaterial: StandardMaterial;
  2917. /**
  2918. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2919. */
  2920. readonly shareMaterials: boolean;
  2921. /**
  2922. * Creates a new button
  2923. * @param name defines the control name
  2924. */
  2925. constructor(name?: string, shareMaterials?: boolean);
  2926. protected _getTypeName(): string;
  2927. protected _createNode(scene: Scene): TransformNode;
  2928. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2929. protected _affectMaterial(mesh: Mesh): void;
  2930. /**
  2931. * Releases all associated resources
  2932. */
  2933. dispose(): void;
  2934. }
  2935. }
  2936. declare module 'babylonjs-gui/3D/controls/meshButton3D' {
  2937. import { Scene, TransformNode, AbstractMesh, Mesh } from "babylonjs";
  2938. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2939. /**
  2940. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2941. */
  2942. export class MeshButton3D extends Button3D {
  2943. /** @hidden */
  2944. protected _currentMesh: Mesh;
  2945. /**
  2946. * Creates a new 3D button based on a mesh
  2947. * @param mesh mesh to become a 3D button
  2948. * @param name defines the control name
  2949. */
  2950. constructor(mesh: Mesh, name?: string);
  2951. protected _getTypeName(): string;
  2952. protected _createNode(scene: Scene): TransformNode;
  2953. protected _affectMaterial(mesh: AbstractMesh): void;
  2954. }
  2955. }
  2956. declare module 'babylonjs-gui/3D/controls/planePanel' {
  2957. import { Vector3 } from "babylonjs";
  2958. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2959. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2960. /**
  2961. * Class used to create a container panel deployed on the surface of a plane
  2962. */
  2963. export class PlanePanel extends VolumeBasedPanel {
  2964. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2965. }
  2966. }
  2967. declare module 'babylonjs-gui/3D/controls/scatterPanel' {
  2968. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2969. import { float, Vector3 } from "babylonjs";
  2970. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2971. /**
  2972. * Class used to create a container panel where items get randomized planar mapping
  2973. */
  2974. export class ScatterPanel extends VolumeBasedPanel {
  2975. /**
  2976. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2977. */
  2978. iteration: float;
  2979. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2980. protected _finalProcessing(): void;
  2981. }
  2982. }
  2983. declare module 'babylonjs-gui/3D/controls/spherePanel' {
  2984. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2985. import { float, Vector3 } from "babylonjs";
  2986. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2987. /**
  2988. * Class used to create a container panel deployed on the surface of a sphere
  2989. */
  2990. export class SpherePanel extends VolumeBasedPanel {
  2991. /**
  2992. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2993. */
  2994. radius: float;
  2995. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2996. }
  2997. }
  2998. declare module 'babylonjs-gui/3D/controls/stackPanel3D' {
  2999. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3000. /**
  3001. * Class used to create a stack panel in 3D on XY plane
  3002. */
  3003. export class StackPanel3D extends Container3D {
  3004. /**
  3005. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  3006. */
  3007. isVertical: boolean;
  3008. /**
  3009. * Gets or sets the distance between elements
  3010. */
  3011. margin: number;
  3012. /**
  3013. * Creates new StackPanel
  3014. * @param isVertical
  3015. */
  3016. constructor(isVertical?: boolean);
  3017. protected _arrangeChildren(): void;
  3018. }
  3019. }
  3020. declare module 'babylonjs-gui/3D/controls/volumeBasedPanel' {
  3021. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  3022. import { int, Vector3 } from "babylonjs";
  3023. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  3024. /**
  3025. * Abstract class used to create a container panel deployed on the surface of a volume
  3026. */
  3027. export abstract class VolumeBasedPanel extends Container3D {
  3028. protected _cellWidth: number;
  3029. protected _cellHeight: number;
  3030. /**
  3031. * Gets or sets the distance between elements
  3032. */
  3033. margin: number;
  3034. /**
  3035. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  3036. * | Value | Type | Description |
  3037. * | ----- | ----------------------------------- | ----------- |
  3038. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  3039. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  3040. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  3041. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  3042. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  3043. */
  3044. orientation: number;
  3045. /**
  3046. * Gets or sets the number of columns requested (10 by default).
  3047. * The panel will automatically compute the number of rows based on number of child controls.
  3048. */
  3049. columns: int;
  3050. /**
  3051. * Gets or sets a the number of rows requested.
  3052. * The panel will automatically compute the number of columns based on number of child controls.
  3053. */
  3054. rows: int;
  3055. /**
  3056. * Creates new VolumeBasedPanel
  3057. */
  3058. constructor();
  3059. protected _arrangeChildren(): void;
  3060. /** Child classes must implement this function to provide correct control positioning */
  3061. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  3062. /** Child classes can implement this function to provide additional processing */
  3063. protected _finalProcessing(): void;
  3064. }
  3065. }
  3066. declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
  3067. import { MaterialDefines, PushMaterial, Color3, Color4, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, Matrix, Mesh } from "babylonjs";
  3068. /** @hidden */
  3069. export class FluentMaterialDefines extends MaterialDefines {
  3070. INNERGLOW: boolean;
  3071. BORDER: boolean;
  3072. HOVERLIGHT: boolean;
  3073. TEXTURE: boolean;
  3074. constructor();
  3075. }
  3076. /**
  3077. * Class used to render controls with fluent desgin
  3078. */
  3079. export class FluentMaterial extends PushMaterial {
  3080. /**
  3081. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  3082. */
  3083. innerGlowColorIntensity: number;
  3084. /**
  3085. * Gets or sets the inner glow color (white by default)
  3086. */
  3087. innerGlowColor: Color3;
  3088. /**
  3089. * Gets or sets alpha value (default is 1.0)
  3090. */
  3091. alpha: number;
  3092. /**
  3093. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  3094. */
  3095. albedoColor: Color3;
  3096. /**
  3097. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  3098. */
  3099. renderBorders: boolean;
  3100. /**
  3101. * Gets or sets border width (default is 0.5)
  3102. */
  3103. borderWidth: number;
  3104. /**
  3105. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  3106. */
  3107. edgeSmoothingValue: number;
  3108. /**
  3109. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  3110. */
  3111. borderMinValue: number;
  3112. /**
  3113. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  3114. */
  3115. renderHoverLight: boolean;
  3116. /**
  3117. * Gets or sets the radius used to render the hover light (default is 1.0)
  3118. */
  3119. hoverRadius: number;
  3120. /**
  3121. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  3122. */
  3123. hoverColor: Color4;
  3124. /**
  3125. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  3126. */
  3127. hoverPosition: Vector3;
  3128. /** Gets or sets the texture to use for albedo color */
  3129. albedoTexture: Nullable<BaseTexture>;
  3130. /**
  3131. * Creates a new Fluent material
  3132. * @param name defines the name of the material
  3133. * @param scene defines the hosting scene
  3134. */
  3135. constructor(name: string, scene: Scene);
  3136. needAlphaBlending(): boolean;
  3137. needAlphaTesting(): boolean;
  3138. getAlphaTestTexture(): Nullable<BaseTexture>;
  3139. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  3140. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  3141. getActiveTextures(): BaseTexture[];
  3142. hasTexture(texture: BaseTexture): boolean;
  3143. dispose(forceDisposeEffect?: boolean): void;
  3144. clone(name: string): FluentMaterial;
  3145. serialize(): any;
  3146. getClassName(): string;
  3147. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  3148. }
  3149. }
  3150. /*Babylon.js GUI*/
  3151. // Dependencies for this module:
  3152. // ../../../../Tools/Gulp/babylonjs
  3153. // ../../../../Tools/Gulp/2D
  3154. declare module BABYLON.GUI {
  3155. }
  3156. declare module BABYLON.GUI {
  3157. }
  3158. declare module BABYLON.GUI {
  3159. }
  3160. declare module BABYLON.GUI {
  3161. }
  3162. declare module BABYLON.GUI {
  3163. /**
  3164. * Interface used to define a control that can receive focus
  3165. */
  3166. export interface IFocusableControl {
  3167. /**
  3168. * Function called when the control receives the focus
  3169. */
  3170. onFocus(): void;
  3171. /**
  3172. * Function called when the control loses the focus
  3173. */
  3174. onBlur(): void;
  3175. /**
  3176. * Function called to let the control handle keyboard events
  3177. * @param evt defines the current keyboard event
  3178. */
  3179. processKeyboard(evt: KeyboardEvent): void;
  3180. /**
  3181. * Function called to get the list of controls that should not steal the focus from this control
  3182. * @returns an array of controls
  3183. */
  3184. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  3185. }
  3186. /**
  3187. * Class used to create texture to support 2D GUI elements
  3188. * @see http://doc.babylonjs.com/how_to/gui
  3189. */
  3190. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  3191. /** @hidden */
  3192. _rootContainer: Container;
  3193. /** @hidden */
  3194. _lastPickedControl: Control;
  3195. /** @hidden */
  3196. _lastControlOver: {
  3197. [pointerId: number]: Control;
  3198. };
  3199. /** @hidden */
  3200. _lastControlDown: {
  3201. [pointerId: number]: Control;
  3202. };
  3203. /** @hidden */
  3204. _capturingControl: {
  3205. [pointerId: number]: Control;
  3206. };
  3207. /** @hidden */
  3208. _shouldBlockPointer: boolean;
  3209. /** @hidden */
  3210. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  3211. /** @hidden */
  3212. _linkedControls: Control[];
  3213. /**
  3214. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  3215. */
  3216. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  3217. /**
  3218. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  3219. */
  3220. onControlPickedObservable: BABYLON.Observable<Control>;
  3221. /**
  3222. * Gets or sets a boolean defining if alpha is stored as premultiplied
  3223. */
  3224. premulAlpha: boolean;
  3225. /**
  3226. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  3227. * Useful when you want more antialiasing
  3228. */
  3229. renderScale: number;
  3230. /** Gets or sets the background color */
  3231. background: string;
  3232. /**
  3233. * Gets or sets the ideal width used to design controls.
  3234. * The GUI will then rescale everything accordingly
  3235. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3236. */
  3237. idealWidth: number;
  3238. /**
  3239. * Gets or sets the ideal height used to design controls.
  3240. * The GUI will then rescale everything accordingly
  3241. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3242. */
  3243. idealHeight: number;
  3244. /**
  3245. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  3246. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3247. */
  3248. useSmallestIdeal: boolean;
  3249. /**
  3250. * Gets or sets a boolean indicating if adaptive scaling must be used
  3251. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3252. */
  3253. renderAtIdealSize: boolean;
  3254. /**
  3255. * Gets the underlying layer used to render the texture when in fullscreen mode
  3256. */
  3257. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  3258. /**
  3259. * Gets the root container control
  3260. */
  3261. readonly rootContainer: Container;
  3262. /**
  3263. * Returns an array containing the root container.
  3264. * This is mostly used to let the Inspector introspects the ADT
  3265. * @returns an array containing the rootContainer
  3266. */
  3267. getChildren(): Array<Container>;
  3268. /**
  3269. * Will return all controls that are inside this texture
  3270. * @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
  3271. * @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
  3272. * @return all child controls
  3273. */
  3274. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  3275. /**
  3276. * Gets or sets the current focused control
  3277. */
  3278. focusedControl: BABYLON.Nullable<IFocusableControl>;
  3279. /**
  3280. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  3281. */
  3282. isForeground: boolean;
  3283. /**
  3284. * Gets or set information about clipboardData
  3285. */
  3286. clipboardData: string;
  3287. /**
  3288. * Creates a new AdvancedDynamicTexture
  3289. * @param name defines the name of the texture
  3290. * @param width defines the width of the texture
  3291. * @param height defines the height of the texture
  3292. * @param scene defines the hosting scene
  3293. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  3294. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  3295. */
  3296. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  3297. /**
  3298. * Get the current class name of the texture useful for serialization or dynamic coding.
  3299. * @returns "AdvancedDynamicTexture"
  3300. */
  3301. getClassName(): string;
  3302. /**
  3303. * Function used to execute a function on all controls
  3304. * @param func defines the function to execute
  3305. * @param container defines the container where controls belong. If null the root container will be used
  3306. */
  3307. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  3308. /**
  3309. * Marks the texture as dirty forcing a complete update
  3310. */
  3311. markAsDirty(): void;
  3312. /**
  3313. * Helper function used to create a new style
  3314. * @returns a new style
  3315. * @see http://doc.babylonjs.com/how_to/gui#styles
  3316. */
  3317. createStyle(): Style;
  3318. /**
  3319. * Adds a new control to the root container
  3320. * @param control defines the control to add
  3321. * @returns the current texture
  3322. */
  3323. addControl(control: Control): AdvancedDynamicTexture;
  3324. /**
  3325. * Removes a control from the root container
  3326. * @param control defines the control to remove
  3327. * @returns the current texture
  3328. */
  3329. removeControl(control: Control): AdvancedDynamicTexture;
  3330. /**
  3331. * Release all resources
  3332. */
  3333. dispose(): void;
  3334. /** @hidden */
  3335. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  3336. /**
  3337. * Get screen coordinates for a vector3
  3338. * @param position defines the position to project
  3339. * @param worldMatrix defines the world matrix to use
  3340. * @returns the projected position
  3341. */
  3342. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  3343. /** @hidden */
  3344. _changeCursor(cursor: string): void;
  3345. /** @hidden */
  3346. _registerLastControlDown(control: Control, pointerId: number): void;
  3347. /** @hidden */
  3348. _cleanControlAfterRemovalFromList(list: {
  3349. [pointerId: number]: Control;
  3350. }, control: Control): void;
  3351. /** @hidden */
  3352. _cleanControlAfterRemoval(control: Control): void;
  3353. /** Attach to all scene events required to support pointer events */
  3354. attach(): void;
  3355. /**
  3356. * Register the clipboard Events onto the canvas
  3357. */
  3358. registerClipboardEvents(): void;
  3359. /**
  3360. * Unregister the clipboard Events from the canvas
  3361. */
  3362. unRegisterClipboardEvents(): void;
  3363. /**
  3364. * Connect the texture to a hosting mesh to enable interactions
  3365. * @param mesh defines the mesh to attach to
  3366. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  3367. */
  3368. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  3369. /**
  3370. * Move the focus to a specific control
  3371. * @param control defines the control which will receive the focus
  3372. */
  3373. moveFocusToControl(control: IFocusableControl): void;
  3374. /**
  3375. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  3376. * @param mesh defines the mesh which will receive the texture
  3377. * @param width defines the texture width (1024 by default)
  3378. * @param height defines the texture height (1024 by default)
  3379. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  3380. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  3381. * @returns a new AdvancedDynamicTexture
  3382. */
  3383. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  3384. /**
  3385. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  3386. * In this mode the texture will rely on a layer for its rendering.
  3387. * This allows it to be treated like any other layer.
  3388. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  3389. * LayerMask is set through advancedTexture.layer.layerMask
  3390. * @param name defines name for the texture
  3391. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  3392. * @param scene defines the hsoting scene
  3393. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  3394. * @returns a new AdvancedDynamicTexture
  3395. */
  3396. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  3397. }
  3398. }
  3399. declare module BABYLON.GUI {
  3400. /**
  3401. * Class used to transport BABYLON.Vector2 information for pointer events
  3402. */
  3403. export class Vector2WithInfo extends BABYLON.Vector2 {
  3404. /** defines the current mouse button index */
  3405. buttonIndex: number;
  3406. /**
  3407. * Creates a new Vector2WithInfo
  3408. * @param source defines the vector2 data to transport
  3409. * @param buttonIndex defines the current mouse button index
  3410. */
  3411. constructor(source: BABYLON.Vector2,
  3412. /** defines the current mouse button index */
  3413. buttonIndex?: number);
  3414. }
  3415. /** Class used to provide 2D matrix features */
  3416. export class Matrix2D {
  3417. /** Gets the internal array of 6 floats used to store matrix data */
  3418. m: Float32Array;
  3419. /**
  3420. * Creates a new matrix
  3421. * @param m00 defines value for (0, 0)
  3422. * @param m01 defines value for (0, 1)
  3423. * @param m10 defines value for (1, 0)
  3424. * @param m11 defines value for (1, 1)
  3425. * @param m20 defines value for (2, 0)
  3426. * @param m21 defines value for (2, 1)
  3427. */
  3428. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  3429. /**
  3430. * Fills the matrix from direct values
  3431. * @param m00 defines value for (0, 0)
  3432. * @param m01 defines value for (0, 1)
  3433. * @param m10 defines value for (1, 0)
  3434. * @param m11 defines value for (1, 1)
  3435. * @param m20 defines value for (2, 0)
  3436. * @param m21 defines value for (2, 1)
  3437. * @returns the current modified matrix
  3438. */
  3439. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  3440. /**
  3441. * Gets matrix determinant
  3442. * @returns the determinant
  3443. */
  3444. determinant(): number;
  3445. /**
  3446. * Inverses the matrix and stores it in a target matrix
  3447. * @param result defines the target matrix
  3448. * @returns the current matrix
  3449. */
  3450. invertToRef(result: Matrix2D): Matrix2D;
  3451. /**
  3452. * Multiplies the current matrix with another one
  3453. * @param other defines the second operand
  3454. * @param result defines the target matrix
  3455. * @returns the current matrix
  3456. */
  3457. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  3458. /**
  3459. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  3460. * @param x defines the x coordinate to transform
  3461. * @param y defines the x coordinate to transform
  3462. * @param result defines the target vector2
  3463. * @returns the current matrix
  3464. */
  3465. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  3466. /**
  3467. * Creates an identity matrix
  3468. * @returns a new matrix
  3469. */
  3470. static Identity(): Matrix2D;
  3471. /**
  3472. * Creates a translation matrix and stores it in a target matrix
  3473. * @param x defines the x coordinate of the translation
  3474. * @param y defines the y coordinate of the translation
  3475. * @param result defines the target matrix
  3476. */
  3477. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  3478. /**
  3479. * Creates a scaling matrix and stores it in a target matrix
  3480. * @param x defines the x coordinate of the scaling
  3481. * @param y defines the y coordinate of the scaling
  3482. * @param result defines the target matrix
  3483. */
  3484. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  3485. /**
  3486. * Creates a rotation matrix and stores it in a target matrix
  3487. * @param angle defines the rotation angle
  3488. * @param result defines the target matrix
  3489. */
  3490. static RotationToRef(angle: number, result: Matrix2D): void;
  3491. /**
  3492. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  3493. * @param tx defines the x coordinate of the translation
  3494. * @param ty defines the y coordinate of the translation
  3495. * @param angle defines the rotation angle
  3496. * @param scaleX defines the x coordinate of the scaling
  3497. * @param scaleY defines the y coordinate of the scaling
  3498. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  3499. * @param result defines the target matrix
  3500. */
  3501. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  3502. }
  3503. }
  3504. declare module BABYLON.GUI {
  3505. /**
  3506. * Class used to store 2D control sizes
  3507. */
  3508. export class Measure {
  3509. /** defines left coordinate */
  3510. left: number;
  3511. /** defines top coordinate */
  3512. top: number;
  3513. /** defines width dimension */
  3514. width: number;
  3515. /** defines height dimension */
  3516. height: number;
  3517. /**
  3518. * Creates a new measure
  3519. * @param left defines left coordinate
  3520. * @param top defines top coordinate
  3521. * @param width defines width dimension
  3522. * @param height defines height dimension
  3523. */
  3524. constructor(
  3525. /** defines left coordinate */
  3526. left: number,
  3527. /** defines top coordinate */
  3528. top: number,
  3529. /** defines width dimension */
  3530. width: number,
  3531. /** defines height dimension */
  3532. height: number);
  3533. /**
  3534. * Copy from another measure
  3535. * @param other defines the other measure to copy from
  3536. */
  3537. copyFrom(other: Measure): void;
  3538. /**
  3539. * Copy from a group of 4 floats
  3540. * @param left defines left coordinate
  3541. * @param top defines top coordinate
  3542. * @param width defines width dimension
  3543. * @param height defines height dimension
  3544. */
  3545. copyFromFloats(left: number, top: number, width: number, height: number): void;
  3546. /**
  3547. * Check equality between this measure and another one
  3548. * @param other defines the other measures
  3549. * @returns true if both measures are equals
  3550. */
  3551. isEqualsTo(other: Measure): boolean;
  3552. /**
  3553. * Creates an empty measure
  3554. * @returns a new measure
  3555. */
  3556. static Empty(): Measure;
  3557. }
  3558. }
  3559. declare module BABYLON.GUI {
  3560. /**
  3561. * Class used to store a point for a MultiLine object.
  3562. * The point can be pure 2D coordinates, a mesh or a control
  3563. */
  3564. export class MultiLinePoint {
  3565. /** @hidden */
  3566. _point: BABYLON.Vector2;
  3567. /**
  3568. * Creates a new MultiLinePoint
  3569. * @param multiLine defines the source MultiLine object
  3570. */
  3571. constructor(multiLine: MultiLine);
  3572. /** Gets or sets x coordinate */
  3573. x: string | number;
  3574. /** Gets or sets y coordinate */
  3575. y: string | number;
  3576. /** Gets or sets the control associated with this point */
  3577. control: BABYLON.Nullable<Control>;
  3578. /** Gets or sets the mesh associated with this point */
  3579. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3580. /** Resets links */
  3581. resetLinks(): void;
  3582. /**
  3583. * Gets a translation vector
  3584. * @returns the translation vector
  3585. */
  3586. translate(): BABYLON.Vector2;
  3587. /** Release associated resources */
  3588. dispose(): void;
  3589. }
  3590. }
  3591. declare module BABYLON.GUI {
  3592. /**
  3593. * Define a style used by control to automatically setup properties based on a template.
  3594. * Only support font related properties so far
  3595. */
  3596. export class Style implements BABYLON.IDisposable {
  3597. /** @hidden */
  3598. _host: AdvancedDynamicTexture;
  3599. /** @hidden */
  3600. _fontSize: ValueAndUnit;
  3601. /**
  3602. * BABYLON.Observable raised when the style values are changed
  3603. */
  3604. onChangedObservable: BABYLON.Observable<Style>;
  3605. /**
  3606. * Creates a new style object
  3607. * @param host defines the AdvancedDynamicTexture which hosts this style
  3608. */
  3609. constructor(host: AdvancedDynamicTexture);
  3610. /**
  3611. * Gets or sets the font size
  3612. */
  3613. fontSize: string | number;
  3614. /**
  3615. * Gets or sets the font family
  3616. */
  3617. fontFamily: string;
  3618. /**
  3619. * Gets or sets the font style
  3620. */
  3621. fontStyle: string;
  3622. /** Gets or sets font weight */
  3623. fontWeight: string;
  3624. /** Dispose all associated resources */
  3625. dispose(): void;
  3626. }
  3627. }
  3628. declare module BABYLON.GUI {
  3629. /**
  3630. * Class used to specific a value and its associated unit
  3631. */
  3632. export class ValueAndUnit {
  3633. /** defines the unit to store */
  3634. unit: number;
  3635. /** defines a boolean indicating if the value can be negative */
  3636. negativeValueAllowed: boolean;
  3637. /**
  3638. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3639. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3640. */
  3641. ignoreAdaptiveScaling: boolean;
  3642. /**
  3643. * Creates a new ValueAndUnit
  3644. * @param value defines the value to store
  3645. * @param unit defines the unit to store
  3646. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3647. */
  3648. constructor(value: number,
  3649. /** defines the unit to store */
  3650. unit?: number,
  3651. /** defines a boolean indicating if the value can be negative */
  3652. negativeValueAllowed?: boolean);
  3653. /** Gets a boolean indicating if the value is a percentage */
  3654. readonly isPercentage: boolean;
  3655. /** Gets a boolean indicating if the value is store as pixel */
  3656. readonly isPixel: boolean;
  3657. /** Gets direct internal value */
  3658. readonly internalValue: number;
  3659. /**
  3660. * Gets value as pixel
  3661. * @param host defines the root host
  3662. * @param refValue defines the reference value for percentages
  3663. * @returns the value as pixel
  3664. */
  3665. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3666. /**
  3667. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  3668. * @param value defines the value to store
  3669. * @param unit defines the unit to store
  3670. * @returns the current ValueAndUnit
  3671. */
  3672. updateInPlace(value: number, unit?: number): ValueAndUnit;
  3673. /**
  3674. * Gets the value accordingly to its unit
  3675. * @param host defines the root host
  3676. * @returns the value
  3677. */
  3678. getValue(host: AdvancedDynamicTexture): number;
  3679. /**
  3680. * Gets a string representation of the value
  3681. * @param host defines the root host
  3682. * @returns a string
  3683. */
  3684. toString(host: AdvancedDynamicTexture): string;
  3685. /**
  3686. * Store a value parsed from a string
  3687. * @param source defines the source string
  3688. * @returns true if the value was successfully parsed
  3689. */
  3690. fromString(source: string | number): boolean;
  3691. /** UNITMODE_PERCENTAGE */
  3692. static readonly UNITMODE_PERCENTAGE: number;
  3693. /** UNITMODE_PIXEL */
  3694. static readonly UNITMODE_PIXEL: number;
  3695. }
  3696. }
  3697. declare module BABYLON.GUI {
  3698. }
  3699. declare module BABYLON.GUI {
  3700. }
  3701. declare module BABYLON.GUI {
  3702. /**
  3703. * Class used to manage 3D user interface
  3704. * @see http://doc.babylonjs.com/how_to/gui3d
  3705. */
  3706. export class GUI3DManager implements BABYLON.IDisposable {
  3707. /** @hidden */
  3708. _lastPickedControl: Control3D;
  3709. /** @hidden */
  3710. _lastControlOver: {
  3711. [pointerId: number]: Control3D;
  3712. };
  3713. /** @hidden */
  3714. _lastControlDown: {
  3715. [pointerId: number]: Control3D;
  3716. };
  3717. /**
  3718. * BABYLON.Observable raised when the point picked by the pointer events changed
  3719. */
  3720. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3721. /** @hidden */
  3722. _sharedMaterials: {
  3723. [key: string]: BABYLON.Material;
  3724. };
  3725. /** Gets the hosting scene */
  3726. readonly scene: BABYLON.Scene;
  3727. /** Gets associated utility layer */
  3728. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3729. /**
  3730. * Creates a new GUI3DManager
  3731. * @param scene
  3732. */
  3733. constructor(scene?: BABYLON.Scene);
  3734. /**
  3735. * Gets the root container
  3736. */
  3737. readonly rootContainer: Container3D;
  3738. /**
  3739. * Gets a boolean indicating if the given control is in the root child list
  3740. * @param control defines the control to check
  3741. * @returns true if the control is in the root child list
  3742. */
  3743. containsControl(control: Control3D): boolean;
  3744. /**
  3745. * Adds a control to the root child list
  3746. * @param control defines the control to add
  3747. * @returns the current manager
  3748. */
  3749. addControl(control: Control3D): GUI3DManager;
  3750. /**
  3751. * Removes a control from the root child list
  3752. * @param control defines the control to remove
  3753. * @returns the current container
  3754. */
  3755. removeControl(control: Control3D): GUI3DManager;
  3756. /**
  3757. * Releases all associated resources
  3758. */
  3759. dispose(): void;
  3760. }
  3761. }
  3762. declare module BABYLON.GUI {
  3763. /**
  3764. * Class used to transport BABYLON.Vector3 information for pointer events
  3765. */
  3766. export class Vector3WithInfo extends BABYLON.Vector3 {
  3767. /** defines the current mouse button index */
  3768. buttonIndex: number;
  3769. /**
  3770. * Creates a new Vector3WithInfo
  3771. * @param source defines the vector3 data to transport
  3772. * @param buttonIndex defines the current mouse button index
  3773. */
  3774. constructor(source: BABYLON.Vector3,
  3775. /** defines the current mouse button index */
  3776. buttonIndex?: number);
  3777. }
  3778. }
  3779. declare module BABYLON.GUI {
  3780. /**
  3781. * Class used to create 2D buttons
  3782. */
  3783. export class Button extends Rectangle {
  3784. name?: string | undefined;
  3785. /**
  3786. * Function called to generate a pointer enter animation
  3787. */
  3788. pointerEnterAnimation: () => void;
  3789. /**
  3790. * Function called to generate a pointer out animation
  3791. */
  3792. pointerOutAnimation: () => void;
  3793. /**
  3794. * Function called to generate a pointer down animation
  3795. */
  3796. pointerDownAnimation: () => void;
  3797. /**
  3798. * Function called to generate a pointer up animation
  3799. */
  3800. pointerUpAnimation: () => void;
  3801. /**
  3802. * Returns the image part of the button (if any)
  3803. */
  3804. readonly image: BABYLON.Nullable<Image>;
  3805. /**
  3806. * Returns the image part of the button (if any)
  3807. */
  3808. readonly textBlock: BABYLON.Nullable<TextBlock>;
  3809. /**
  3810. * Creates a new Button
  3811. * @param name defines the name of the button
  3812. */
  3813. constructor(name?: string | undefined);
  3814. protected _getTypeName(): string;
  3815. /** @hidden */
  3816. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3817. /** @hidden */
  3818. _onPointerEnter(target: Control): boolean;
  3819. /** @hidden */
  3820. _onPointerOut(target: Control): void;
  3821. /** @hidden */
  3822. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3823. /** @hidden */
  3824. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3825. /**
  3826. * Creates a new button made with an image and a text
  3827. * @param name defines the name of the button
  3828. * @param text defines the text of the button
  3829. * @param imageUrl defines the url of the image
  3830. * @returns a new Button
  3831. */
  3832. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3833. /**
  3834. * Creates a new button made with an image
  3835. * @param name defines the name of the button
  3836. * @param imageUrl defines the url of the image
  3837. * @returns a new Button
  3838. */
  3839. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3840. /**
  3841. * Creates a new button made with a text
  3842. * @param name defines the name of the button
  3843. * @param text defines the text of the button
  3844. * @returns a new Button
  3845. */
  3846. static CreateSimpleButton(name: string, text: string): Button;
  3847. /**
  3848. * Creates a new button made with an image and a centered text
  3849. * @param name defines the name of the button
  3850. * @param text defines the text of the button
  3851. * @param imageUrl defines the url of the image
  3852. * @returns a new Button
  3853. */
  3854. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3855. }
  3856. }
  3857. declare module BABYLON.GUI {
  3858. /**
  3859. * Class used to represent a 2D checkbox
  3860. */
  3861. export class Checkbox extends Control {
  3862. name?: string | undefined;
  3863. /** Gets or sets border thickness */
  3864. thickness: number;
  3865. /**
  3866. * BABYLON.Observable raised when isChecked property changes
  3867. */
  3868. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3869. /** Gets or sets a value indicating the ratio between overall size and check size */
  3870. checkSizeRatio: number;
  3871. /** Gets or sets background color */
  3872. background: string;
  3873. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3874. isChecked: boolean;
  3875. /**
  3876. * Creates a new CheckBox
  3877. * @param name defines the control name
  3878. */
  3879. constructor(name?: string | undefined);
  3880. protected _getTypeName(): string;
  3881. /** @hidden */
  3882. _draw(context: CanvasRenderingContext2D): void;
  3883. /** @hidden */
  3884. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3885. /**
  3886. * Utility function to easily create a checkbox with a header
  3887. * @param title defines the label to use for the header
  3888. * @param onValueChanged defines the callback to call when value changes
  3889. * @returns a StackPanel containing the checkbox and a textBlock
  3890. */
  3891. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3892. }
  3893. }
  3894. declare module BABYLON.GUI {
  3895. /** Class used to create color pickers */
  3896. export class ColorPicker extends Control {
  3897. name?: string | undefined;
  3898. /**
  3899. * BABYLON.Observable raised when the value changes
  3900. */
  3901. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3902. /** Gets or sets the color of the color picker */
  3903. value: BABYLON.Color3;
  3904. /**
  3905. * Gets or sets control width
  3906. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3907. */
  3908. width: string | number;
  3909. /** Gets or sets control height */
  3910. height: string | number;
  3911. /** Gets or sets control size */
  3912. size: string | number;
  3913. /**
  3914. * Creates a new ColorPicker
  3915. * @param name defines the control name
  3916. */
  3917. constructor(name?: string | undefined);
  3918. protected _getTypeName(): string;
  3919. /** @hidden */
  3920. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3921. /** @hidden */
  3922. _draw(context: CanvasRenderingContext2D): void;
  3923. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3924. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3925. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3926. }
  3927. }
  3928. declare module BABYLON.GUI {
  3929. /**
  3930. * Root class for 2D containers
  3931. * @see http://doc.babylonjs.com/how_to/gui#containers
  3932. */
  3933. export class Container extends Control {
  3934. name?: string | undefined;
  3935. /** @hidden */
  3936. protected _children: Control[];
  3937. /** @hidden */
  3938. protected _measureForChildren: Measure;
  3939. /** @hidden */
  3940. protected _background: string;
  3941. /** @hidden */
  3942. protected _adaptWidthToChildren: boolean;
  3943. /** @hidden */
  3944. protected _adaptHeightToChildren: boolean;
  3945. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3946. adaptHeightToChildren: boolean;
  3947. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3948. adaptWidthToChildren: boolean;
  3949. /** Gets or sets background color */
  3950. background: string;
  3951. /** Gets the list of children */
  3952. readonly children: Control[];
  3953. /**
  3954. * Creates a new Container
  3955. * @param name defines the name of the container
  3956. */
  3957. constructor(name?: string | undefined);
  3958. protected _getTypeName(): string;
  3959. _flagDescendantsAsMatrixDirty(): void;
  3960. /**
  3961. * Gets a child using its name
  3962. * @param name defines the child name to look for
  3963. * @returns the child control if found
  3964. */
  3965. getChildByName(name: string): BABYLON.Nullable<Control>;
  3966. /**
  3967. * Gets a child using its type and its name
  3968. * @param name defines the child name to look for
  3969. * @param type defines the child type to look for
  3970. * @returns the child control if found
  3971. */
  3972. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3973. /**
  3974. * Search for a specific control in children
  3975. * @param control defines the control to look for
  3976. * @returns true if the control is in child list
  3977. */
  3978. containsControl(control: Control): boolean;
  3979. /**
  3980. * Adds a new control to the current container
  3981. * @param control defines the control to add
  3982. * @returns the current container
  3983. */
  3984. addControl(control: BABYLON.Nullable<Control>): Container;
  3985. /**
  3986. * Removes all controls from the current container
  3987. * @returns the current container
  3988. */
  3989. clearControls(): Container;
  3990. /**
  3991. * Removes a control from the current container
  3992. * @param control defines the control to remove
  3993. * @returns the current container
  3994. */
  3995. removeControl(control: Control): Container;
  3996. /** @hidden */
  3997. _reOrderControl(control: Control): void;
  3998. /** @hidden */
  3999. _offsetLeft(offset: number): void;
  4000. /** @hidden */
  4001. _offsetTop(offset: number): void;
  4002. /** @hidden */
  4003. _markAllAsDirty(): void;
  4004. /** @hidden */
  4005. protected _localDraw(context: CanvasRenderingContext2D): void;
  4006. /** @hidden */
  4007. _link(host: AdvancedDynamicTexture): void;
  4008. /** @hidden */
  4009. protected _beforeLayout(): void;
  4010. /** @hidden */
  4011. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  4012. protected _postMeasure(): void;
  4013. /** @hidden */
  4014. _draw(context: CanvasRenderingContext2D): void;
  4015. /** @hidden */
  4016. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  4017. /** @hidden */
  4018. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  4019. /** @hidden */
  4020. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4021. /** Releases associated resources */
  4022. dispose(): void;
  4023. }
  4024. }
  4025. declare module BABYLON.GUI {
  4026. /**
  4027. * Root class used for all 2D controls
  4028. * @see http://doc.babylonjs.com/how_to/gui#controls
  4029. */
  4030. export class Control {
  4031. /** defines the name of the control */
  4032. name?: string | undefined;
  4033. /**
  4034. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  4035. */
  4036. static AllowAlphaInheritance: boolean;
  4037. /** @hidden */
  4038. _host: AdvancedDynamicTexture;
  4039. /** Gets or sets the control parent */
  4040. parent: BABYLON.Nullable<Container>;
  4041. /** @hidden */
  4042. _currentMeasure: Measure;
  4043. /** @hidden */
  4044. _width: ValueAndUnit;
  4045. /** @hidden */
  4046. _height: ValueAndUnit;
  4047. /** @hidden */
  4048. protected _fontOffset: {
  4049. ascent: number;
  4050. height: number;
  4051. descent: number;
  4052. };
  4053. /** @hidden */
  4054. protected _horizontalAlignment: number;
  4055. /** @hidden */
  4056. protected _verticalAlignment: number;
  4057. /** @hidden */
  4058. protected _isDirty: boolean;
  4059. /** @hidden */
  4060. protected _wasDirty: boolean;
  4061. /** @hidden */
  4062. _tempParentMeasure: Measure;
  4063. /** @hidden */
  4064. protected _cachedParentMeasure: Measure;
  4065. /** @hidden */
  4066. _left: ValueAndUnit;
  4067. /** @hidden */
  4068. _top: ValueAndUnit;
  4069. /** @hidden */
  4070. protected _invertTransformMatrix: Matrix2D;
  4071. /** @hidden */
  4072. protected _transformedPosition: BABYLON.Vector2;
  4073. /** @hidden */
  4074. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  4075. protected _isEnabled: boolean;
  4076. protected _disabledColor: string;
  4077. /** @hidden */
  4078. protected _rebuildLayout: boolean;
  4079. /** @hidden */
  4080. _isClipped: boolean;
  4081. /** @hidden */
  4082. _tag: any;
  4083. /**
  4084. * 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
  4085. */
  4086. uniqueId: number;
  4087. /**
  4088. * Gets or sets an object used to store user defined information for the node
  4089. */
  4090. metadata: any;
  4091. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  4092. isHitTestVisible: boolean;
  4093. /** Gets or sets a boolean indicating if the control can block pointer events */
  4094. isPointerBlocker: boolean;
  4095. /** Gets or sets a boolean indicating if the control can be focusable */
  4096. isFocusInvisible: boolean;
  4097. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  4098. clipChildren: boolean;
  4099. /**
  4100. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  4101. */
  4102. useBitmapCache: boolean;
  4103. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  4104. shadowOffsetX: number;
  4105. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  4106. shadowOffsetY: number;
  4107. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  4108. shadowBlur: number;
  4109. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  4110. shadowColor: string;
  4111. /** Gets or sets the cursor to use when the control is hovered */
  4112. hoverCursor: string;
  4113. /** @hidden */
  4114. protected _linkOffsetX: ValueAndUnit;
  4115. /** @hidden */
  4116. protected _linkOffsetY: ValueAndUnit;
  4117. /** Gets the control type name */
  4118. readonly typeName: string;
  4119. /**
  4120. * Get the current class name of the control.
  4121. * @returns current class name
  4122. */
  4123. getClassName(): string;
  4124. /**
  4125. * An event triggered when the pointer move over the control.
  4126. */
  4127. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  4128. /**
  4129. * An event triggered when the pointer move out of the control.
  4130. */
  4131. onPointerOutObservable: BABYLON.Observable<Control>;
  4132. /**
  4133. * An event triggered when the pointer taps the control
  4134. */
  4135. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  4136. /**
  4137. * An event triggered when pointer up
  4138. */
  4139. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  4140. /**
  4141. * An event triggered when a control is clicked on
  4142. */
  4143. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  4144. /**
  4145. * An event triggered when pointer enters the control
  4146. */
  4147. onPointerEnterObservable: BABYLON.Observable<Control>;
  4148. /**
  4149. * An event triggered when the control is marked as dirty
  4150. */
  4151. onDirtyObservable: BABYLON.Observable<Control>;
  4152. /**
  4153. * An event triggered before drawing the control
  4154. */
  4155. onBeforeDrawObservable: BABYLON.Observable<Control>;
  4156. /**
  4157. * An event triggered after the control was drawn
  4158. */
  4159. onAfterDrawObservable: BABYLON.Observable<Control>;
  4160. /**
  4161. * Get the hosting AdvancedDynamicTexture
  4162. */
  4163. readonly host: AdvancedDynamicTexture;
  4164. /** Gets or set information about font offsets (used to render and align text) */
  4165. fontOffset: {
  4166. ascent: number;
  4167. height: number;
  4168. descent: number;
  4169. };
  4170. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  4171. alpha: number;
  4172. /**
  4173. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  4174. */
  4175. isHighlighted: boolean;
  4176. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  4177. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4178. */
  4179. scaleX: number;
  4180. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  4181. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4182. */
  4183. scaleY: number;
  4184. /** Gets or sets the rotation angle (0 by default)
  4185. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4186. */
  4187. rotation: number;
  4188. /** Gets or sets the transformation center on Y axis (0 by default)
  4189. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4190. */
  4191. transformCenterY: number;
  4192. /** Gets or sets the transformation center on X axis (0 by default)
  4193. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4194. */
  4195. transformCenterX: number;
  4196. /**
  4197. * Gets or sets the horizontal alignment
  4198. * @see http://doc.babylonjs.com/how_to/gui#alignments
  4199. */
  4200. horizontalAlignment: number;
  4201. /**
  4202. * Gets or sets the vertical alignment
  4203. * @see http://doc.babylonjs.com/how_to/gui#alignments
  4204. */
  4205. verticalAlignment: number;
  4206. /**
  4207. * Gets or sets control width
  4208. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4209. */
  4210. width: string | number;
  4211. /**
  4212. * Gets control width in pixel
  4213. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4214. */
  4215. readonly widthInPixels: number;
  4216. /**
  4217. * Gets or sets control height
  4218. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4219. */
  4220. height: string | number;
  4221. /**
  4222. * Gets control height in pixel
  4223. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4224. */
  4225. readonly heightInPixels: number;
  4226. /** Gets or set font family */
  4227. fontFamily: string;
  4228. /** Gets or sets font style */
  4229. fontStyle: string;
  4230. /** Gets or sets font weight */
  4231. fontWeight: string;
  4232. /**
  4233. * Gets or sets style
  4234. * @see http://doc.babylonjs.com/how_to/gui#styles
  4235. */
  4236. style: BABYLON.Nullable<Style>;
  4237. /** @hidden */
  4238. readonly _isFontSizeInPercentage: boolean;
  4239. /** Gets font size in pixels */
  4240. readonly fontSizeInPixels: number;
  4241. /** Gets or sets font size */
  4242. fontSize: string | number;
  4243. /** Gets or sets foreground color */
  4244. color: string;
  4245. /** Gets or sets z index which is used to reorder controls on the z axis */
  4246. zIndex: number;
  4247. /** Gets or sets a boolean indicating if the control can be rendered */
  4248. notRenderable: boolean;
  4249. /** Gets or sets a boolean indicating if the control is visible */
  4250. isVisible: boolean;
  4251. /** Gets a boolean indicating that the control needs to update its rendering */
  4252. readonly isDirty: boolean;
  4253. /**
  4254. * Gets the current linked mesh (or null if none)
  4255. */
  4256. readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  4257. /**
  4258. * Gets or sets a value indicating the padding to use on the left of the control
  4259. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4260. */
  4261. paddingLeft: string | number;
  4262. /**
  4263. * Gets a value indicating the padding in pixels to use on the left of the control
  4264. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4265. */
  4266. readonly paddingLeftInPixels: number;
  4267. /**
  4268. * Gets or sets a value indicating the padding to use on the right of the control
  4269. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4270. */
  4271. paddingRight: string | number;
  4272. /**
  4273. * Gets a value indicating the padding in pixels to use on the right of the control
  4274. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4275. */
  4276. readonly paddingRightInPixels: number;
  4277. /**
  4278. * Gets or sets a value indicating the padding to use on the top of the control
  4279. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4280. */
  4281. paddingTop: string | number;
  4282. /**
  4283. * Gets a value indicating the padding in pixels to use on the top of the control
  4284. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4285. */
  4286. readonly paddingTopInPixels: number;
  4287. /**
  4288. * Gets or sets a value indicating the padding to use on the bottom of the control
  4289. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4290. */
  4291. paddingBottom: string | number;
  4292. /**
  4293. * Gets a value indicating the padding in pixels to use on the bottom of the control
  4294. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4295. */
  4296. readonly paddingBottomInPixels: number;
  4297. /**
  4298. * Gets or sets a value indicating the left coordinate of the control
  4299. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4300. */
  4301. left: string | number;
  4302. /**
  4303. * Gets a value indicating the left coordinate in pixels of the control
  4304. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4305. */
  4306. readonly leftInPixels: number;
  4307. /**
  4308. * Gets or sets a value indicating the top coordinate of the control
  4309. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4310. */
  4311. top: string | number;
  4312. /**
  4313. * Gets a value indicating the top coordinate in pixels of the control
  4314. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4315. */
  4316. readonly topInPixels: number;
  4317. /**
  4318. * Gets or sets a value indicating the offset on X axis to the linked mesh
  4319. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4320. */
  4321. linkOffsetX: string | number;
  4322. /**
  4323. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  4324. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4325. */
  4326. readonly linkOffsetXInPixels: number;
  4327. /**
  4328. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  4329. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4330. */
  4331. linkOffsetY: string | number;
  4332. /**
  4333. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  4334. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4335. */
  4336. readonly linkOffsetYInPixels: number;
  4337. /** Gets the center coordinate on X axis */
  4338. readonly centerX: number;
  4339. /** Gets the center coordinate on Y axis */
  4340. readonly centerY: number;
  4341. /** Gets or sets if control is Enabled*/
  4342. isEnabled: boolean;
  4343. /** Gets or sets background color of control if it's disabled*/
  4344. disabledColor: string;
  4345. /**
  4346. * Creates a new control
  4347. * @param name defines the name of the control
  4348. */
  4349. constructor(
  4350. /** defines the name of the control */
  4351. name?: string | undefined);
  4352. /** @hidden */
  4353. protected _getTypeName(): string;
  4354. /**
  4355. * Gets the first ascendant in the hierarchy of the given type
  4356. * @param className defines the required type
  4357. * @returns the ascendant or null if not found
  4358. */
  4359. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  4360. /** @hidden */
  4361. _resetFontCache(): void;
  4362. /**
  4363. * Determines if a container is an ascendant of the current control
  4364. * @param container defines the container to look for
  4365. * @returns true if the container is one of the ascendant of the control
  4366. */
  4367. isAscendant(container: Control): boolean;
  4368. /**
  4369. * Gets coordinates in local control space
  4370. * @param globalCoordinates defines the coordinates to transform
  4371. * @returns the new coordinates in local space
  4372. */
  4373. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  4374. /**
  4375. * Gets coordinates in local control space
  4376. * @param globalCoordinates defines the coordinates to transform
  4377. * @param result defines the target vector2 where to store the result
  4378. * @returns the current control
  4379. */
  4380. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  4381. /**
  4382. * Gets coordinates in parent local control space
  4383. * @param globalCoordinates defines the coordinates to transform
  4384. * @returns the new coordinates in parent local space
  4385. */
  4386. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  4387. /**
  4388. * Move the current control to a vector3 position projected onto the screen.
  4389. * @param position defines the target position
  4390. * @param scene defines the hosting scene
  4391. */
  4392. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  4393. /** @hidden */
  4394. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  4395. /**
  4396. * Will return all controls that have this control as ascendant
  4397. * @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
  4398. * @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
  4399. * @return all child controls
  4400. */
  4401. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  4402. /**
  4403. * Link current control with a target mesh
  4404. * @param mesh defines the mesh to link with
  4405. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4406. */
  4407. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  4408. /** @hidden */
  4409. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  4410. /** @hidden */
  4411. _offsetLeft(offset: number): void;
  4412. /** @hidden */
  4413. _offsetTop(offset: number): void;
  4414. /** @hidden */
  4415. _markMatrixAsDirty(): void;
  4416. /** @hidden */
  4417. _flagDescendantsAsMatrixDirty(): void;
  4418. /** @hidden */
  4419. _markAsDirty(force?: boolean): void;
  4420. /** @hidden */
  4421. _markAllAsDirty(): void;
  4422. /** @hidden */
  4423. _link(host: AdvancedDynamicTexture): void;
  4424. /** @hidden */
  4425. protected _transform(context: CanvasRenderingContext2D): void;
  4426. /** @hidden */
  4427. _renderHighlight(context: CanvasRenderingContext2D): void;
  4428. /** @hidden */
  4429. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  4430. /** @hidden */
  4431. protected _applyStates(context: CanvasRenderingContext2D): void;
  4432. /** @hidden */
  4433. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  4434. /** @hidden */
  4435. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4436. /** @hidden */
  4437. _measure(): void;
  4438. /** @hidden */
  4439. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4440. /** @hidden */
  4441. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4442. /** @hidden */
  4443. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4444. /** @hidden */
  4445. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4446. /** @hidden */
  4447. _render(context: CanvasRenderingContext2D): boolean;
  4448. /** @hidden */
  4449. _draw(context: CanvasRenderingContext2D): void;
  4450. /**
  4451. * Tests if a given coordinates belong to the current control
  4452. * @param x defines x coordinate to test
  4453. * @param y defines y coordinate to test
  4454. * @returns true if the coordinates are inside the control
  4455. */
  4456. contains(x: number, y: number): boolean;
  4457. /** @hidden */
  4458. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  4459. /** @hidden */
  4460. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4461. /** @hidden */
  4462. _onPointerEnter(target: Control): boolean;
  4463. /** @hidden */
  4464. _onPointerOut(target: Control): void;
  4465. /** @hidden */
  4466. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4467. /** @hidden */
  4468. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4469. /** @hidden */
  4470. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4471. /** @hidden */
  4472. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  4473. /** Releases associated resources */
  4474. dispose(): void;
  4475. /** HORIZONTAL_ALIGNMENT_LEFT */
  4476. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  4477. /** HORIZONTAL_ALIGNMENT_RIGHT */
  4478. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  4479. /** HORIZONTAL_ALIGNMENT_CENTER */
  4480. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  4481. /** VERTICAL_ALIGNMENT_TOP */
  4482. static readonly VERTICAL_ALIGNMENT_TOP: number;
  4483. /** VERTICAL_ALIGNMENT_BOTTOM */
  4484. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  4485. /** VERTICAL_ALIGNMENT_CENTER */
  4486. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  4487. /** @hidden */
  4488. static _GetFontOffset(font: string): {
  4489. ascent: number;
  4490. height: number;
  4491. descent: number;
  4492. };
  4493. /**
  4494. * Creates a stack panel that can be used to render headers
  4495. * @param control defines the control to associate with the header
  4496. * @param text defines the text of the header
  4497. * @param size defines the size of the header
  4498. * @param options defines options used to configure the header
  4499. * @returns a new StackPanel
  4500. * @ignore
  4501. * @hidden
  4502. */
  4503. static AddHeader: (control: Control, text: string, size: string | number, options: {
  4504. isHorizontal: boolean;
  4505. controlFirst: boolean;
  4506. }) => any;
  4507. /** @hidden */
  4508. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  4509. }
  4510. }
  4511. declare module BABYLON.GUI {
  4512. /** Class used to create 2D ellipse containers */
  4513. export class Ellipse extends Container {
  4514. name?: string | undefined;
  4515. /** Gets or sets border thickness */
  4516. thickness: number;
  4517. /**
  4518. * Creates a new Ellipse
  4519. * @param name defines the control name
  4520. */
  4521. constructor(name?: string | undefined);
  4522. protected _getTypeName(): string;
  4523. protected _localDraw(context: CanvasRenderingContext2D): void;
  4524. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4525. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4526. }
  4527. }
  4528. declare module BABYLON.GUI {
  4529. /**
  4530. * Class used to create a 2D grid container
  4531. */
  4532. export class Grid extends Container {
  4533. name?: string | undefined;
  4534. /**
  4535. * Gets the number of columns
  4536. */
  4537. readonly columnCount: number;
  4538. /**
  4539. * Gets the number of rows
  4540. */
  4541. readonly rowCount: number;
  4542. /** Gets the list of children */
  4543. readonly children: Control[];
  4544. /**
  4545. * Gets the definition of a specific row
  4546. * @param index defines the index of the row
  4547. * @returns the row definition
  4548. */
  4549. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  4550. /**
  4551. * Gets the definition of a specific column
  4552. * @param index defines the index of the column
  4553. * @returns the column definition
  4554. */
  4555. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  4556. /**
  4557. * Adds a new row to the grid
  4558. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4559. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  4560. * @returns the current grid
  4561. */
  4562. addRowDefinition(height: number, isPixel?: boolean): Grid;
  4563. /**
  4564. * Adds a new column to the grid
  4565. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4566. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4567. * @returns the current grid
  4568. */
  4569. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  4570. /**
  4571. * Update a row definition
  4572. * @param index defines the index of the row to update
  4573. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4574. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  4575. * @returns the current grid
  4576. */
  4577. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  4578. /**
  4579. * Update a column definition
  4580. * @param index defines the index of the column to update
  4581. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4582. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4583. * @returns the current grid
  4584. */
  4585. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  4586. /**
  4587. * Gets the list of children stored in a specific cell
  4588. * @param row defines the row to check
  4589. * @param column defines the column to check
  4590. * @returns the list of controls
  4591. */
  4592. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  4593. /**
  4594. * Gets a string representing the child cell info (row x column)
  4595. * @param child defines the control to get info from
  4596. * @returns a string containing the child cell info (row x column)
  4597. */
  4598. getChildCellInfo(child: Control): string;
  4599. /**
  4600. * Remove a column definition at specified index
  4601. * @param index defines the index of the column to remove
  4602. * @returns the current grid
  4603. */
  4604. removeColumnDefinition(index: number): Grid;
  4605. /**
  4606. * Remove a row definition at specified index
  4607. * @param index defines the index of the row to remove
  4608. * @returns the current grid
  4609. */
  4610. removeRowDefinition(index: number): Grid;
  4611. /**
  4612. * Adds a new control to the current grid
  4613. * @param control defines the control to add
  4614. * @param row defines the row where to add the control (0 by default)
  4615. * @param column defines the column where to add the control (0 by default)
  4616. * @returns the current grid
  4617. */
  4618. addControl(control: Control, row?: number, column?: number): Grid;
  4619. /**
  4620. * Removes a control from the current container
  4621. * @param control defines the control to remove
  4622. * @returns the current container
  4623. */
  4624. removeControl(control: Control): Container;
  4625. /**
  4626. * Creates a new Grid
  4627. * @param name defines control name
  4628. */
  4629. constructor(name?: string | undefined);
  4630. protected _getTypeName(): string;
  4631. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  4632. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4633. _flagDescendantsAsMatrixDirty(): void;
  4634. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  4635. /** Releases associated resources */
  4636. dispose(): void;
  4637. }
  4638. }
  4639. declare module BABYLON.GUI {
  4640. /**
  4641. * Class used to create 2D images
  4642. */
  4643. export class Image extends Control {
  4644. name?: string | undefined;
  4645. /**
  4646. * BABYLON.Observable notified when the content is loaded
  4647. */
  4648. onImageLoadedObservable: BABYLON.Observable<Image>;
  4649. /**
  4650. * Gets a boolean indicating that the content is loaded
  4651. */
  4652. readonly isLoaded: boolean;
  4653. /**
  4654. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  4655. */
  4656. populateNinePatchSlicesFromImage: boolean;
  4657. /**
  4658. * Gets or sets the left value for slicing (9-patch)
  4659. */
  4660. sliceLeft: number;
  4661. /**
  4662. * Gets or sets the right value for slicing (9-patch)
  4663. */
  4664. sliceRight: number;
  4665. /**
  4666. * Gets or sets the top value for slicing (9-patch)
  4667. */
  4668. sliceTop: number;
  4669. /**
  4670. * Gets or sets the bottom value for slicing (9-patch)
  4671. */
  4672. sliceBottom: number;
  4673. /**
  4674. * Gets or sets the left coordinate in the source image
  4675. */
  4676. sourceLeft: number;
  4677. /**
  4678. * Gets or sets the top coordinate in the source image
  4679. */
  4680. sourceTop: number;
  4681. /**
  4682. * Gets or sets the width to capture in the source image
  4683. */
  4684. sourceWidth: number;
  4685. /**
  4686. * Gets or sets the height to capture in the source image
  4687. */
  4688. sourceHeight: number;
  4689. /**
  4690. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  4691. * @see http://doc.babylonjs.com/how_to/gui#image
  4692. */
  4693. autoScale: boolean;
  4694. /** Gets or sets the streching mode used by the image */
  4695. stretch: number;
  4696. /**
  4697. * Gets or sets the internal DOM image used to render the control
  4698. */
  4699. domImage: HTMLImageElement;
  4700. /**
  4701. * Gets or sets image source url
  4702. */
  4703. source: BABYLON.Nullable<string>;
  4704. /**
  4705. * Gets or sets the cell width to use when animation sheet is enabled
  4706. * @see http://doc.babylonjs.com/how_to/gui#image
  4707. */
  4708. cellWidth: number;
  4709. /**
  4710. * Gets or sets the cell height to use when animation sheet is enabled
  4711. * @see http://doc.babylonjs.com/how_to/gui#image
  4712. */
  4713. cellHeight: number;
  4714. /**
  4715. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4716. * @see http://doc.babylonjs.com/how_to/gui#image
  4717. */
  4718. cellId: number;
  4719. /**
  4720. * Creates a new Image
  4721. * @param name defines the control name
  4722. * @param url defines the image url
  4723. */
  4724. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4725. protected _getTypeName(): string;
  4726. /** Force the control to synchronize with its content */
  4727. synchronizeSizeWithContent(): void;
  4728. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4729. _draw(context: CanvasRenderingContext2D): void;
  4730. dispose(): void;
  4731. /** STRETCH_NONE */
  4732. static readonly STRETCH_NONE: number;
  4733. /** STRETCH_FILL */
  4734. static readonly STRETCH_FILL: number;
  4735. /** STRETCH_UNIFORM */
  4736. static readonly STRETCH_UNIFORM: number;
  4737. /** STRETCH_EXTEND */
  4738. static readonly STRETCH_EXTEND: number;
  4739. /** NINE_PATCH */
  4740. static readonly STRETCH_NINE_PATCH: number;
  4741. }
  4742. }
  4743. declare module BABYLON.GUI {
  4744. /**
  4745. * Class used to create input text control
  4746. */
  4747. export class InputText extends Control implements IFocusableControl {
  4748. name?: string | undefined;
  4749. /** @hidden */
  4750. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  4751. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4752. promptMessage: string;
  4753. /** BABYLON.Observable raised when the text changes */
  4754. onTextChangedObservable: BABYLON.Observable<InputText>;
  4755. /** BABYLON.Observable raised just before an entered character is to be added */
  4756. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4757. /** BABYLON.Observable raised when the control gets the focus */
  4758. onFocusObservable: BABYLON.Observable<InputText>;
  4759. /** BABYLON.Observable raised when the control loses the focus */
  4760. onBlurObservable: BABYLON.Observable<InputText>;
  4761. /**Observable raised when the text is highlighted */
  4762. onTextHighlightObservable: BABYLON.Observable<InputText>;
  4763. /**Observable raised when copy event is triggered */
  4764. onTextCopyObservable: BABYLON.Observable<InputText>;
  4765. /** BABYLON.Observable raised when cut event is triggered */
  4766. onTextCutObservable: BABYLON.Observable<InputText>;
  4767. /** BABYLON.Observable raised when paste event is triggered */
  4768. onTextPasteObservable: BABYLON.Observable<InputText>;
  4769. /** BABYLON.Observable raised when a key event was processed */
  4770. onKeyboardEventProcessedObservable: BABYLON.Observable<KeyboardEvent>;
  4771. /** Gets or sets the maximum width allowed by the control */
  4772. maxWidth: string | number;
  4773. /** Gets the maximum width allowed by the control in pixels */
  4774. readonly maxWidthInPixels: number;
  4775. /** Gets or sets the text highlighter transparency; default: 0.4 */
  4776. highligherOpacity: number;
  4777. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  4778. onFocusSelectAll: boolean;
  4779. /** Gets or sets the text hightlight color */
  4780. textHighlightColor: string;
  4781. /** Gets or sets control margin */
  4782. margin: string;
  4783. /** Gets control margin in pixels */
  4784. readonly marginInPixels: number;
  4785. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4786. autoStretchWidth: boolean;
  4787. /** Gets or sets border thickness */
  4788. thickness: number;
  4789. /** Gets or sets the background color when focused */
  4790. focusedBackground: string;
  4791. /** Gets or sets the background color when focused */
  4792. focusedColor: string;
  4793. /** Gets or sets the background color */
  4794. background: string;
  4795. /** Gets or sets the placeholder color */
  4796. placeholderColor: string;
  4797. /** Gets or sets the text displayed when the control is empty */
  4798. placeholderText: string;
  4799. /** Gets or sets the dead key flag */
  4800. deadKey: boolean;
  4801. /** Gets or sets the highlight text */
  4802. highlightedText: string;
  4803. /** Gets or sets if the current key should be added */
  4804. addKey: boolean;
  4805. /** Gets or sets the value of the current key being entered */
  4806. currentKey: string;
  4807. /** Gets or sets the text displayed in the control */
  4808. text: string;
  4809. /** Gets or sets control width */
  4810. width: string | number;
  4811. /**
  4812. * Creates a new InputText
  4813. * @param name defines the control name
  4814. * @param text defines the text of the control
  4815. */
  4816. constructor(name?: string | undefined, text?: string);
  4817. /** @hidden */
  4818. onBlur(): void;
  4819. /** @hidden */
  4820. onFocus(): void;
  4821. protected _getTypeName(): string;
  4822. /**
  4823. * Function called to get the list of controls that should not steal the focus from this control
  4824. * @returns an array of controls
  4825. */
  4826. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4827. /** @hidden */
  4828. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  4829. /**
  4830. * Handles the keyboard event
  4831. * @param evt Defines the KeyboardEvent
  4832. */
  4833. processKeyboard(evt: KeyboardEvent): void;
  4834. _draw(context: CanvasRenderingContext2D): void;
  4835. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4836. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4837. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4838. protected _beforeRenderText(text: string): string;
  4839. dispose(): void;
  4840. }
  4841. }
  4842. declare module BABYLON.GUI {
  4843. /**
  4844. * Class used to create a password control
  4845. */
  4846. export class InputPassword extends InputText {
  4847. protected _beforeRenderText(text: string): string;
  4848. }
  4849. }
  4850. declare module BABYLON.GUI {
  4851. /** Class used to render 2D lines */
  4852. export class Line extends Control {
  4853. name?: string | undefined;
  4854. /** Gets or sets the dash pattern */
  4855. dash: Array<number>;
  4856. /** Gets or sets the control connected with the line end */
  4857. connectedControl: Control;
  4858. /** Gets or sets start coordinates on X axis */
  4859. x1: string | number;
  4860. /** Gets or sets start coordinates on Y axis */
  4861. y1: string | number;
  4862. /** Gets or sets end coordinates on X axis */
  4863. x2: string | number;
  4864. /** Gets or sets end coordinates on Y axis */
  4865. y2: string | number;
  4866. /** Gets or sets line width */
  4867. lineWidth: number;
  4868. /** Gets or sets horizontal alignment */
  4869. horizontalAlignment: number;
  4870. /** Gets or sets vertical alignment */
  4871. verticalAlignment: number;
  4872. /**
  4873. * Creates a new Line
  4874. * @param name defines the control name
  4875. */
  4876. constructor(name?: string | undefined);
  4877. protected _getTypeName(): string;
  4878. _draw(context: CanvasRenderingContext2D): void;
  4879. _measure(): void;
  4880. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4881. /**
  4882. * Move one end of the line given 3D cartesian coordinates.
  4883. * @param position Targeted world position
  4884. * @param scene BABYLON.Scene
  4885. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4886. */
  4887. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4888. /**
  4889. * Move one end of the line to a position in screen absolute space.
  4890. * @param projectedPosition Position in screen absolute space (X, Y)
  4891. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4892. */
  4893. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4894. }
  4895. }
  4896. declare module BABYLON.GUI {
  4897. /**
  4898. * Class used to create multi line control
  4899. */
  4900. export class MultiLine extends Control {
  4901. name?: string | undefined;
  4902. /**
  4903. * Creates a new MultiLine
  4904. * @param name defines the control name
  4905. */
  4906. constructor(name?: string | undefined);
  4907. /** Gets or sets dash pattern */
  4908. dash: Array<number>;
  4909. /**
  4910. * Gets point stored at specified index
  4911. * @param index defines the index to look for
  4912. * @returns the requested point if found
  4913. */
  4914. getAt(index: number): MultiLinePoint;
  4915. /** Function called when a point is updated */
  4916. onPointUpdate: () => void;
  4917. /**
  4918. * Adds new points to the point collection
  4919. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4920. * @returns the list of created MultiLinePoint
  4921. */
  4922. add(...items: (AbstractMesh | Control | {
  4923. x: string | number;
  4924. y: string | number;
  4925. })[]): MultiLinePoint[];
  4926. /**
  4927. * Adds a new point to the point collection
  4928. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4929. * @returns the created MultiLinePoint
  4930. */
  4931. push(item?: (AbstractMesh | Control | {
  4932. x: string | number;
  4933. y: string | number;
  4934. })): MultiLinePoint;
  4935. /**
  4936. * Remove a specific value or point from the active point collection
  4937. * @param value defines the value or point to remove
  4938. */
  4939. remove(value: number | MultiLinePoint): void;
  4940. /**
  4941. * Resets this object to initial state (no point)
  4942. */
  4943. reset(): void;
  4944. /**
  4945. * Resets all links
  4946. */
  4947. resetLinks(): void;
  4948. /** Gets or sets line width */
  4949. lineWidth: number;
  4950. horizontalAlignment: number;
  4951. verticalAlignment: number;
  4952. protected _getTypeName(): string;
  4953. _draw(context: CanvasRenderingContext2D): void;
  4954. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4955. _measure(): void;
  4956. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4957. dispose(): void;
  4958. }
  4959. }
  4960. declare module BABYLON.GUI {
  4961. /**
  4962. * Class used to create radio button controls
  4963. */
  4964. export class RadioButton extends Control {
  4965. name?: string | undefined;
  4966. /** Gets or sets border thickness */
  4967. thickness: number;
  4968. /** Gets or sets group name */
  4969. group: string;
  4970. /** BABYLON.Observable raised when isChecked is changed */
  4971. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4972. /** Gets or sets a value indicating the ratio between overall size and check size */
  4973. checkSizeRatio: number;
  4974. /** Gets or sets background color */
  4975. background: string;
  4976. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4977. isChecked: boolean;
  4978. /**
  4979. * Creates a new RadioButton
  4980. * @param name defines the control name
  4981. */
  4982. constructor(name?: string | undefined);
  4983. protected _getTypeName(): string;
  4984. _draw(context: CanvasRenderingContext2D): void;
  4985. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4986. /**
  4987. * Utility function to easily create a radio button with a header
  4988. * @param title defines the label to use for the header
  4989. * @param group defines the group to use for the radio button
  4990. * @param isChecked defines the initial state of the radio button
  4991. * @param onValueChanged defines the callback to call when value changes
  4992. * @returns a StackPanel containing the radio button and a textBlock
  4993. */
  4994. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  4995. }
  4996. }
  4997. declare module BABYLON.GUI {
  4998. /**
  4999. * Class used to create a 2D stack panel container
  5000. */
  5001. export class StackPanel extends Container {
  5002. name?: string | undefined;
  5003. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  5004. isVertical: boolean;
  5005. /**
  5006. * Gets or sets panel width.
  5007. * This value should not be set when in horizontal mode as it will be computed automatically
  5008. */
  5009. width: string | number;
  5010. /**
  5011. * Gets or sets panel height.
  5012. * This value should not be set when in vertical mode as it will be computed automatically
  5013. */
  5014. height: string | number;
  5015. /**
  5016. * Creates a new StackPanel
  5017. * @param name defines control name
  5018. */
  5019. constructor(name?: string | undefined);
  5020. protected _getTypeName(): string;
  5021. /** @hidden */
  5022. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5023. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5024. protected _postMeasure(): void;
  5025. }
  5026. }
  5027. declare module BABYLON.GUI {
  5028. /** Class used to create a RadioGroup
  5029. * which contains groups of radio buttons
  5030. */
  5031. export class SelectorGroup {
  5032. /** name of SelectorGroup */
  5033. name: string;
  5034. /**
  5035. * Creates a new SelectorGroup
  5036. * @param name of group, used as a group heading
  5037. */
  5038. constructor(
  5039. /** name of SelectorGroup */
  5040. name: string);
  5041. /** Gets the groupPanel of the SelectorGroup */
  5042. readonly groupPanel: StackPanel;
  5043. /** Gets the selectors array */
  5044. readonly selectors: StackPanel[];
  5045. /** Gets and sets the group header */
  5046. header: string;
  5047. /** @hidden*/
  5048. _getSelector(selectorNb: number): StackPanel | undefined;
  5049. /** Removes the selector at the given position
  5050. * @param selectorNb the position of the selector within the group
  5051. */
  5052. removeSelector(selectorNb: number): void;
  5053. }
  5054. /** Class used to create a CheckboxGroup
  5055. * which contains groups of checkbox buttons
  5056. */
  5057. export class CheckboxGroup extends SelectorGroup {
  5058. /** Adds a checkbox as a control
  5059. * @param text is the label for the selector
  5060. * @param func is the function called when the Selector is checked
  5061. * @param checked is true when Selector is checked
  5062. */
  5063. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  5064. /** @hidden */
  5065. _setSelectorLabel(selectorNb: number, label: string): void;
  5066. /** @hidden */
  5067. _setSelectorLabelColor(selectorNb: number, color: string): void;
  5068. /** @hidden */
  5069. _setSelectorButtonColor(selectorNb: number, color: string): void;
  5070. /** @hidden */
  5071. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  5072. }
  5073. /** Class used to create a RadioGroup
  5074. * which contains groups of radio buttons
  5075. */
  5076. export class RadioGroup extends SelectorGroup {
  5077. /** Adds a radio button as a control
  5078. * @param label is the label for the selector
  5079. * @param func is the function called when the Selector is checked
  5080. * @param checked is true when Selector is checked
  5081. */
  5082. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  5083. /** @hidden */
  5084. _setSelectorLabel(selectorNb: number, label: string): void;
  5085. /** @hidden */
  5086. _setSelectorLabelColor(selectorNb: number, color: string): void;
  5087. /** @hidden */
  5088. _setSelectorButtonColor(selectorNb: number, color: string): void;
  5089. /** @hidden */
  5090. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  5091. }
  5092. /** Class used to create a SliderGroup
  5093. * which contains groups of slider buttons
  5094. */
  5095. export class SliderGroup extends SelectorGroup {
  5096. /**
  5097. * Adds a slider to the SelectorGroup
  5098. * @param label is the label for the SliderBar
  5099. * @param func is the function called when the Slider moves
  5100. * @param unit is a string describing the units used, eg degrees or metres
  5101. * @param min is the minimum value for the Slider
  5102. * @param max is the maximum value for the Slider
  5103. * @param value is the start value for the Slider between min and max
  5104. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  5105. */
  5106. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  5107. /** @hidden */
  5108. _setSelectorLabel(selectorNb: number, label: string): void;
  5109. /** @hidden */
  5110. _setSelectorLabelColor(selectorNb: number, color: string): void;
  5111. /** @hidden */
  5112. _setSelectorButtonColor(selectorNb: number, color: string): void;
  5113. /** @hidden */
  5114. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  5115. }
  5116. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  5117. * @see http://doc.babylonjs.com/how_to/selector
  5118. */
  5119. export class SelectionPanel extends Rectangle {
  5120. /** name of SelectionPanel */
  5121. name: string;
  5122. /** an array of SelectionGroups */
  5123. groups: SelectorGroup[];
  5124. /**
  5125. * Creates a new SelectionPanel
  5126. * @param name of SelectionPanel
  5127. * @param groups is an array of SelectionGroups
  5128. */
  5129. constructor(
  5130. /** name of SelectionPanel */
  5131. name: string,
  5132. /** an array of SelectionGroups */
  5133. groups?: SelectorGroup[]);
  5134. protected _getTypeName(): string;
  5135. /** Gets or sets the headerColor */
  5136. headerColor: string;
  5137. /** Gets or sets the button color */
  5138. buttonColor: string;
  5139. /** Gets or sets the label color */
  5140. labelColor: string;
  5141. /** Gets or sets the button background */
  5142. buttonBackground: string;
  5143. /** Gets or sets the color of separator bar */
  5144. barColor: string;
  5145. /** Gets or sets the height of separator bar */
  5146. barHeight: string;
  5147. /** Gets or sets the height of spacers*/
  5148. spacerHeight: string;
  5149. /** Add a group to the selection panel
  5150. * @param group is the selector group to add
  5151. */
  5152. addGroup(group: SelectorGroup): void;
  5153. /** Remove the group from the given position
  5154. * @param groupNb is the position of the group in the list
  5155. */
  5156. removeGroup(groupNb: number): void;
  5157. /** Change a group header label
  5158. * @param label is the new group header label
  5159. * @param groupNb is the number of the group to relabel
  5160. * */
  5161. setHeaderName(label: string, groupNb: number): void;
  5162. /** Change selector label to the one given
  5163. * @param label is the new selector label
  5164. * @param groupNb is the number of the groupcontaining the selector
  5165. * @param selectorNb is the number of the selector within a group to relabel
  5166. * */
  5167. relabel(label: string, groupNb: number, selectorNb: number): void;
  5168. /** For a given group position remove the selector at the given position
  5169. * @param groupNb is the number of the group to remove the selector from
  5170. * @param selectorNb is the number of the selector within the group
  5171. */
  5172. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  5173. /** For a given group position of correct type add a checkbox button
  5174. * @param groupNb is the number of the group to remove the selector from
  5175. * @param label is the label for the selector
  5176. * @param func is the function called when the Selector is checked
  5177. * @param checked is true when Selector is checked
  5178. */
  5179. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  5180. /** For a given group position of correct type add a radio button
  5181. * @param groupNb is the number of the group to remove the selector from
  5182. * @param label is the label for the selector
  5183. * @param func is the function called when the Selector is checked
  5184. * @param checked is true when Selector is checked
  5185. */
  5186. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  5187. /**
  5188. * For a given slider group add a slider
  5189. * @param groupNb is the number of the group to add the slider to
  5190. * @param label is the label for the Slider
  5191. * @param func is the function called when the Slider moves
  5192. * @param unit is a string describing the units used, eg degrees or metres
  5193. * @param min is the minimum value for the Slider
  5194. * @param max is the maximum value for the Slider
  5195. * @param value is the start value for the Slider between min and max
  5196. * @param onVal is the function used to format the value displayed, eg radians to degrees
  5197. */
  5198. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  5199. }
  5200. }
  5201. declare module BABYLON.GUI {
  5202. /**
  5203. * Class used to hold a viewer window and sliders in a grid
  5204. */
  5205. export class ScrollViewer extends Rectangle {
  5206. /**
  5207. * Adds a new control to the current container
  5208. * @param control defines the control to add
  5209. * @returns the current container
  5210. */
  5211. addControl(control: BABYLON.Nullable<Control>): Container;
  5212. /**
  5213. * Removes a control from the current container
  5214. * @param control defines the control to remove
  5215. * @returns the current container
  5216. */
  5217. removeControl(control: Control): Container;
  5218. /** Gets the list of children */
  5219. readonly children: Control[];
  5220. _flagDescendantsAsMatrixDirty(): void;
  5221. /**
  5222. * Creates a new ScrollViewer
  5223. * @param name of ScrollViewer
  5224. */
  5225. constructor(name?: string);
  5226. /** Reset the scroll viewer window to initial size */
  5227. resetWindow(): void;
  5228. protected _getTypeName(): string;
  5229. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5230. protected _postMeasure(): void;
  5231. /**
  5232. * Gets or sets the mouse wheel precision
  5233. * from 0 to 1 with a default value of 0.05
  5234. * */
  5235. wheelPrecision: number;
  5236. /** Gets or sets the bar color */
  5237. barColor: string;
  5238. /** Gets or sets the size of the bar */
  5239. barSize: number;
  5240. /** Gets or sets the bar background */
  5241. barBackground: string;
  5242. _link(host: AdvancedDynamicTexture): void;
  5243. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  5244. /** Releases associated resources */
  5245. dispose(): void;
  5246. }
  5247. }
  5248. declare module BABYLON.GUI {
  5249. /**
  5250. * Enum that determines the text-wrapping mode to use.
  5251. */
  5252. export enum TextWrapping {
  5253. /**
  5254. * Clip the text when it's larger than Control.width; this is the default mode.
  5255. */
  5256. Clip = 0,
  5257. /**
  5258. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  5259. */
  5260. WordWrap = 1,
  5261. /**
  5262. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  5263. */
  5264. Ellipsis = 2
  5265. }
  5266. /**
  5267. * Class used to create text block control
  5268. */
  5269. export class TextBlock extends Control {
  5270. /**
  5271. * Defines the name of the control
  5272. */
  5273. name?: string | undefined;
  5274. /**
  5275. * An event triggered after the text is changed
  5276. */
  5277. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  5278. /**
  5279. * An event triggered after the text was broken up into lines
  5280. */
  5281. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  5282. /**
  5283. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  5284. */
  5285. readonly lines: any[];
  5286. /**
  5287. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  5288. */
  5289. resizeToFit: boolean;
  5290. /**
  5291. * Gets or sets a boolean indicating if text must be wrapped
  5292. */
  5293. textWrapping: TextWrapping | boolean;
  5294. /**
  5295. * Gets or sets text to display
  5296. */
  5297. text: string;
  5298. /**
  5299. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  5300. */
  5301. textHorizontalAlignment: number;
  5302. /**
  5303. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  5304. */
  5305. textVerticalAlignment: number;
  5306. /**
  5307. * Gets or sets line spacing value
  5308. */
  5309. lineSpacing: string | number;
  5310. /**
  5311. * Gets or sets outlineWidth of the text to display
  5312. */
  5313. outlineWidth: number;
  5314. /**
  5315. * Gets or sets outlineColor of the text to display
  5316. */
  5317. outlineColor: string;
  5318. /**
  5319. * Creates a new TextBlock object
  5320. * @param name defines the name of the control
  5321. * @param text defines the text to display (emptry string by default)
  5322. */
  5323. constructor(
  5324. /**
  5325. * Defines the name of the control
  5326. */
  5327. name?: string | undefined, text?: string);
  5328. protected _getTypeName(): string;
  5329. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5330. /** @hidden */
  5331. _draw(context: CanvasRenderingContext2D): void;
  5332. protected _applyStates(context: CanvasRenderingContext2D): void;
  5333. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  5334. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  5335. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  5336. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  5337. protected _renderLines(context: CanvasRenderingContext2D): void;
  5338. /**
  5339. * Given a width constraint applied on the text block, find the expected height
  5340. * @returns expected height
  5341. */
  5342. computeExpectedHeight(): number;
  5343. dispose(): void;
  5344. }
  5345. }
  5346. declare module BABYLON.GUI {
  5347. /**
  5348. * Class used to store key control properties
  5349. */
  5350. export class KeyPropertySet {
  5351. /** Width */
  5352. width?: string;
  5353. /** Height */
  5354. height?: string;
  5355. /** Left padding */
  5356. paddingLeft?: string;
  5357. /** Right padding */
  5358. paddingRight?: string;
  5359. /** Top padding */
  5360. paddingTop?: string;
  5361. /** Bottom padding */
  5362. paddingBottom?: string;
  5363. /** Foreground color */
  5364. color?: string;
  5365. /** Background color */
  5366. background?: string;
  5367. }
  5368. /**
  5369. * Class used to create virtual keyboard
  5370. */
  5371. export class VirtualKeyboard extends StackPanel {
  5372. /** BABYLON.Observable raised when a key is pressed */
  5373. onKeyPressObservable: BABYLON.Observable<string>;
  5374. /** Gets or sets default key button width */
  5375. defaultButtonWidth: string;
  5376. /** Gets or sets default key button height */
  5377. defaultButtonHeight: string;
  5378. /** Gets or sets default key button left padding */
  5379. defaultButtonPaddingLeft: string;
  5380. /** Gets or sets default key button right padding */
  5381. defaultButtonPaddingRight: string;
  5382. /** Gets or sets default key button top padding */
  5383. defaultButtonPaddingTop: string;
  5384. /** Gets or sets default key button bottom padding */
  5385. defaultButtonPaddingBottom: string;
  5386. /** Gets or sets default key button foreground color */
  5387. defaultButtonColor: string;
  5388. /** Gets or sets default key button background color */
  5389. defaultButtonBackground: string;
  5390. /** Gets or sets shift button foreground color */
  5391. shiftButtonColor: string;
  5392. /** Gets or sets shift button thickness*/
  5393. selectedShiftThickness: number;
  5394. /** Gets shift key state */
  5395. shiftState: number;
  5396. protected _getTypeName(): string;
  5397. /**
  5398. * Adds a new row of keys
  5399. * @param keys defines the list of keys to add
  5400. * @param propertySets defines the associated property sets
  5401. */
  5402. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  5403. /**
  5404. * Set the shift key to a specific state
  5405. * @param shiftState defines the new shift state
  5406. */
  5407. applyShiftState(shiftState: number): void;
  5408. /** Gets the input text control currently attached to the keyboard */
  5409. readonly connectedInputText: BABYLON.Nullable<InputText>;
  5410. /**
  5411. * Connects the keyboard with an input text control
  5412. *
  5413. * @param input defines the target control
  5414. */
  5415. connect(input: InputText): void;
  5416. /**
  5417. * Disconnects the keyboard from connected InputText controls
  5418. *
  5419. * @param input optionally defines a target control, otherwise all are disconnected
  5420. */
  5421. disconnect(input?: InputText): void;
  5422. /**
  5423. * Release all resources
  5424. */
  5425. dispose(): void;
  5426. /**
  5427. * Creates a new keyboard using a default layout
  5428. *
  5429. * @param name defines control name
  5430. * @returns a new VirtualKeyboard
  5431. */
  5432. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  5433. }
  5434. }
  5435. declare module BABYLON.GUI {
  5436. /** Class used to create rectangle container */
  5437. export class Rectangle extends Container {
  5438. name?: string | undefined;
  5439. /** Gets or sets border thickness */
  5440. thickness: number;
  5441. /** Gets or sets the corner radius angle */
  5442. cornerRadius: number;
  5443. /**
  5444. * Creates a new Rectangle
  5445. * @param name defines the control name
  5446. */
  5447. constructor(name?: string | undefined);
  5448. protected _getTypeName(): string;
  5449. protected _localDraw(context: CanvasRenderingContext2D): void;
  5450. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5451. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  5452. }
  5453. }
  5454. declare module BABYLON.GUI {
  5455. /** Class used to render a grid */
  5456. export class DisplayGrid extends Control {
  5457. name?: string | undefined;
  5458. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  5459. displayMinorLines: boolean;
  5460. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  5461. displayMajorLines: boolean;
  5462. /** Gets or sets background color (Black by default) */
  5463. background: string;
  5464. /** Gets or sets the width of each cell (20 by default) */
  5465. cellWidth: number;
  5466. /** Gets or sets the height of each cell (20 by default) */
  5467. cellHeight: number;
  5468. /** Gets or sets the tickness of minor lines (1 by default) */
  5469. minorLineTickness: number;
  5470. /** Gets or sets the color of minor lines (DarkGray by default) */
  5471. minorLineColor: string;
  5472. /** Gets or sets the tickness of major lines (2 by default) */
  5473. majorLineTickness: number;
  5474. /** Gets or sets the color of major lines (White by default) */
  5475. majorLineColor: string;
  5476. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  5477. majorLineFrequency: number;
  5478. /**
  5479. * Creates a new GridDisplayRectangle
  5480. * @param name defines the control name
  5481. */
  5482. constructor(name?: string | undefined);
  5483. _draw(context: CanvasRenderingContext2D): void;
  5484. protected _getTypeName(): string;
  5485. }
  5486. }
  5487. declare module BABYLON.GUI {
  5488. /**
  5489. * Class used to create slider controls
  5490. */
  5491. export class BaseSlider extends Control {
  5492. name?: string | undefined;
  5493. protected _thumbWidth: ValueAndUnit;
  5494. protected _barOffset: ValueAndUnit;
  5495. protected _displayThumb: boolean;
  5496. protected _effectiveBarOffset: number;
  5497. protected _renderLeft: number;
  5498. protected _renderTop: number;
  5499. protected _renderWidth: number;
  5500. protected _renderHeight: number;
  5501. protected _backgroundBoxLength: number;
  5502. protected _backgroundBoxThickness: number;
  5503. protected _effectiveThumbThickness: number;
  5504. /** BABYLON.Observable raised when the sldier value changes */
  5505. onValueChangedObservable: BABYLON.Observable<number>;
  5506. /** Gets or sets a boolean indicating if the thumb must be rendered */
  5507. displayThumb: boolean;
  5508. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  5509. barOffset: string | number;
  5510. /** Gets main bar offset in pixels*/
  5511. readonly barOffsetInPixels: number;
  5512. /** Gets or sets thumb width */
  5513. thumbWidth: string | number;
  5514. /** Gets thumb width in pixels */
  5515. readonly thumbWidthInPixels: number;
  5516. /** Gets or sets minimum value */
  5517. minimum: number;
  5518. /** Gets or sets maximum value */
  5519. maximum: number;
  5520. /** Gets or sets current value */
  5521. value: number;
  5522. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  5523. isVertical: boolean;
  5524. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  5525. isThumbClamped: boolean;
  5526. /**
  5527. * Creates a new BaseSlider
  5528. * @param name defines the control name
  5529. */
  5530. constructor(name?: string | undefined);
  5531. protected _getTypeName(): string;
  5532. protected _getThumbPosition(): number;
  5533. protected _getThumbThickness(type: string): number;
  5534. protected _prepareRenderingData(type: string): void;
  5535. /** @hidden */
  5536. protected _updateValueFromPointer(x: number, y: number): void;
  5537. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  5538. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  5539. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5540. }
  5541. }
  5542. declare module BABYLON.GUI {
  5543. /**
  5544. * Class used to create slider controls
  5545. */
  5546. export class Slider extends BaseSlider {
  5547. name?: string | undefined;
  5548. protected _displayValueBar: boolean;
  5549. /** Gets or sets a boolean indicating if the value bar must be rendered */
  5550. displayValueBar: boolean;
  5551. /** Gets or sets border color */
  5552. borderColor: string;
  5553. /** Gets or sets background color */
  5554. background: string;
  5555. /** Gets or sets a boolean indicating if the thumb should be round or square */
  5556. isThumbCircle: boolean;
  5557. /**
  5558. * Creates a new Slider
  5559. * @param name defines the control name
  5560. */
  5561. constructor(name?: string | undefined);
  5562. protected _getTypeName(): string;
  5563. _draw(context: CanvasRenderingContext2D): void;
  5564. }
  5565. }
  5566. declare module BABYLON.GUI {
  5567. /**
  5568. * Class used to create slider controls based on images
  5569. */
  5570. export class ImageBasedSlider extends BaseSlider {
  5571. name?: string | undefined;
  5572. displayThumb: boolean;
  5573. /**
  5574. * Gets or sets the image used to render the background
  5575. */
  5576. backgroundImage: Image;
  5577. /**
  5578. * Gets or sets the image used to render the value bar
  5579. */
  5580. valueBarImage: Image;
  5581. /**
  5582. * Gets or sets the image used to render the thumb
  5583. */
  5584. thumbImage: Image;
  5585. /**
  5586. * Creates a new ImageBasedSlider
  5587. * @param name defines the control name
  5588. */
  5589. constructor(name?: string | undefined);
  5590. protected _getTypeName(): string;
  5591. _draw(context: CanvasRenderingContext2D): void;
  5592. }
  5593. }
  5594. declare module BABYLON.GUI {
  5595. /**
  5596. * Forcing an export so that this code will execute
  5597. * @hidden
  5598. */
  5599. const name = "Statics";
  5600. }
  5601. declare module BABYLON.GUI {
  5602. /**
  5603. * Class used as a root to all buttons
  5604. */
  5605. export class AbstractButton3D extends Control3D {
  5606. /**
  5607. * Creates a new button
  5608. * @param name defines the control name
  5609. */
  5610. constructor(name?: string);
  5611. protected _getTypeName(): string;
  5612. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5613. }
  5614. }
  5615. declare module BABYLON.GUI {
  5616. /**
  5617. * Class used to create a button in 3D
  5618. */
  5619. export class Button3D extends AbstractButton3D {
  5620. /** @hidden */
  5621. protected _currentMaterial: BABYLON.Material;
  5622. /**
  5623. * Gets or sets the texture resolution used to render content (512 by default)
  5624. */
  5625. contentResolution: BABYLON.int;
  5626. /**
  5627. * Gets or sets the texture scale ratio used to render content (2 by default)
  5628. */
  5629. contentScaleRatio: number;
  5630. protected _disposeFacadeTexture(): void;
  5631. protected _resetContent(): void;
  5632. /**
  5633. * Creates a new button
  5634. * @param name defines the control name
  5635. */
  5636. constructor(name?: string);
  5637. /**
  5638. * Gets or sets the GUI 2D content used to display the button's facade
  5639. */
  5640. content: Control;
  5641. /**
  5642. * Apply the facade texture (created from the content property).
  5643. * This function can be overloaded by child classes
  5644. * @param facadeTexture defines the AdvancedDynamicTexture to use
  5645. */
  5646. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5647. protected _getTypeName(): string;
  5648. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5649. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5650. /**
  5651. * Releases all associated resources
  5652. */
  5653. dispose(): void;
  5654. }
  5655. }
  5656. declare module BABYLON.GUI {
  5657. /**
  5658. * Class used to create containers for controls
  5659. */
  5660. export class Container3D extends Control3D {
  5661. /**
  5662. * Gets the list of child controls
  5663. */
  5664. protected _children: Control3D[];
  5665. /**
  5666. * Gets the list of child controls
  5667. */
  5668. readonly children: Array<Control3D>;
  5669. /**
  5670. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  5671. * This is helpful to optimize layout operation when adding multiple children in a row
  5672. */
  5673. blockLayout: boolean;
  5674. /**
  5675. * Creates a new container
  5676. * @param name defines the container name
  5677. */
  5678. constructor(name?: string);
  5679. /**
  5680. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  5681. * @returns the current container
  5682. */
  5683. updateLayout(): Container3D;
  5684. /**
  5685. * Gets a boolean indicating if the given control is in the children of this control
  5686. * @param control defines the control to check
  5687. * @returns true if the control is in the child list
  5688. */
  5689. containsControl(control: Control3D): boolean;
  5690. /**
  5691. * Adds a control to the children of this control
  5692. * @param control defines the control to add
  5693. * @returns the current container
  5694. */
  5695. addControl(control: Control3D): Container3D;
  5696. /**
  5697. * This function will be called everytime a new control is added
  5698. */
  5699. protected _arrangeChildren(): void;
  5700. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5701. /**
  5702. * Removes a control from the children of this control
  5703. * @param control defines the control to remove
  5704. * @returns the current container
  5705. */
  5706. removeControl(control: Control3D): Container3D;
  5707. protected _getTypeName(): string;
  5708. /**
  5709. * Releases all associated resources
  5710. */
  5711. dispose(): void;
  5712. /** Control rotation will remain unchanged */
  5713. static readonly UNSET_ORIENTATION: number;
  5714. /** Control will rotate to make it look at sphere central axis */
  5715. static readonly FACEORIGIN_ORIENTATION: number;
  5716. /** Control will rotate to make it look back at sphere central axis */
  5717. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  5718. /** Control will rotate to look at z axis (0, 0, 1) */
  5719. static readonly FACEFORWARD_ORIENTATION: number;
  5720. /** Control will rotate to look at negative z axis (0, 0, -1) */
  5721. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  5722. }
  5723. }
  5724. declare module BABYLON.GUI {
  5725. /**
  5726. * Class used as base class for controls
  5727. */
  5728. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  5729. /** Defines the control name */
  5730. name?: string | undefined;
  5731. /** @hidden */
  5732. _host: GUI3DManager;
  5733. /** Gets or sets the control position in world space */
  5734. position: BABYLON.Vector3;
  5735. /** Gets or sets the control scaling in world space */
  5736. scaling: BABYLON.Vector3;
  5737. /** Callback used to start pointer enter animation */
  5738. pointerEnterAnimation: () => void;
  5739. /** Callback used to start pointer out animation */
  5740. pointerOutAnimation: () => void;
  5741. /** Callback used to start pointer down animation */
  5742. pointerDownAnimation: () => void;
  5743. /** Callback used to start pointer up animation */
  5744. pointerUpAnimation: () => void;
  5745. /**
  5746. * An event triggered when the pointer move over the control
  5747. */
  5748. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  5749. /**
  5750. * An event triggered when the pointer move out of the control
  5751. */
  5752. onPointerOutObservable: BABYLON.Observable<Control3D>;
  5753. /**
  5754. * An event triggered when the pointer taps the control
  5755. */
  5756. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  5757. /**
  5758. * An event triggered when pointer is up
  5759. */
  5760. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  5761. /**
  5762. * An event triggered when a control is clicked on (with a mouse)
  5763. */
  5764. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  5765. /**
  5766. * An event triggered when pointer enters the control
  5767. */
  5768. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  5769. /**
  5770. * Gets or sets the parent container
  5771. */
  5772. parent: BABYLON.Nullable<Container3D>;
  5773. /**
  5774. * Gets the list of attached behaviors
  5775. * @see http://doc.babylonjs.com/features/behaviour
  5776. */
  5777. readonly behaviors: BABYLON.Behavior<Control3D>[];
  5778. /**
  5779. * Attach a behavior to the control
  5780. * @see http://doc.babylonjs.com/features/behaviour
  5781. * @param behavior defines the behavior to attach
  5782. * @returns the current control
  5783. */
  5784. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5785. /**
  5786. * Remove an attached behavior
  5787. * @see http://doc.babylonjs.com/features/behaviour
  5788. * @param behavior defines the behavior to attach
  5789. * @returns the current control
  5790. */
  5791. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5792. /**
  5793. * Gets an attached behavior by name
  5794. * @param name defines the name of the behavior to look for
  5795. * @see http://doc.babylonjs.com/features/behaviour
  5796. * @returns null if behavior was not found else the requested behavior
  5797. */
  5798. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  5799. /** Gets or sets a boolean indicating if the control is visible */
  5800. isVisible: boolean;
  5801. /**
  5802. * Creates a new control
  5803. * @param name defines the control name
  5804. */
  5805. constructor(
  5806. /** Defines the control name */
  5807. name?: string | undefined);
  5808. /**
  5809. * Gets a string representing the class name
  5810. */
  5811. readonly typeName: string;
  5812. /**
  5813. * Get the current class name of the control.
  5814. * @returns current class name
  5815. */
  5816. getClassName(): string;
  5817. protected _getTypeName(): string;
  5818. /**
  5819. * Gets the transform node used by this control
  5820. */
  5821. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  5822. /**
  5823. * Gets the mesh used to render this control
  5824. */
  5825. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  5826. /**
  5827. * Link the control as child of the given node
  5828. * @param node defines the node to link to. Use null to unlink the control
  5829. * @returns the current control
  5830. */
  5831. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  5832. /** @hidden **/
  5833. _prepareNode(scene: BABYLON.Scene): void;
  5834. /**
  5835. * Node creation.
  5836. * Can be overriden by children
  5837. * @param scene defines the scene where the node must be attached
  5838. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  5839. */
  5840. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5841. /**
  5842. * Affect a material to the given mesh
  5843. * @param mesh defines the mesh which will represent the control
  5844. */
  5845. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5846. /** @hidden */
  5847. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  5848. /** @hidden */
  5849. _onPointerEnter(target: Control3D): boolean;
  5850. /** @hidden */
  5851. _onPointerOut(target: Control3D): void;
  5852. /** @hidden */
  5853. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5854. /** @hidden */
  5855. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5856. /** @hidden */
  5857. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  5858. /** @hidden */
  5859. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5860. /** @hidden */
  5861. _disposeNode(): void;
  5862. /**
  5863. * Releases all associated resources
  5864. */
  5865. dispose(): void;
  5866. }
  5867. }
  5868. declare module BABYLON.GUI {
  5869. /**
  5870. * Class used to create a container panel deployed on the surface of a cylinder
  5871. */
  5872. export class CylinderPanel extends VolumeBasedPanel {
  5873. /**
  5874. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  5875. */
  5876. radius: BABYLON.float;
  5877. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5878. }
  5879. }
  5880. declare module BABYLON.GUI {
  5881. /**
  5882. * Class used to create a holographic button in 3D
  5883. */
  5884. export class HolographicButton extends Button3D {
  5885. /**
  5886. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  5887. */
  5888. tooltipText: BABYLON.Nullable<string>;
  5889. /**
  5890. * Gets or sets text for the button
  5891. */
  5892. text: string;
  5893. /**
  5894. * Gets or sets the image url for the button
  5895. */
  5896. imageUrl: string;
  5897. /**
  5898. * Gets the back material used by this button
  5899. */
  5900. readonly backMaterial: FluentMaterial;
  5901. /**
  5902. * Gets the front material used by this button
  5903. */
  5904. readonly frontMaterial: FluentMaterial;
  5905. /**
  5906. * Gets the plate material used by this button
  5907. */
  5908. readonly plateMaterial: BABYLON.StandardMaterial;
  5909. /**
  5910. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  5911. */
  5912. readonly shareMaterials: boolean;
  5913. /**
  5914. * Creates a new button
  5915. * @param name defines the control name
  5916. */
  5917. constructor(name?: string, shareMaterials?: boolean);
  5918. protected _getTypeName(): string;
  5919. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5920. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5921. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  5922. /**
  5923. * Releases all associated resources
  5924. */
  5925. dispose(): void;
  5926. }
  5927. }
  5928. declare module BABYLON.GUI {
  5929. /**
  5930. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  5931. */
  5932. export class MeshButton3D extends Button3D {
  5933. /** @hidden */
  5934. protected _currentMesh: BABYLON.Mesh;
  5935. /**
  5936. * Creates a new 3D button based on a mesh
  5937. * @param mesh mesh to become a 3D button
  5938. * @param name defines the control name
  5939. */
  5940. constructor(mesh: BABYLON.Mesh, name?: string);
  5941. protected _getTypeName(): string;
  5942. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5943. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5944. }
  5945. }
  5946. declare module BABYLON.GUI {
  5947. /**
  5948. * Class used to create a container panel deployed on the surface of a plane
  5949. */
  5950. export class PlanePanel extends VolumeBasedPanel {
  5951. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5952. }
  5953. }
  5954. declare module BABYLON.GUI {
  5955. /**
  5956. * Class used to create a container panel where items get randomized planar mapping
  5957. */
  5958. export class ScatterPanel extends VolumeBasedPanel {
  5959. /**
  5960. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  5961. */
  5962. iteration: BABYLON.float;
  5963. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5964. protected _finalProcessing(): void;
  5965. }
  5966. }
  5967. declare module BABYLON.GUI {
  5968. /**
  5969. * Class used to create a container panel deployed on the surface of a sphere
  5970. */
  5971. export class SpherePanel extends VolumeBasedPanel {
  5972. /**
  5973. * Gets or sets the radius of the sphere where to project controls (5 by default)
  5974. */
  5975. radius: BABYLON.float;
  5976. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5977. }
  5978. }
  5979. declare module BABYLON.GUI {
  5980. /**
  5981. * Class used to create a stack panel in 3D on XY plane
  5982. */
  5983. export class StackPanel3D extends Container3D {
  5984. /**
  5985. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  5986. */
  5987. isVertical: boolean;
  5988. /**
  5989. * Gets or sets the distance between elements
  5990. */
  5991. margin: number;
  5992. /**
  5993. * Creates new StackPanel
  5994. * @param isVertical
  5995. */
  5996. constructor(isVertical?: boolean);
  5997. protected _arrangeChildren(): void;
  5998. }
  5999. }
  6000. declare module BABYLON.GUI {
  6001. /**
  6002. * Abstract class used to create a container panel deployed on the surface of a volume
  6003. */
  6004. export abstract class VolumeBasedPanel extends Container3D {
  6005. protected _cellWidth: number;
  6006. protected _cellHeight: number;
  6007. /**
  6008. * Gets or sets the distance between elements
  6009. */
  6010. margin: number;
  6011. /**
  6012. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  6013. * | Value | Type | Description |
  6014. * | ----- | ----------------------------------- | ----------- |
  6015. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  6016. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  6017. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  6018. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  6019. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  6020. */
  6021. orientation: number;
  6022. /**
  6023. * Gets or sets the number of columns requested (10 by default).
  6024. * The panel will automatically compute the number of rows based on number of child controls.
  6025. */
  6026. columns: BABYLON.int;
  6027. /**
  6028. * Gets or sets a the number of rows requested.
  6029. * The panel will automatically compute the number of columns based on number of child controls.
  6030. */
  6031. rows: BABYLON.int;
  6032. /**
  6033. * Creates new VolumeBasedPanel
  6034. */
  6035. constructor();
  6036. protected _arrangeChildren(): void;
  6037. /** Child classes must implement this function to provide correct control positioning */
  6038. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  6039. /** Child classes can implement this function to provide additional processing */
  6040. protected _finalProcessing(): void;
  6041. }
  6042. }
  6043. declare module BABYLON.GUI {
  6044. /** @hidden */
  6045. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  6046. INNERGLOW: boolean;
  6047. BORDER: boolean;
  6048. HOVERLIGHT: boolean;
  6049. TEXTURE: boolean;
  6050. constructor();
  6051. }
  6052. /**
  6053. * Class used to render controls with fluent desgin
  6054. */
  6055. export class FluentMaterial extends BABYLON.PushMaterial {
  6056. /**
  6057. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  6058. */
  6059. innerGlowColorIntensity: number;
  6060. /**
  6061. * Gets or sets the inner glow color (white by default)
  6062. */
  6063. innerGlowColor: BABYLON.Color3;
  6064. /**
  6065. * Gets or sets alpha value (default is 1.0)
  6066. */
  6067. alpha: number;
  6068. /**
  6069. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  6070. */
  6071. albedoColor: BABYLON.Color3;
  6072. /**
  6073. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  6074. */
  6075. renderBorders: boolean;
  6076. /**
  6077. * Gets or sets border width (default is 0.5)
  6078. */
  6079. borderWidth: number;
  6080. /**
  6081. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  6082. */
  6083. edgeSmoothingValue: number;
  6084. /**
  6085. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  6086. */
  6087. borderMinValue: number;
  6088. /**
  6089. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  6090. */
  6091. renderHoverLight: boolean;
  6092. /**
  6093. * Gets or sets the radius used to render the hover light (default is 1.0)
  6094. */
  6095. hoverRadius: number;
  6096. /**
  6097. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  6098. */
  6099. hoverColor: BABYLON.Color4;
  6100. /**
  6101. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  6102. */
  6103. hoverPosition: BABYLON.Vector3;
  6104. /** Gets or sets the texture to use for albedo color */
  6105. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  6106. /**
  6107. * Creates a new Fluent material
  6108. * @param name defines the name of the material
  6109. * @param scene defines the hosting scene
  6110. */
  6111. constructor(name: string, scene: BABYLON.Scene);
  6112. needAlphaBlending(): boolean;
  6113. needAlphaTesting(): boolean;
  6114. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  6115. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  6116. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  6117. getActiveTextures(): BABYLON.BaseTexture[];
  6118. hasTexture(texture: BABYLON.BaseTexture): boolean;
  6119. dispose(forceDisposeEffect?: boolean): void;
  6120. clone(name: string): FluentMaterial;
  6121. serialize(): any;
  6122. getClassName(): string;
  6123. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  6124. }
  6125. }