babylon.gui.module.d.ts 279 KB

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