babylon.gui.module.d.ts 219 KB

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