babylon.gui.module.d.ts 256 KB

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