babylon.gui.module.d.ts 276 KB

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