babylon.gui.module.d.ts 274 KB

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