babylon.gui.module.d.ts 277 KB

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