babylon.gui.module.d.ts 259 KB

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