babylon.gui.module.d.ts 254 KB

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