babylon.gui.module.d.ts 243 KB

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