babylon.gui.module.d.ts 224 KB

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