babylon.gui.d.ts 186 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558
  1. declare module BABYLON.GUI {
  2. /**
  3. * Interface used to define a control that can receive focus
  4. */
  5. export interface IFocusableControl {
  6. /**
  7. * Function called when the control receives the focus
  8. */
  9. onFocus(): void;
  10. /**
  11. * Function called when the control loses the focus
  12. */
  13. onBlur(): void;
  14. /**
  15. * Function called to let the control handle keyboard events
  16. * @param evt defines the current keyboard event
  17. */
  18. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  19. /**
  20. * Function called to get the list of controls that should not steal the focus from this control
  21. * @returns an array of controls
  22. */
  23. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  24. /**
  25. * Function to focus the control programmatically
  26. */
  27. focus(): void;
  28. /**
  29. * Function to unfocus the control programmatically
  30. */
  31. blur(): void;
  32. }
  33. }
  34. declare module BABYLON.GUI {
  35. /**
  36. * Class used to specific a value and its associated unit
  37. */
  38. export class ValueAndUnit {
  39. /** defines the unit to store */
  40. unit: number;
  41. /** defines a boolean indicating if the value can be negative */
  42. negativeValueAllowed: boolean;
  43. private _value;
  44. private _originalUnit;
  45. /**
  46. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  47. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  48. */
  49. ignoreAdaptiveScaling: boolean;
  50. /**
  51. * Creates a new ValueAndUnit
  52. * @param value defines the value to store
  53. * @param unit defines the unit to store
  54. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  55. */
  56. constructor(value: number,
  57. /** defines the unit to store */
  58. unit?: number,
  59. /** defines a boolean indicating if the value can be negative */
  60. negativeValueAllowed?: boolean);
  61. /** Gets a boolean indicating if the value is a percentage */
  62. get isPercentage(): boolean;
  63. /** Gets a boolean indicating if the value is store as pixel */
  64. get isPixel(): boolean;
  65. /** Gets direct internal value */
  66. get internalValue(): number;
  67. /**
  68. * Gets value as pixel
  69. * @param host defines the root host
  70. * @param refValue defines the reference value for percentages
  71. * @returns the value as pixel
  72. */
  73. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  74. /**
  75. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  76. * @param value defines the value to store
  77. * @param unit defines the unit to store
  78. * @returns the current ValueAndUnit
  79. */
  80. updateInPlace(value: number, unit?: number): ValueAndUnit;
  81. /**
  82. * Gets the value accordingly to its unit
  83. * @param host defines the root host
  84. * @returns the value
  85. */
  86. getValue(host: AdvancedDynamicTexture): number;
  87. /**
  88. * Gets a string representation of the value
  89. * @param host defines the root host
  90. * @param decimals defines an optional number of decimals to display
  91. * @returns a string
  92. */
  93. toString(host: AdvancedDynamicTexture, decimals?: number): string;
  94. /**
  95. * Store a value parsed from a string
  96. * @param source defines the source string
  97. * @returns true if the value was successfully parsed
  98. */
  99. fromString(source: string | number): boolean;
  100. private static _Regex;
  101. private static _UNITMODE_PERCENTAGE;
  102. private static _UNITMODE_PIXEL;
  103. /** UNITMODE_PERCENTAGE */
  104. static get UNITMODE_PERCENTAGE(): number;
  105. /** UNITMODE_PIXEL */
  106. static get UNITMODE_PIXEL(): number;
  107. }
  108. }
  109. declare module BABYLON.GUI {
  110. /**
  111. * Define a style used by control to automatically setup properties based on a template.
  112. * Only support font related properties so far
  113. */
  114. export class Style implements BABYLON.IDisposable {
  115. private _fontFamily;
  116. private _fontStyle;
  117. private _fontWeight;
  118. /** @hidden */
  119. _host: AdvancedDynamicTexture;
  120. /** @hidden */
  121. _fontSize: ValueAndUnit;
  122. /**
  123. * BABYLON.Observable raised when the style values are changed
  124. */
  125. onChangedObservable: BABYLON.Observable<Style>;
  126. /**
  127. * Creates a new style object
  128. * @param host defines the AdvancedDynamicTexture which hosts this style
  129. */
  130. constructor(host: AdvancedDynamicTexture);
  131. /**
  132. * Gets or sets the font size
  133. */
  134. get fontSize(): string | number;
  135. set fontSize(value: string | number);
  136. /**
  137. * Gets or sets the font family
  138. */
  139. get fontFamily(): string;
  140. set fontFamily(value: string);
  141. /**
  142. * Gets or sets the font style
  143. */
  144. get fontStyle(): string;
  145. set fontStyle(value: string);
  146. /** Gets or sets font weight */
  147. get fontWeight(): string;
  148. set fontWeight(value: string);
  149. /** Dispose all associated resources */
  150. dispose(): void;
  151. }
  152. }
  153. declare module BABYLON.GUI {
  154. /**
  155. * Class used to transport BABYLON.Vector2 information for pointer events
  156. */
  157. export class Vector2WithInfo extends BABYLON.Vector2 {
  158. /** defines the current mouse button index */
  159. buttonIndex: number;
  160. /**
  161. * Creates a new Vector2WithInfo
  162. * @param source defines the vector2 data to transport
  163. * @param buttonIndex defines the current mouse button index
  164. */
  165. constructor(source: BABYLON.Vector2,
  166. /** defines the current mouse button index */
  167. buttonIndex?: number);
  168. }
  169. /** Class used to provide 2D matrix features */
  170. export class Matrix2D {
  171. /** Gets the internal array of 6 floats used to store matrix data */
  172. m: Float32Array;
  173. /**
  174. * Creates a new matrix
  175. * @param m00 defines value for (0, 0)
  176. * @param m01 defines value for (0, 1)
  177. * @param m10 defines value for (1, 0)
  178. * @param m11 defines value for (1, 1)
  179. * @param m20 defines value for (2, 0)
  180. * @param m21 defines value for (2, 1)
  181. */
  182. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  183. /**
  184. * Fills the matrix from direct values
  185. * @param m00 defines value for (0, 0)
  186. * @param m01 defines value for (0, 1)
  187. * @param m10 defines value for (1, 0)
  188. * @param m11 defines value for (1, 1)
  189. * @param m20 defines value for (2, 0)
  190. * @param m21 defines value for (2, 1)
  191. * @returns the current modified matrix
  192. */
  193. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  194. /**
  195. * Gets matrix determinant
  196. * @returns the determinant
  197. */
  198. determinant(): number;
  199. /**
  200. * Inverses the matrix and stores it in a target matrix
  201. * @param result defines the target matrix
  202. * @returns the current matrix
  203. */
  204. invertToRef(result: Matrix2D): Matrix2D;
  205. /**
  206. * Multiplies the current matrix with another one
  207. * @param other defines the second operand
  208. * @param result defines the target matrix
  209. * @returns the current matrix
  210. */
  211. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  212. /**
  213. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  214. * @param x defines the x coordinate to transform
  215. * @param y defines the x coordinate to transform
  216. * @param result defines the target vector2
  217. * @returns the current matrix
  218. */
  219. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  220. /**
  221. * Creates an identity matrix
  222. * @returns a new matrix
  223. */
  224. static Identity(): Matrix2D;
  225. /**
  226. * Creates a translation matrix and stores it in a target matrix
  227. * @param x defines the x coordinate of the translation
  228. * @param y defines the y coordinate of the translation
  229. * @param result defines the target matrix
  230. */
  231. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  232. /**
  233. * Creates a scaling matrix and stores it in a target matrix
  234. * @param x defines the x coordinate of the scaling
  235. * @param y defines the y coordinate of the scaling
  236. * @param result defines the target matrix
  237. */
  238. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  239. /**
  240. * Creates a rotation matrix and stores it in a target matrix
  241. * @param angle defines the rotation angle
  242. * @param result defines the target matrix
  243. */
  244. static RotationToRef(angle: number, result: Matrix2D): void;
  245. private static _TempPreTranslationMatrix;
  246. private static _TempPostTranslationMatrix;
  247. private static _TempRotationMatrix;
  248. private static _TempScalingMatrix;
  249. private static _TempCompose0;
  250. private static _TempCompose1;
  251. private static _TempCompose2;
  252. /**
  253. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  254. * @param tx defines the x coordinate of the translation
  255. * @param ty defines the y coordinate of the translation
  256. * @param angle defines the rotation angle
  257. * @param scaleX defines the x coordinate of the scaling
  258. * @param scaleY defines the y coordinate of the scaling
  259. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  260. * @param result defines the target matrix
  261. */
  262. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  263. }
  264. }
  265. declare module BABYLON.GUI {
  266. /**
  267. * Class used to store 2D control sizes
  268. */
  269. export class Measure {
  270. /** defines left coordinate */
  271. left: number;
  272. /** defines top coordinate */
  273. top: number;
  274. /** defines width dimension */
  275. width: number;
  276. /** defines height dimension */
  277. height: number;
  278. /**
  279. * Creates a new measure
  280. * @param left defines left coordinate
  281. * @param top defines top coordinate
  282. * @param width defines width dimension
  283. * @param height defines height dimension
  284. */
  285. constructor(
  286. /** defines left coordinate */
  287. left: number,
  288. /** defines top coordinate */
  289. top: number,
  290. /** defines width dimension */
  291. width: number,
  292. /** defines height dimension */
  293. height: number);
  294. /**
  295. * Copy from another measure
  296. * @param other defines the other measure to copy from
  297. */
  298. copyFrom(other: Measure): void;
  299. /**
  300. * Copy from a group of 4 floats
  301. * @param left defines left coordinate
  302. * @param top defines top coordinate
  303. * @param width defines width dimension
  304. * @param height defines height dimension
  305. */
  306. copyFromFloats(left: number, top: number, width: number, height: number): void;
  307. /**
  308. * Computes the axis aligned bounding box measure for two given measures
  309. * @param a Input measure
  310. * @param b Input measure
  311. * @param result the resulting bounding measure
  312. */
  313. static CombineToRef(a: Measure, b: Measure, result: Measure): void;
  314. /**
  315. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  316. * @param transform the matrix to transform the measure before computing the AABB
  317. * @param addX number to add to left
  318. * @param addY number to add to top
  319. * @param addWidth number to add to width
  320. * @param addHeight number to add to height
  321. * @param result the resulting AABB
  322. */
  323. addAndTransformToRef(transform: Matrix2D, addX: number, addY: number, addWidth: number, addHeight: number, result: Measure): void;
  324. /**
  325. * Computes the axis aligned bounding box of the measure after it is modified by a given transform
  326. * @param transform the matrix to transform the measure before computing the AABB
  327. * @param result the resulting AABB
  328. */
  329. transformToRef(transform: Matrix2D, result: Measure): void;
  330. /**
  331. * Check equality between this measure and another one
  332. * @param other defines the other measures
  333. * @returns true if both measures are equals
  334. */
  335. isEqualsTo(other: Measure): boolean;
  336. /**
  337. * Creates an empty measure
  338. * @returns a new measure
  339. */
  340. static Empty(): Measure;
  341. }
  342. }
  343. declare module BABYLON.GUI {
  344. /**
  345. * Class used to create texture to support 2D GUI elements
  346. * @see https://doc.babylonjs.com/how_to/gui
  347. */
  348. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  349. /** Define the Uurl to load snippets */
  350. static SnippetUrl: string;
  351. /** Snippet ID if the content was created from the snippet server */
  352. snippetId: string;
  353. private _isDirty;
  354. private _renderObserver;
  355. private _resizeObserver;
  356. private _preKeyboardObserver;
  357. private _pointerMoveObserver;
  358. private _pointerObserver;
  359. private _canvasPointerOutObserver;
  360. private _canvasBlurObserver;
  361. private _background;
  362. /** @hidden */
  363. _rootContainer: Container;
  364. /** @hidden */
  365. _lastPickedControl: Control;
  366. /** @hidden */
  367. _lastControlOver: {
  368. [pointerId: number]: Control;
  369. };
  370. /** @hidden */
  371. _lastControlDown: {
  372. [pointerId: number]: Control;
  373. };
  374. /** @hidden */
  375. _capturingControl: {
  376. [pointerId: number]: Control;
  377. };
  378. /** @hidden */
  379. _shouldBlockPointer: boolean;
  380. /** @hidden */
  381. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  382. /** @hidden */
  383. _linkedControls: Control[];
  384. private _isFullscreen;
  385. private _fullscreenViewport;
  386. private _idealWidth;
  387. private _idealHeight;
  388. private _useSmallestIdeal;
  389. private _renderAtIdealSize;
  390. private _focusedControl;
  391. private _blockNextFocusCheck;
  392. private _renderScale;
  393. private _rootElement;
  394. private _cursorChanged;
  395. private _defaultMousePointerId;
  396. /** @hidden */
  397. _numLayoutCalls: number;
  398. /** Gets the number of layout calls made the last time the ADT has been rendered */
  399. get numLayoutCalls(): number;
  400. /** @hidden */
  401. _numRenderCalls: number;
  402. /** Gets the number of render calls made the last time the ADT has been rendered */
  403. get numRenderCalls(): number;
  404. /**
  405. * Define type to string to ensure compatibility across browsers
  406. * Safari doesn't support DataTransfer constructor
  407. */
  408. private _clipboardData;
  409. /**
  410. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  411. */
  412. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  413. /**
  414. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  415. */
  416. onControlPickedObservable: BABYLON.Observable<Control>;
  417. /**
  418. * BABYLON.Observable event triggered before layout is evaluated
  419. */
  420. onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  421. /**
  422. * BABYLON.Observable event triggered after the layout was evaluated
  423. */
  424. onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  425. /**
  426. * BABYLON.Observable event triggered before the texture is rendered
  427. */
  428. onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  429. /**
  430. * BABYLON.Observable event triggered after the texture was rendered
  431. */
  432. onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  433. /**
  434. * Gets or sets a boolean defining if alpha is stored as premultiplied
  435. */
  436. premulAlpha: boolean;
  437. /**
  438. * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
  439. */
  440. applyYInversionOnUpdate: boolean;
  441. /**
  442. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  443. * Useful when you want more antialiasing
  444. */
  445. get renderScale(): number;
  446. set renderScale(value: number);
  447. /** Gets or sets the background color */
  448. get background(): string;
  449. set background(value: string);
  450. /**
  451. * Gets or sets the ideal width used to design controls.
  452. * The GUI will then rescale everything accordingly
  453. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  454. */
  455. get idealWidth(): number;
  456. set idealWidth(value: number);
  457. /**
  458. * Gets or sets the ideal height used to design controls.
  459. * The GUI will then rescale everything accordingly
  460. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  461. */
  462. get idealHeight(): number;
  463. set idealHeight(value: number);
  464. /**
  465. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  466. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  467. */
  468. get useSmallestIdeal(): boolean;
  469. set useSmallestIdeal(value: boolean);
  470. /**
  471. * Gets or sets a boolean indicating if adaptive scaling must be used
  472. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  473. */
  474. get renderAtIdealSize(): boolean;
  475. set renderAtIdealSize(value: boolean);
  476. /**
  477. * Gets the ratio used when in "ideal mode"
  478. * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
  479. * */
  480. get idealRatio(): number;
  481. /**
  482. * Gets the underlying layer used to render the texture when in fullscreen mode
  483. */
  484. get layer(): BABYLON.Nullable<BABYLON.Layer>;
  485. /**
  486. * Gets the root container control
  487. */
  488. get rootContainer(): Container;
  489. /**
  490. * Returns an array containing the root container.
  491. * This is mostly used to let the Inspector introspects the ADT
  492. * @returns an array containing the rootContainer
  493. */
  494. getChildren(): Array<Container>;
  495. /**
  496. * Will return all controls that are inside this texture
  497. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  498. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  499. * @return all child controls
  500. */
  501. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  502. /**
  503. * Gets or sets the current focused control
  504. */
  505. get focusedControl(): BABYLON.Nullable<IFocusableControl>;
  506. set focusedControl(control: BABYLON.Nullable<IFocusableControl>);
  507. /**
  508. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  509. */
  510. get isForeground(): boolean;
  511. set isForeground(value: boolean);
  512. /**
  513. * Gets or set information about clipboardData
  514. */
  515. get clipboardData(): string;
  516. set clipboardData(value: string);
  517. /**
  518. * Creates a new AdvancedDynamicTexture
  519. * @param name defines the name of the texture
  520. * @param width defines the width of the texture
  521. * @param height defines the height of the texture
  522. * @param scene defines the hosting scene
  523. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  524. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  525. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  526. */
  527. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
  528. /**
  529. * Get the current class name of the texture useful for serialization or dynamic coding.
  530. * @returns "AdvancedDynamicTexture"
  531. */
  532. getClassName(): string;
  533. /**
  534. * Function used to execute a function on all controls
  535. * @param func defines the function to execute
  536. * @param container defines the container where controls belong. If null the root container will be used
  537. */
  538. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  539. private _useInvalidateRectOptimization;
  540. /**
  541. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  542. */
  543. get useInvalidateRectOptimization(): boolean;
  544. set useInvalidateRectOptimization(value: boolean);
  545. private _invalidatedRectangle;
  546. /**
  547. * Invalidates a rectangle area on the gui texture
  548. * @param invalidMinX left most position of the rectangle to invalidate in the texture
  549. * @param invalidMinY top most position of the rectangle to invalidate in the texture
  550. * @param invalidMaxX right most position of the rectangle to invalidate in the texture
  551. * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
  552. */
  553. invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
  554. /**
  555. * Marks the texture as dirty forcing a complete update
  556. */
  557. markAsDirty(): void;
  558. /**
  559. * Helper function used to create a new style
  560. * @returns a new style
  561. * @see https://doc.babylonjs.com/how_to/gui#styles
  562. */
  563. createStyle(): Style;
  564. /**
  565. * Adds a new control to the root container
  566. * @param control defines the control to add
  567. * @returns the current texture
  568. */
  569. addControl(control: Control): AdvancedDynamicTexture;
  570. /**
  571. * Removes a control from the root container
  572. * @param control defines the control to remove
  573. * @returns the current texture
  574. */
  575. removeControl(control: Control): AdvancedDynamicTexture;
  576. /**
  577. * Release all resources
  578. */
  579. dispose(): void;
  580. private _onResize;
  581. /** @hidden */
  582. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  583. /**
  584. * Get screen coordinates for a vector3
  585. * @param position defines the position to project
  586. * @param worldMatrix defines the world matrix to use
  587. * @returns the projected position
  588. */
  589. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  590. /**
  591. * Get screen coordinates for a vector3
  592. * @param position defines the position to project
  593. * @param worldMatrix defines the world matrix to use
  594. * @returns the projected position with Z
  595. */
  596. getProjectedPositionWithZ(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector3;
  597. private _checkUpdate;
  598. private _clearMeasure;
  599. private _render;
  600. /** @hidden */
  601. _changeCursor(cursor: string): void;
  602. /** @hidden */
  603. _registerLastControlDown(control: Control, pointerId: number): void;
  604. private _doPicking;
  605. /** @hidden */
  606. _cleanControlAfterRemovalFromList(list: {
  607. [pointerId: number]: Control;
  608. }, control: Control): void;
  609. /** @hidden */
  610. _cleanControlAfterRemoval(control: Control): void;
  611. /** Attach to all scene events required to support pointer events */
  612. attach(): void;
  613. /** @hidden */
  614. private onClipboardCopy;
  615. /** @hidden */
  616. private onClipboardCut;
  617. /** @hidden */
  618. private onClipboardPaste;
  619. /**
  620. * Register the clipboard Events onto the canvas
  621. */
  622. registerClipboardEvents(): void;
  623. /**
  624. * Unregister the clipboard Events from the canvas
  625. */
  626. unRegisterClipboardEvents(): void;
  627. /**
  628. * Connect the texture to a hosting mesh to enable interactions
  629. * @param mesh defines the mesh to attach to
  630. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  631. */
  632. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  633. /**
  634. * Move the focus to a specific control
  635. * @param control defines the control which will receive the focus
  636. */
  637. moveFocusToControl(control: IFocusableControl): void;
  638. private _manageFocus;
  639. private _attachToOnPointerOut;
  640. private _attachToOnBlur;
  641. /**
  642. * Serializes the entire GUI system
  643. * @returns an object with the JSON serialized data
  644. */
  645. serializeContent(): any;
  646. /**
  647. * Recreate the content of the ADT from a JSON object
  648. * @param serializedObject define the JSON serialized object to restore from
  649. */
  650. parseContent(serializedObject: any): void;
  651. /**
  652. * Recreate the content of the ADT from a snippet saved by the GUI editor
  653. * @param snippetId defines the snippet to load
  654. * @returns a promise that will resolve on success
  655. */
  656. parseFromSnippetAsync(snippetId: string): Promise<void>;
  657. /**
  658. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  659. * @param mesh defines the mesh which will receive the texture
  660. * @param width defines the texture width (1024 by default)
  661. * @param height defines the texture height (1024 by default)
  662. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  663. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  664. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  665. * @returns a new AdvancedDynamicTexture
  666. */
  667. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  668. /**
  669. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture
  670. * @param mesh defines the mesh which will receive the texture
  671. * @param width defines the texture width (1024 by default)
  672. * @param height defines the texture height (1024 by default)
  673. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  674. * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
  675. * @returns a new AdvancedDynamicTexture
  676. */
  677. static CreateForMeshTexture(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, invertY?: boolean): AdvancedDynamicTexture;
  678. /**
  679. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  680. * In this mode the texture will rely on a layer for its rendering.
  681. * This allows it to be treated like any other layer.
  682. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  683. * LayerMask is set through advancedTexture.layer.layerMask
  684. * @param name defines name for the texture
  685. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  686. * @param scene defines the hsoting scene
  687. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  688. * @returns a new AdvancedDynamicTexture
  689. */
  690. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  691. }
  692. }
  693. declare module BABYLON.GUI {
  694. /**
  695. * Root class used for all 2D controls
  696. * @see https://doc.babylonjs.com/how_to/gui#controls
  697. */
  698. export class Control {
  699. /** defines the name of the control */
  700. name?: string | undefined;
  701. /**
  702. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  703. */
  704. static AllowAlphaInheritance: boolean;
  705. private _alpha;
  706. private _alphaSet;
  707. private _zIndex;
  708. /** @hidden */
  709. _host: AdvancedDynamicTexture;
  710. /** Gets or sets the control parent */
  711. parent: BABYLON.Nullable<Container>;
  712. /** @hidden */
  713. _currentMeasure: Measure;
  714. private _fontFamily;
  715. private _fontStyle;
  716. private _fontWeight;
  717. private _fontSize;
  718. private _font;
  719. /** @hidden */
  720. _width: ValueAndUnit;
  721. /** @hidden */
  722. _height: ValueAndUnit;
  723. /** @hidden */
  724. protected _fontOffset: {
  725. ascent: number;
  726. height: number;
  727. descent: number;
  728. };
  729. private _color;
  730. private _style;
  731. private _styleObserver;
  732. /** @hidden */
  733. protected _horizontalAlignment: number;
  734. /** @hidden */
  735. protected _verticalAlignment: number;
  736. /** @hidden */
  737. protected _isDirty: boolean;
  738. /** @hidden */
  739. protected _wasDirty: boolean;
  740. /** @hidden */
  741. _tempParentMeasure: Measure;
  742. /** @hidden */
  743. _prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
  744. /** @hidden */
  745. protected _cachedParentMeasure: Measure;
  746. private _paddingLeft;
  747. private _paddingRight;
  748. private _paddingTop;
  749. private _paddingBottom;
  750. /** @hidden */
  751. _left: ValueAndUnit;
  752. /** @hidden */
  753. _top: ValueAndUnit;
  754. private _scaleX;
  755. private _scaleY;
  756. private _rotation;
  757. private _transformCenterX;
  758. private _transformCenterY;
  759. /** @hidden */
  760. _transformMatrix: Matrix2D;
  761. /** @hidden */
  762. protected _invertTransformMatrix: Matrix2D;
  763. /** @hidden */
  764. protected _transformedPosition: BABYLON.Vector2;
  765. private _isMatrixDirty;
  766. private _cachedOffsetX;
  767. private _cachedOffsetY;
  768. private _isVisible;
  769. private _isHighlighted;
  770. /** @hidden */
  771. _linkedMesh: BABYLON.Nullable<BABYLON.TransformNode>;
  772. private _fontSet;
  773. private _dummyVector2;
  774. private _downCount;
  775. private _enterCount;
  776. private _doNotRender;
  777. private _downPointerIds;
  778. protected _isEnabled: boolean;
  779. protected _disabledColor: string;
  780. protected _disabledColorItem: string;
  781. /** @hidden */
  782. protected _rebuildLayout: boolean;
  783. /** @hidden */
  784. _customData: any;
  785. /** @hidden */
  786. _isClipped: boolean;
  787. /** @hidden */
  788. _automaticSize: boolean;
  789. /** @hidden */
  790. _tag: any;
  791. /**
  792. * Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
  793. */
  794. uniqueId: number;
  795. /**
  796. * Gets or sets an object used to store user defined information for the node
  797. */
  798. metadata: any;
  799. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  800. isHitTestVisible: boolean;
  801. /** Gets or sets a boolean indicating if the control can block pointer events */
  802. isPointerBlocker: boolean;
  803. /** Gets or sets a boolean indicating if the control can be focusable */
  804. isFocusInvisible: boolean;
  805. /**
  806. * Gets or sets a boolean indicating if the children are clipped to the current control bounds.
  807. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  808. */
  809. clipChildren: boolean;
  810. /**
  811. * Gets or sets a boolean indicating that control content must be clipped
  812. * Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
  813. */
  814. clipContent: boolean;
  815. /**
  816. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  817. */
  818. useBitmapCache: boolean;
  819. private _cacheData;
  820. private _shadowOffsetX;
  821. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  822. get shadowOffsetX(): number;
  823. set shadowOffsetX(value: number);
  824. private _shadowOffsetY;
  825. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  826. get shadowOffsetY(): number;
  827. set shadowOffsetY(value: number);
  828. private _shadowBlur;
  829. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  830. get shadowBlur(): number;
  831. set shadowBlur(value: number);
  832. private _shadowColor;
  833. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  834. get shadowColor(): string;
  835. set shadowColor(value: string);
  836. /** Gets or sets the cursor to use when the control is hovered */
  837. hoverCursor: string;
  838. /** @hidden */
  839. protected _linkOffsetX: ValueAndUnit;
  840. /** @hidden */
  841. protected _linkOffsetY: ValueAndUnit;
  842. /** Gets the control type name */
  843. get typeName(): string;
  844. /**
  845. * Get the current class name of the control.
  846. * @returns current class name
  847. */
  848. getClassName(): string;
  849. /**
  850. * An event triggered when pointer wheel is scrolled
  851. */
  852. onWheelObservable: BABYLON.Observable<BABYLON.Vector2>;
  853. /**
  854. * An event triggered when the pointer move over the control.
  855. */
  856. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  857. /**
  858. * An event triggered when the pointer move out of the control.
  859. */
  860. onPointerOutObservable: BABYLON.Observable<Control>;
  861. /**
  862. * An event triggered when the pointer taps the control
  863. */
  864. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  865. /**
  866. * An event triggered when pointer up
  867. */
  868. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  869. /**
  870. * An event triggered when a control is clicked on
  871. */
  872. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  873. /**
  874. * An event triggered when pointer enters the control
  875. */
  876. onPointerEnterObservable: BABYLON.Observable<Control>;
  877. /**
  878. * An event triggered when the control is marked as dirty
  879. */
  880. onDirtyObservable: BABYLON.Observable<Control>;
  881. /**
  882. * An event triggered before drawing the control
  883. */
  884. onBeforeDrawObservable: BABYLON.Observable<Control>;
  885. /**
  886. * An event triggered after the control was drawn
  887. */
  888. onAfterDrawObservable: BABYLON.Observable<Control>;
  889. /**
  890. * An event triggered when the control has been disposed
  891. */
  892. onDisposeObservable: BABYLON.Observable<Control>;
  893. /**
  894. * Get the hosting AdvancedDynamicTexture
  895. */
  896. get host(): AdvancedDynamicTexture;
  897. /** Gets or set information about font offsets (used to render and align text) */
  898. get fontOffset(): {
  899. ascent: number;
  900. height: number;
  901. descent: number;
  902. };
  903. set fontOffset(offset: {
  904. ascent: number;
  905. height: number;
  906. descent: number;
  907. });
  908. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  909. get alpha(): number;
  910. set alpha(value: number);
  911. /**
  912. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  913. */
  914. get isHighlighted(): boolean;
  915. set isHighlighted(value: boolean);
  916. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  917. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  918. */
  919. get scaleX(): number;
  920. set scaleX(value: number);
  921. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  922. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  923. */
  924. get scaleY(): number;
  925. set scaleY(value: number);
  926. /** Gets or sets the rotation angle (0 by default)
  927. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  928. */
  929. get rotation(): number;
  930. set rotation(value: number);
  931. /** Gets or sets the transformation center on Y axis (0 by default)
  932. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  933. */
  934. get transformCenterY(): number;
  935. set transformCenterY(value: number);
  936. /** Gets or sets the transformation center on X axis (0 by default)
  937. * @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  938. */
  939. get transformCenterX(): number;
  940. set transformCenterX(value: number);
  941. /**
  942. * Gets or sets the horizontal alignment
  943. * @see https://doc.babylonjs.com/how_to/gui#alignments
  944. */
  945. get horizontalAlignment(): number;
  946. set horizontalAlignment(value: number);
  947. /**
  948. * Gets or sets the vertical alignment
  949. * @see https://doc.babylonjs.com/how_to/gui#alignments
  950. */
  951. get verticalAlignment(): number;
  952. set verticalAlignment(value: number);
  953. /**
  954. * Gets or sets a fixed ratio for this control.
  955. * When different from 0, the ratio is used to compute the "second" dimension.
  956. * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
  957. * second dimension is computed as first dimension * fixedRatio
  958. */
  959. fixedRatio: number;
  960. private _fixedRatioMasterIsWidth;
  961. /**
  962. * Gets or sets control width
  963. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  964. */
  965. get width(): string | number;
  966. set width(value: string | number);
  967. /**
  968. * Gets or sets the control width in pixel
  969. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  970. */
  971. get widthInPixels(): number;
  972. set widthInPixels(value: number);
  973. /**
  974. * Gets or sets control height
  975. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  976. */
  977. get height(): string | number;
  978. set height(value: string | number);
  979. /**
  980. * Gets or sets control height in pixel
  981. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  982. */
  983. get heightInPixels(): number;
  984. set heightInPixels(value: number);
  985. /** Gets or set font family */
  986. get fontFamily(): string;
  987. set fontFamily(value: string);
  988. /** Gets or sets font style */
  989. get fontStyle(): string;
  990. set fontStyle(value: string);
  991. /** Gets or sets font weight */
  992. get fontWeight(): string;
  993. set fontWeight(value: string);
  994. /**
  995. * Gets or sets style
  996. * @see https://doc.babylonjs.com/how_to/gui#styles
  997. */
  998. get style(): BABYLON.Nullable<Style>;
  999. set style(value: BABYLON.Nullable<Style>);
  1000. /** @hidden */
  1001. get _isFontSizeInPercentage(): boolean;
  1002. /** Gets or sets font size in pixels */
  1003. get fontSizeInPixels(): number;
  1004. set fontSizeInPixels(value: number);
  1005. /** Gets or sets font size */
  1006. get fontSize(): string | number;
  1007. set fontSize(value: string | number);
  1008. /** Gets or sets foreground color */
  1009. get color(): string;
  1010. set color(value: string);
  1011. /** Gets or sets z index which is used to reorder controls on the z axis */
  1012. get zIndex(): number;
  1013. set zIndex(value: number);
  1014. /** Gets or sets a boolean indicating if the control can be rendered */
  1015. get notRenderable(): boolean;
  1016. set notRenderable(value: boolean);
  1017. /** Gets or sets a boolean indicating if the control is visible */
  1018. get isVisible(): boolean;
  1019. set isVisible(value: boolean);
  1020. /** Gets a boolean indicating that the control needs to update its rendering */
  1021. get isDirty(): boolean;
  1022. /**
  1023. * Gets the current linked mesh (or null if none)
  1024. */
  1025. get linkedMesh(): BABYLON.Nullable<BABYLON.TransformNode>;
  1026. /**
  1027. * Gets or sets a value indicating the padding to use on the left of the control
  1028. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1029. */
  1030. get paddingLeft(): string | number;
  1031. set paddingLeft(value: string | number);
  1032. /**
  1033. * Gets or sets a value indicating the padding in pixels to use on the left of the control
  1034. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1035. */
  1036. get paddingLeftInPixels(): number;
  1037. set paddingLeftInPixels(value: number);
  1038. /**
  1039. * Gets or sets a value indicating the padding to use on the right of the control
  1040. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1041. */
  1042. get paddingRight(): string | number;
  1043. set paddingRight(value: string | number);
  1044. /**
  1045. * Gets or sets a value indicating the padding in pixels to use on the right of the control
  1046. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1047. */
  1048. get paddingRightInPixels(): number;
  1049. set paddingRightInPixels(value: number);
  1050. /**
  1051. * Gets or sets a value indicating the padding to use on the top of the control
  1052. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1053. */
  1054. get paddingTop(): string | number;
  1055. set paddingTop(value: string | number);
  1056. /**
  1057. * Gets or sets a value indicating the padding in pixels to use on the top of the control
  1058. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1059. */
  1060. get paddingTopInPixels(): number;
  1061. set paddingTopInPixels(value: number);
  1062. /**
  1063. * Gets or sets a value indicating the padding to use on the bottom of the control
  1064. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1065. */
  1066. get paddingBottom(): string | number;
  1067. set paddingBottom(value: string | number);
  1068. /**
  1069. * Gets or sets a value indicating the padding in pixels to use on the bottom of the control
  1070. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1071. */
  1072. get paddingBottomInPixels(): number;
  1073. set paddingBottomInPixels(value: number);
  1074. /**
  1075. * Gets or sets a value indicating the left coordinate of the control
  1076. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1077. */
  1078. get left(): string | number;
  1079. set left(value: string | number);
  1080. /**
  1081. * Gets or sets a value indicating the left coordinate in pixels of the control
  1082. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1083. */
  1084. get leftInPixels(): number;
  1085. set leftInPixels(value: number);
  1086. /**
  1087. * Gets or sets a value indicating the top coordinate of the control
  1088. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1089. */
  1090. get top(): string | number;
  1091. set top(value: string | number);
  1092. /**
  1093. * Gets or sets a value indicating the top coordinate in pixels of the control
  1094. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1095. */
  1096. get topInPixels(): number;
  1097. set topInPixels(value: number);
  1098. /**
  1099. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1100. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1101. */
  1102. get linkOffsetX(): string | number;
  1103. set linkOffsetX(value: string | number);
  1104. /**
  1105. * Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
  1106. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1107. */
  1108. get linkOffsetXInPixels(): number;
  1109. set linkOffsetXInPixels(value: number);
  1110. /**
  1111. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1112. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1113. */
  1114. get linkOffsetY(): string | number;
  1115. set linkOffsetY(value: string | number);
  1116. /**
  1117. * Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
  1118. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1119. */
  1120. get linkOffsetYInPixels(): number;
  1121. set linkOffsetYInPixels(value: number);
  1122. /** Gets the center coordinate on X axis */
  1123. get centerX(): number;
  1124. /** Gets the center coordinate on Y axis */
  1125. get centerY(): number;
  1126. /** Gets or sets if control is Enabled */
  1127. get isEnabled(): boolean;
  1128. set isEnabled(value: boolean);
  1129. /** Gets or sets background color of control if it's disabled */
  1130. get disabledColor(): string;
  1131. set disabledColor(value: string);
  1132. /** Gets or sets front color of control if it's disabled */
  1133. get disabledColorItem(): string;
  1134. set disabledColorItem(value: string);
  1135. /**
  1136. * Creates a new control
  1137. * @param name defines the name of the control
  1138. */
  1139. constructor(
  1140. /** defines the name of the control */
  1141. name?: string | undefined);
  1142. /** @hidden */
  1143. protected _getTypeName(): string;
  1144. /**
  1145. * Gets the first ascendant in the hierarchy of the given type
  1146. * @param className defines the required type
  1147. * @returns the ascendant or null if not found
  1148. */
  1149. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  1150. /** @hidden */
  1151. _resetFontCache(): void;
  1152. /**
  1153. * Determines if a container is an ascendant of the current control
  1154. * @param container defines the container to look for
  1155. * @returns true if the container is one of the ascendant of the control
  1156. */
  1157. isAscendant(container: Control): boolean;
  1158. /**
  1159. * Gets coordinates in local control space
  1160. * @param globalCoordinates defines the coordinates to transform
  1161. * @returns the new coordinates in local space
  1162. */
  1163. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1164. /**
  1165. * Gets coordinates in local control space
  1166. * @param globalCoordinates defines the coordinates to transform
  1167. * @param result defines the target vector2 where to store the result
  1168. * @returns the current control
  1169. */
  1170. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  1171. /**
  1172. * Gets coordinates in parent local control space
  1173. * @param globalCoordinates defines the coordinates to transform
  1174. * @returns the new coordinates in parent local space
  1175. */
  1176. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1177. /**
  1178. * Move the current control to a vector3 position projected onto the screen.
  1179. * @param position defines the target position
  1180. * @param scene defines the hosting scene
  1181. */
  1182. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  1183. /**
  1184. * Will store all controls that have this control as ascendant in a given array
  1185. * @param results defines the array where to store the descendants
  1186. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1187. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1188. */
  1189. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1190. /**
  1191. * Will return all controls that have this control as ascendant
  1192. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  1193. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  1194. * @return all child controls
  1195. */
  1196. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1197. /**
  1198. * Link current control with a target mesh
  1199. * @param mesh defines the mesh to link with
  1200. * @see https://doc.babylonjs.com/how_to/gui#tracking-positions
  1201. */
  1202. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.TransformNode>): void;
  1203. /**
  1204. * Shorthand funtion to set the top, right, bottom, and left padding values on the control.
  1205. * @param { string | number} paddingTop - The value of the top padding.
  1206. * @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
  1207. * @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
  1208. * @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
  1209. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1210. */
  1211. setPadding(paddingTop: string | number, paddingRight?: string | number, paddingBottom?: string | number, paddingLeft?: string | number): void;
  1212. /**
  1213. * Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
  1214. * @param { number} paddingTop - The value in pixels of the top padding.
  1215. * @param { number} paddingRight - The value in pixels of the right padding. If omitted, top is used.
  1216. * @param { number} paddingBottom - The value in pixels of the bottom padding. If omitted, top is used.
  1217. * @param { number} paddingLeft - The value in pixels of the left padding. If omitted, right is used.
  1218. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  1219. */
  1220. setPaddingInPixels(paddingTop: number, paddingRight?: number, paddingBottom?: number, paddingLeft?: number): void;
  1221. /** @hidden */
  1222. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  1223. /** @hidden */
  1224. _offsetLeft(offset: number): void;
  1225. /** @hidden */
  1226. _offsetTop(offset: number): void;
  1227. /** @hidden */
  1228. _markMatrixAsDirty(): void;
  1229. /** @hidden */
  1230. _flagDescendantsAsMatrixDirty(): void;
  1231. /** @hidden */
  1232. _intersectsRect(rect: Measure): boolean;
  1233. /** @hidden */
  1234. protected invalidateRect(): void;
  1235. /** @hidden */
  1236. _markAsDirty(force?: boolean): void;
  1237. /** @hidden */
  1238. _markAllAsDirty(): void;
  1239. /** @hidden */
  1240. _link(host: AdvancedDynamicTexture): void;
  1241. /** @hidden */
  1242. protected _transform(context?: CanvasRenderingContext2D): void;
  1243. /** @hidden */
  1244. _renderHighlight(context: CanvasRenderingContext2D): void;
  1245. /** @hidden */
  1246. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1247. /** @hidden */
  1248. protected _applyStates(context: CanvasRenderingContext2D): void;
  1249. /** @hidden */
  1250. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1251. /** @hidden */
  1252. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1253. protected _evaluateClippingState(parentMeasure: Measure): void;
  1254. /** @hidden */
  1255. _measure(): void;
  1256. /** @hidden */
  1257. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1258. /** @hidden */
  1259. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1260. /** @hidden */
  1261. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1262. /** @hidden */
  1263. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1264. private static _ClipMeasure;
  1265. private _tmpMeasureA;
  1266. private _clip;
  1267. /** @hidden */
  1268. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): boolean;
  1269. /** @hidden */
  1270. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  1271. /**
  1272. * Tests if a given coordinates belong to the current control
  1273. * @param x defines x coordinate to test
  1274. * @param y defines y coordinate to test
  1275. * @returns true if the coordinates are inside the control
  1276. */
  1277. contains(x: number, y: number): boolean;
  1278. /** @hidden */
  1279. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1280. /** @hidden */
  1281. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  1282. /** @hidden */
  1283. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  1284. /** @hidden */
  1285. _onPointerOut(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, force?: boolean): void;
  1286. /** @hidden */
  1287. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  1288. /** @hidden */
  1289. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: BABYLON.PointerInfoBase): void;
  1290. /** @hidden */
  1291. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  1292. /** @hidden */
  1293. _onWheelScroll(deltaX?: number, deltaY?: number): void;
  1294. /** @hidden */
  1295. _onCanvasBlur(): void;
  1296. /** @hidden */
  1297. _processObservables(type: number, x: number, y: number, pi: BABYLON.PointerInfoBase, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1298. private _prepareFont;
  1299. /**
  1300. * Serializes the current control
  1301. * @param serializationObject defined the JSON serialized object
  1302. */
  1303. serialize(serializationObject: any): void;
  1304. /** @hidden */
  1305. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1306. /** Releases associated resources */
  1307. dispose(): void;
  1308. private static _HORIZONTAL_ALIGNMENT_LEFT;
  1309. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  1310. private static _HORIZONTAL_ALIGNMENT_CENTER;
  1311. private static _VERTICAL_ALIGNMENT_TOP;
  1312. private static _VERTICAL_ALIGNMENT_BOTTOM;
  1313. private static _VERTICAL_ALIGNMENT_CENTER;
  1314. /** HORIZONTAL_ALIGNMENT_LEFT */
  1315. static get HORIZONTAL_ALIGNMENT_LEFT(): number;
  1316. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1317. static get HORIZONTAL_ALIGNMENT_RIGHT(): number;
  1318. /** HORIZONTAL_ALIGNMENT_CENTER */
  1319. static get HORIZONTAL_ALIGNMENT_CENTER(): number;
  1320. /** VERTICAL_ALIGNMENT_TOP */
  1321. static get VERTICAL_ALIGNMENT_TOP(): number;
  1322. /** VERTICAL_ALIGNMENT_BOTTOM */
  1323. static get VERTICAL_ALIGNMENT_BOTTOM(): number;
  1324. /** VERTICAL_ALIGNMENT_CENTER */
  1325. static get VERTICAL_ALIGNMENT_CENTER(): number;
  1326. private static _FontHeightSizes;
  1327. /** @hidden */
  1328. static _GetFontOffset(font: string): {
  1329. ascent: number;
  1330. height: number;
  1331. descent: number;
  1332. };
  1333. /**
  1334. * Creates a Control from parsed data
  1335. * @param serializedObject defines parsed data
  1336. * @param host defines the hosting AdvancedDynamicTexture
  1337. * @returns a new Control
  1338. */
  1339. static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control;
  1340. /**
  1341. * Creates a stack panel that can be used to render headers
  1342. * @param control defines the control to associate with the header
  1343. * @param text defines the text of the header
  1344. * @param size defines the size of the header
  1345. * @param options defines options used to configure the header
  1346. * @returns a new StackPanel
  1347. * @ignore
  1348. * @hidden
  1349. */
  1350. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1351. isHorizontal: boolean;
  1352. controlFirst: boolean;
  1353. }) => any;
  1354. /** @hidden */
  1355. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1356. }
  1357. }
  1358. declare module BABYLON.GUI {
  1359. /**
  1360. * Root class for 2D containers
  1361. * @see https://doc.babylonjs.com/how_to/gui#containers
  1362. */
  1363. export class Container extends Control {
  1364. name?: string | undefined;
  1365. /** @hidden */
  1366. _children: Control[];
  1367. /** @hidden */
  1368. protected _measureForChildren: Measure;
  1369. /** @hidden */
  1370. protected _background: string;
  1371. /** @hidden */
  1372. protected _adaptWidthToChildren: boolean;
  1373. /** @hidden */
  1374. protected _adaptHeightToChildren: boolean;
  1375. /**
  1376. * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
  1377. */
  1378. logLayoutCycleErrors: boolean;
  1379. /**
  1380. * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
  1381. */
  1382. maxLayoutCycle: number;
  1383. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  1384. get adaptHeightToChildren(): boolean;
  1385. set adaptHeightToChildren(value: boolean);
  1386. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  1387. get adaptWidthToChildren(): boolean;
  1388. set adaptWidthToChildren(value: boolean);
  1389. /** Gets or sets background color */
  1390. get background(): string;
  1391. set background(value: string);
  1392. /** Gets the list of children */
  1393. get children(): Control[];
  1394. /**
  1395. * Creates a new Container
  1396. * @param name defines the name of the container
  1397. */
  1398. constructor(name?: string | undefined);
  1399. protected _getTypeName(): string;
  1400. _flagDescendantsAsMatrixDirty(): void;
  1401. /**
  1402. * Gets a child using its name
  1403. * @param name defines the child name to look for
  1404. * @returns the child control if found
  1405. */
  1406. getChildByName(name: string): BABYLON.Nullable<Control>;
  1407. /**
  1408. * Gets a child using its type and its name
  1409. * @param name defines the child name to look for
  1410. * @param type defines the child type to look for
  1411. * @returns the child control if found
  1412. */
  1413. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  1414. /**
  1415. * Search for a specific control in children
  1416. * @param control defines the control to look for
  1417. * @returns true if the control is in child list
  1418. */
  1419. containsControl(control: Control): boolean;
  1420. /**
  1421. * Adds a new control to the current container
  1422. * @param control defines the control to add
  1423. * @returns the current container
  1424. */
  1425. addControl(control: BABYLON.Nullable<Control>): Container;
  1426. /**
  1427. * Removes all controls from the current container
  1428. * @returns the current container
  1429. */
  1430. clearControls(): Container;
  1431. /**
  1432. * Removes a control from the current container
  1433. * @param control defines the control to remove
  1434. * @returns the current container
  1435. */
  1436. removeControl(control: Control): Container;
  1437. /** @hidden */
  1438. _reOrderControl(control: Control): void;
  1439. /** @hidden */
  1440. _offsetLeft(offset: number): void;
  1441. /** @hidden */
  1442. _offsetTop(offset: number): void;
  1443. /** @hidden */
  1444. _markAllAsDirty(): void;
  1445. /** @hidden */
  1446. protected _localDraw(context: CanvasRenderingContext2D): void;
  1447. /** @hidden */
  1448. _link(host: AdvancedDynamicTexture): void;
  1449. /** @hidden */
  1450. protected _beforeLayout(): void;
  1451. /** @hidden */
  1452. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1453. /** @hidden */
  1454. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1455. protected _postMeasure(): void;
  1456. /** @hidden */
  1457. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  1458. getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1459. /** @hidden */
  1460. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1461. /** @hidden */
  1462. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1463. /**
  1464. * Serializes the current control
  1465. * @param serializationObject defined the JSON serialized object
  1466. */
  1467. serialize(serializationObject: any): void;
  1468. /** Releases associated resources */
  1469. dispose(): void;
  1470. /** @hidden */
  1471. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1472. }
  1473. }
  1474. declare module BABYLON.GUI {
  1475. /** Class used to create rectangle container */
  1476. export class Rectangle extends Container {
  1477. name?: string | undefined;
  1478. private _thickness;
  1479. private _cornerRadius;
  1480. /** Gets or sets border thickness */
  1481. get thickness(): number;
  1482. set thickness(value: number);
  1483. /** Gets or sets the corner radius angle */
  1484. get cornerRadius(): number;
  1485. set cornerRadius(value: number);
  1486. /**
  1487. * Creates a new Rectangle
  1488. * @param name defines the control name
  1489. */
  1490. constructor(name?: string | undefined);
  1491. protected _getTypeName(): string;
  1492. protected _localDraw(context: CanvasRenderingContext2D): void;
  1493. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1494. private _drawRoundedRect;
  1495. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1496. }
  1497. }
  1498. declare module BABYLON.GUI {
  1499. /**
  1500. * Enum that determines the text-wrapping mode to use.
  1501. */
  1502. export enum TextWrapping {
  1503. /**
  1504. * Clip the text when it's larger than Control.width; this is the default mode.
  1505. */
  1506. Clip = 0,
  1507. /**
  1508. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1509. */
  1510. WordWrap = 1,
  1511. /**
  1512. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1513. */
  1514. Ellipsis = 2
  1515. }
  1516. /**
  1517. * Class used to create text block control
  1518. */
  1519. export class TextBlock extends Control {
  1520. /**
  1521. * Defines the name of the control
  1522. */
  1523. name?: string | undefined;
  1524. private _text;
  1525. private _textWrapping;
  1526. private _textHorizontalAlignment;
  1527. private _textVerticalAlignment;
  1528. private _lines;
  1529. private _resizeToFit;
  1530. private _lineSpacing;
  1531. private _outlineWidth;
  1532. private _outlineColor;
  1533. private _underline;
  1534. private _lineThrough;
  1535. /**
  1536. * An event triggered after the text is changed
  1537. */
  1538. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  1539. /**
  1540. * An event triggered after the text was broken up into lines
  1541. */
  1542. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  1543. /**
  1544. * Function used to split a string into words. By default, a string is split at each space character found
  1545. */
  1546. wordSplittingFunction: BABYLON.Nullable<(line: string) => string[]>;
  1547. /**
  1548. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1549. */
  1550. get lines(): any[];
  1551. /**
  1552. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1553. */
  1554. get resizeToFit(): boolean;
  1555. /**
  1556. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1557. */
  1558. set resizeToFit(value: boolean);
  1559. /**
  1560. * Gets or sets a boolean indicating if text must be wrapped
  1561. */
  1562. get textWrapping(): TextWrapping | boolean;
  1563. /**
  1564. * Gets or sets a boolean indicating if text must be wrapped
  1565. */
  1566. set textWrapping(value: TextWrapping | boolean);
  1567. /**
  1568. * Gets or sets text to display
  1569. */
  1570. get text(): string;
  1571. /**
  1572. * Gets or sets text to display
  1573. */
  1574. set text(value: string);
  1575. /**
  1576. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1577. */
  1578. get textHorizontalAlignment(): number;
  1579. /**
  1580. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1581. */
  1582. set textHorizontalAlignment(value: number);
  1583. /**
  1584. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1585. */
  1586. get textVerticalAlignment(): number;
  1587. /**
  1588. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1589. */
  1590. set textVerticalAlignment(value: number);
  1591. /**
  1592. * Gets or sets line spacing value
  1593. */
  1594. set lineSpacing(value: string | number);
  1595. /**
  1596. * Gets or sets line spacing value
  1597. */
  1598. get lineSpacing(): string | number;
  1599. /**
  1600. * Gets or sets outlineWidth of the text to display
  1601. */
  1602. get outlineWidth(): number;
  1603. /**
  1604. * Gets or sets outlineWidth of the text to display
  1605. */
  1606. set outlineWidth(value: number);
  1607. /**
  1608. * Gets or sets a boolean indicating that text must have underline
  1609. */
  1610. get underline(): boolean;
  1611. /**
  1612. * Gets or sets a boolean indicating that text must have underline
  1613. */
  1614. set underline(value: boolean);
  1615. /**
  1616. * Gets or sets an boolean indicating that text must be crossed out
  1617. */
  1618. get lineThrough(): boolean;
  1619. /**
  1620. * Gets or sets an boolean indicating that text must be crossed out
  1621. */
  1622. set lineThrough(value: boolean);
  1623. /**
  1624. * Gets or sets outlineColor of the text to display
  1625. */
  1626. get outlineColor(): string;
  1627. /**
  1628. * Gets or sets outlineColor of the text to display
  1629. */
  1630. set outlineColor(value: string);
  1631. /**
  1632. * Creates a new TextBlock object
  1633. * @param name defines the name of the control
  1634. * @param text defines the text to display (emptry string by default)
  1635. */
  1636. constructor(
  1637. /**
  1638. * Defines the name of the control
  1639. */
  1640. name?: string | undefined, text?: string);
  1641. protected _getTypeName(): string;
  1642. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1643. private _drawText;
  1644. /** @hidden */
  1645. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  1646. protected _applyStates(context: CanvasRenderingContext2D): void;
  1647. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1648. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1649. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1650. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1651. protected _renderLines(context: CanvasRenderingContext2D): void;
  1652. /**
  1653. * Given a width constraint applied on the text block, find the expected height
  1654. * @returns expected height
  1655. */
  1656. computeExpectedHeight(): number;
  1657. dispose(): void;
  1658. }
  1659. }
  1660. declare module BABYLON.GUI {
  1661. /**
  1662. * Class used to create 2D images
  1663. */
  1664. export class Image extends Control {
  1665. name?: string | undefined;
  1666. private _workingCanvas;
  1667. private _domImage;
  1668. private _imageWidth;
  1669. private _imageHeight;
  1670. private _loaded;
  1671. private _stretch;
  1672. private _source;
  1673. private _autoScale;
  1674. private _sourceLeft;
  1675. private _sourceTop;
  1676. private _sourceWidth;
  1677. private _sourceHeight;
  1678. private _svgAttributesComputationCompleted;
  1679. private _isSVG;
  1680. private _cellWidth;
  1681. private _cellHeight;
  1682. private _cellId;
  1683. private _sliceLeft;
  1684. private _sliceRight;
  1685. private _sliceTop;
  1686. private _sliceBottom;
  1687. private _populateNinePatchSlicesFromImage;
  1688. private _detectPointerOnOpaqueOnly;
  1689. private _imageDataCache;
  1690. /**
  1691. * BABYLON.Observable notified when the content is loaded
  1692. */
  1693. onImageLoadedObservable: BABYLON.Observable<Image>;
  1694. /**
  1695. * BABYLON.Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed
  1696. */
  1697. onSVGAttributesComputedObservable: BABYLON.Observable<Image>;
  1698. /**
  1699. * Gets a boolean indicating that the content is loaded
  1700. */
  1701. get isLoaded(): boolean;
  1702. /**
  1703. * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
  1704. * Beware using this as this will comsume more memory as the image has to be stored twice
  1705. */
  1706. get detectPointerOnOpaqueOnly(): boolean;
  1707. set detectPointerOnOpaqueOnly(value: boolean);
  1708. /**
  1709. * Gets or sets the left value for slicing (9-patch)
  1710. */
  1711. get sliceLeft(): number;
  1712. set sliceLeft(value: number);
  1713. /**
  1714. * Gets or sets the right value for slicing (9-patch)
  1715. */
  1716. get sliceRight(): number;
  1717. set sliceRight(value: number);
  1718. /**
  1719. * Gets or sets the top value for slicing (9-patch)
  1720. */
  1721. get sliceTop(): number;
  1722. set sliceTop(value: number);
  1723. /**
  1724. * Gets or sets the bottom value for slicing (9-patch)
  1725. */
  1726. get sliceBottom(): number;
  1727. set sliceBottom(value: number);
  1728. /**
  1729. * Gets or sets the left coordinate in the source image
  1730. */
  1731. get sourceLeft(): number;
  1732. set sourceLeft(value: number);
  1733. /**
  1734. * Gets or sets the top coordinate in the source image
  1735. */
  1736. get sourceTop(): number;
  1737. set sourceTop(value: number);
  1738. /**
  1739. * Gets or sets the width to capture in the source image
  1740. */
  1741. get sourceWidth(): number;
  1742. set sourceWidth(value: number);
  1743. /**
  1744. * Gets or sets the height to capture in the source image
  1745. */
  1746. get sourceHeight(): number;
  1747. set sourceHeight(value: number);
  1748. /**
  1749. * Gets the image width
  1750. */
  1751. get imageWidth(): number;
  1752. /**
  1753. * Gets the image height
  1754. */
  1755. get imageHeight(): number;
  1756. /**
  1757. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  1758. */
  1759. get populateNinePatchSlicesFromImage(): boolean;
  1760. set populateNinePatchSlicesFromImage(value: boolean);
  1761. /** Indicates if the format of the image is SVG */
  1762. get isSVG(): boolean;
  1763. /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */
  1764. get svgAttributesComputationCompleted(): boolean;
  1765. /**
  1766. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1767. * @see https://doc.babylonjs.com/how_to/gui#image
  1768. */
  1769. get autoScale(): boolean;
  1770. set autoScale(value: boolean);
  1771. /** Gets or sets the streching mode used by the image */
  1772. get stretch(): number;
  1773. set stretch(value: number);
  1774. /** @hidden */
  1775. _rotate90(n: number, preserveProperties?: boolean): Image;
  1776. private _handleRotationForSVGImage;
  1777. private _rotate90SourceProperties;
  1778. private _extractNinePatchSliceDataFromImage;
  1779. /**
  1780. * Gets or sets the internal DOM image used to render the control
  1781. */
  1782. set domImage(value: HTMLImageElement);
  1783. get domImage(): HTMLImageElement;
  1784. private _onImageLoaded;
  1785. /**
  1786. * Gets the image source url
  1787. */
  1788. get source(): BABYLON.Nullable<string>;
  1789. /**
  1790. * Gets or sets image source url
  1791. */
  1792. set source(value: BABYLON.Nullable<string>);
  1793. /**
  1794. * Checks for svg document with icon id present
  1795. */
  1796. private _svgCheck;
  1797. /**
  1798. * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically
  1799. * given external svg file and icon id
  1800. */
  1801. private _getSVGAttribs;
  1802. /**
  1803. * Gets or sets the cell width to use when animation sheet is enabled
  1804. * @see https://doc.babylonjs.com/how_to/gui#image
  1805. */
  1806. get cellWidth(): number;
  1807. set cellWidth(value: number);
  1808. /**
  1809. * Gets or sets the cell height to use when animation sheet is enabled
  1810. * @see https://doc.babylonjs.com/how_to/gui#image
  1811. */
  1812. get cellHeight(): number;
  1813. set cellHeight(value: number);
  1814. /**
  1815. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1816. * @see https://doc.babylonjs.com/how_to/gui#image
  1817. */
  1818. get cellId(): number;
  1819. set cellId(value: number);
  1820. /**
  1821. * Creates a new Image
  1822. * @param name defines the control name
  1823. * @param url defines the image url
  1824. */
  1825. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  1826. /**
  1827. * Tests if a given coordinates belong to the current control
  1828. * @param x defines x coordinate to test
  1829. * @param y defines y coordinate to test
  1830. * @returns true if the coordinates are inside the control
  1831. */
  1832. contains(x: number, y: number): boolean;
  1833. protected _getTypeName(): string;
  1834. /** Force the control to synchronize with its content */
  1835. synchronizeSizeWithContent(): void;
  1836. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1837. private _prepareWorkingCanvasForOpaqueDetection;
  1838. private _drawImage;
  1839. _draw(context: CanvasRenderingContext2D): void;
  1840. private _renderNinePatch;
  1841. dispose(): void;
  1842. /** STRETCH_NONE */
  1843. static readonly STRETCH_NONE: number;
  1844. /** STRETCH_FILL */
  1845. static readonly STRETCH_FILL: number;
  1846. /** STRETCH_UNIFORM */
  1847. static readonly STRETCH_UNIFORM: number;
  1848. /** STRETCH_EXTEND */
  1849. static readonly STRETCH_EXTEND: number;
  1850. /** NINE_PATCH */
  1851. static readonly STRETCH_NINE_PATCH: number;
  1852. }
  1853. }
  1854. declare module BABYLON.GUI {
  1855. /**
  1856. * Class used to create 2D buttons
  1857. */
  1858. export class Button extends Rectangle {
  1859. name?: string | undefined;
  1860. /**
  1861. * Function called to generate a pointer enter animation
  1862. */
  1863. pointerEnterAnimation: () => void;
  1864. /**
  1865. * Function called to generate a pointer out animation
  1866. */
  1867. pointerOutAnimation: () => void;
  1868. /**
  1869. * Function called to generate a pointer down animation
  1870. */
  1871. pointerDownAnimation: () => void;
  1872. /**
  1873. * Function called to generate a pointer up animation
  1874. */
  1875. pointerUpAnimation: () => void;
  1876. /**
  1877. * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
  1878. */
  1879. delegatePickingToChildren: boolean;
  1880. private _image;
  1881. /**
  1882. * Returns the image part of the button (if any)
  1883. */
  1884. get image(): BABYLON.Nullable<Image>;
  1885. private _textBlock;
  1886. /**
  1887. * Returns the image part of the button (if any)
  1888. */
  1889. get textBlock(): BABYLON.Nullable<TextBlock>;
  1890. /**
  1891. * Creates a new Button
  1892. * @param name defines the name of the button
  1893. */
  1894. constructor(name?: string | undefined);
  1895. protected _getTypeName(): string;
  1896. /** @hidden */
  1897. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  1898. /** @hidden */
  1899. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  1900. /** @hidden */
  1901. _onPointerOut(target: Control, pi: BABYLON.PointerInfoBase, force?: boolean): void;
  1902. /** @hidden */
  1903. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  1904. /** @hidden */
  1905. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  1906. /**
  1907. * Creates a new button made with an image and a text
  1908. * @param name defines the name of the button
  1909. * @param text defines the text of the button
  1910. * @param imageUrl defines the url of the image
  1911. * @returns a new Button
  1912. */
  1913. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  1914. /**
  1915. * Creates a new button made with an image
  1916. * @param name defines the name of the button
  1917. * @param imageUrl defines the url of the image
  1918. * @returns a new Button
  1919. */
  1920. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  1921. /**
  1922. * Creates a new button made with a text
  1923. * @param name defines the name of the button
  1924. * @param text defines the text of the button
  1925. * @returns a new Button
  1926. */
  1927. static CreateSimpleButton(name: string, text: string): Button;
  1928. /**
  1929. * Creates a new button made with an image and a centered text
  1930. * @param name defines the name of the button
  1931. * @param text defines the text of the button
  1932. * @param imageUrl defines the url of the image
  1933. * @returns a new Button
  1934. */
  1935. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  1936. }
  1937. }
  1938. declare module BABYLON.GUI {
  1939. /**
  1940. * Class used to create a 2D stack panel container
  1941. */
  1942. export class StackPanel extends Container {
  1943. name?: string | undefined;
  1944. private _isVertical;
  1945. private _manualWidth;
  1946. private _manualHeight;
  1947. private _doNotTrackManualChanges;
  1948. /**
  1949. * Gets or sets a boolean indicating that layou warnings should be ignored
  1950. */
  1951. ignoreLayoutWarnings: boolean;
  1952. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1953. get isVertical(): boolean;
  1954. set isVertical(value: boolean);
  1955. /**
  1956. * Gets or sets panel width.
  1957. * This value should not be set when in horizontal mode as it will be computed automatically
  1958. */
  1959. set width(value: string | number);
  1960. get width(): string | number;
  1961. /**
  1962. * Gets or sets panel height.
  1963. * This value should not be set when in vertical mode as it will be computed automatically
  1964. */
  1965. set height(value: string | number);
  1966. get height(): string | number;
  1967. /**
  1968. * Creates a new StackPanel
  1969. * @param name defines control name
  1970. */
  1971. constructor(name?: string | undefined);
  1972. protected _getTypeName(): string;
  1973. /** @hidden */
  1974. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1975. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1976. protected _postMeasure(): void;
  1977. /**
  1978. * Serializes the current control
  1979. * @param serializationObject defined the JSON serialized object
  1980. */
  1981. serialize(serializationObject: any): void;
  1982. /** @hidden */
  1983. _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
  1984. }
  1985. }
  1986. declare module BABYLON.GUI {
  1987. /**
  1988. * Class used to represent a 2D checkbox
  1989. */
  1990. export class Checkbox extends Control {
  1991. name?: string | undefined;
  1992. private _isChecked;
  1993. private _background;
  1994. private _checkSizeRatio;
  1995. private _thickness;
  1996. /** Gets or sets border thickness */
  1997. get thickness(): number;
  1998. set thickness(value: number);
  1999. /**
  2000. * BABYLON.Observable raised when isChecked property changes
  2001. */
  2002. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  2003. /** Gets or sets a value indicating the ratio between overall size and check size */
  2004. get checkSizeRatio(): number;
  2005. set checkSizeRatio(value: number);
  2006. /** Gets or sets background color */
  2007. get background(): string;
  2008. set background(value: string);
  2009. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2010. get isChecked(): boolean;
  2011. set isChecked(value: boolean);
  2012. /**
  2013. * Creates a new CheckBox
  2014. * @param name defines the control name
  2015. */
  2016. constructor(name?: string | undefined);
  2017. protected _getTypeName(): string;
  2018. /** @hidden */
  2019. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2020. /** @hidden */
  2021. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2022. /**
  2023. * Utility function to easily create a checkbox with a header
  2024. * @param title defines the label to use for the header
  2025. * @param onValueChanged defines the callback to call when value changes
  2026. * @returns a StackPanel containing the checkbox and a textBlock
  2027. */
  2028. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  2029. }
  2030. }
  2031. declare module BABYLON.GUI {
  2032. /**
  2033. * Class used to store key control properties
  2034. */
  2035. export class KeyPropertySet {
  2036. /** Width */
  2037. width?: string;
  2038. /** Height */
  2039. height?: string;
  2040. /** Left padding */
  2041. paddingLeft?: string;
  2042. /** Right padding */
  2043. paddingRight?: string;
  2044. /** Top padding */
  2045. paddingTop?: string;
  2046. /** Bottom padding */
  2047. paddingBottom?: string;
  2048. /** Foreground color */
  2049. color?: string;
  2050. /** Background color */
  2051. background?: string;
  2052. }
  2053. /**
  2054. * Class used to create virtual keyboard
  2055. */
  2056. export class VirtualKeyboard extends StackPanel {
  2057. /** BABYLON.Observable raised when a key is pressed */
  2058. onKeyPressObservable: BABYLON.Observable<string>;
  2059. /** Gets or sets default key button width */
  2060. defaultButtonWidth: string;
  2061. /** Gets or sets default key button height */
  2062. defaultButtonHeight: string;
  2063. /** Gets or sets default key button left padding */
  2064. defaultButtonPaddingLeft: string;
  2065. /** Gets or sets default key button right padding */
  2066. defaultButtonPaddingRight: string;
  2067. /** Gets or sets default key button top padding */
  2068. defaultButtonPaddingTop: string;
  2069. /** Gets or sets default key button bottom padding */
  2070. defaultButtonPaddingBottom: string;
  2071. /** Gets or sets default key button foreground color */
  2072. defaultButtonColor: string;
  2073. /** Gets or sets default key button background color */
  2074. defaultButtonBackground: string;
  2075. /** Gets or sets shift button foreground color */
  2076. shiftButtonColor: string;
  2077. /** Gets or sets shift button thickness*/
  2078. selectedShiftThickness: number;
  2079. /** Gets shift key state */
  2080. shiftState: number;
  2081. protected _getTypeName(): string;
  2082. private _createKey;
  2083. /**
  2084. * Adds a new row of keys
  2085. * @param keys defines the list of keys to add
  2086. * @param propertySets defines the associated property sets
  2087. */
  2088. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2089. /**
  2090. * Set the shift key to a specific state
  2091. * @param shiftState defines the new shift state
  2092. */
  2093. applyShiftState(shiftState: number): void;
  2094. private _currentlyConnectedInputText;
  2095. private _connectedInputTexts;
  2096. private _onKeyPressObserver;
  2097. /** Gets the input text control currently attached to the keyboard */
  2098. get connectedInputText(): BABYLON.Nullable<InputText>;
  2099. /**
  2100. * Connects the keyboard with an input text control
  2101. *
  2102. * @param input defines the target control
  2103. */
  2104. connect(input: InputText): void;
  2105. /**
  2106. * Disconnects the keyboard from connected InputText controls
  2107. *
  2108. * @param input optionally defines a target control, otherwise all are disconnected
  2109. */
  2110. disconnect(input?: InputText): void;
  2111. private _removeConnectedInputObservables;
  2112. /**
  2113. * Release all resources
  2114. */
  2115. dispose(): void;
  2116. /**
  2117. * Creates a new keyboard using a default layout
  2118. *
  2119. * @param name defines control name
  2120. * @returns a new VirtualKeyboard
  2121. */
  2122. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2123. }
  2124. }
  2125. declare module BABYLON.GUI {
  2126. /** @hidden */
  2127. export class TextWrapper {
  2128. private _text;
  2129. private _characters;
  2130. get text(): string;
  2131. set text(txt: string);
  2132. get length(): number;
  2133. removePart(idxStart: number, idxEnd: number, insertTxt?: string): void;
  2134. charAt(idx: number): string;
  2135. substr(from: number, length?: number): string;
  2136. substring(from: number, to?: number): string;
  2137. isWord(index: number): boolean;
  2138. }
  2139. }
  2140. declare module BABYLON.GUI {
  2141. /**
  2142. * Class used to create input text control
  2143. */
  2144. export class InputText extends Control implements IFocusableControl {
  2145. name?: string | undefined;
  2146. private _textWrapper;
  2147. private _placeholderText;
  2148. private _background;
  2149. private _focusedBackground;
  2150. private _focusedColor;
  2151. private _placeholderColor;
  2152. private _thickness;
  2153. private _margin;
  2154. private _autoStretchWidth;
  2155. private _maxWidth;
  2156. private _isFocused;
  2157. private _blinkTimeout;
  2158. private _blinkIsEven;
  2159. private _cursorOffset;
  2160. private _scrollLeft;
  2161. private _textWidth;
  2162. private _clickedCoordinate;
  2163. private _deadKey;
  2164. private _addKey;
  2165. private _currentKey;
  2166. private _isTextHighlightOn;
  2167. private _textHighlightColor;
  2168. private _highligherOpacity;
  2169. private _highlightedText;
  2170. private _startHighlightIndex;
  2171. private _endHighlightIndex;
  2172. private _cursorIndex;
  2173. private _onFocusSelectAll;
  2174. private _isPointerDown;
  2175. private _onClipboardObserver;
  2176. private _onPointerDblTapObserver;
  2177. /** @hidden */
  2178. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  2179. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  2180. promptMessage: string;
  2181. /** Force disable prompt on mobile device */
  2182. disableMobilePrompt: boolean;
  2183. /** BABYLON.Observable raised when the text changes */
  2184. onTextChangedObservable: BABYLON.Observable<InputText>;
  2185. /** BABYLON.Observable raised just before an entered character is to be added */
  2186. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  2187. /** BABYLON.Observable raised when the control gets the focus */
  2188. onFocusObservable: BABYLON.Observable<InputText>;
  2189. /** BABYLON.Observable raised when the control loses the focus */
  2190. onBlurObservable: BABYLON.Observable<InputText>;
  2191. /**Observable raised when the text is highlighted */
  2192. onTextHighlightObservable: BABYLON.Observable<InputText>;
  2193. /**Observable raised when copy event is triggered */
  2194. onTextCopyObservable: BABYLON.Observable<InputText>;
  2195. /** BABYLON.Observable raised when cut event is triggered */
  2196. onTextCutObservable: BABYLON.Observable<InputText>;
  2197. /** BABYLON.Observable raised when paste event is triggered */
  2198. onTextPasteObservable: BABYLON.Observable<InputText>;
  2199. /** BABYLON.Observable raised when a key event was processed */
  2200. onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
  2201. /** Gets or sets the maximum width allowed by the control */
  2202. get maxWidth(): string | number;
  2203. /** Gets the maximum width allowed by the control in pixels */
  2204. get maxWidthInPixels(): number;
  2205. set maxWidth(value: string | number);
  2206. /** Gets or sets the text highlighter transparency; default: 0.4 */
  2207. get highligherOpacity(): number;
  2208. set highligherOpacity(value: number);
  2209. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  2210. get onFocusSelectAll(): boolean;
  2211. set onFocusSelectAll(value: boolean);
  2212. /** Gets or sets the text hightlight color */
  2213. get textHighlightColor(): string;
  2214. set textHighlightColor(value: string);
  2215. /** Gets or sets control margin */
  2216. get margin(): string;
  2217. /** Gets control margin in pixels */
  2218. get marginInPixels(): number;
  2219. set margin(value: string);
  2220. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  2221. get autoStretchWidth(): boolean;
  2222. set autoStretchWidth(value: boolean);
  2223. /** Gets or sets border thickness */
  2224. get thickness(): number;
  2225. set thickness(value: number);
  2226. /** Gets or sets the background color when focused */
  2227. get focusedBackground(): string;
  2228. set focusedBackground(value: string);
  2229. /** Gets or sets the background color when focused */
  2230. get focusedColor(): string;
  2231. set focusedColor(value: string);
  2232. /** Gets or sets the background color */
  2233. get background(): string;
  2234. set background(value: string);
  2235. /** Gets or sets the placeholder color */
  2236. get placeholderColor(): string;
  2237. set placeholderColor(value: string);
  2238. /** Gets or sets the text displayed when the control is empty */
  2239. get placeholderText(): string;
  2240. set placeholderText(value: string);
  2241. /** Gets or sets the dead key flag */
  2242. get deadKey(): boolean;
  2243. set deadKey(flag: boolean);
  2244. /** Gets or sets the highlight text */
  2245. get highlightedText(): string;
  2246. set highlightedText(text: string);
  2247. /** Gets or sets if the current key should be added */
  2248. get addKey(): boolean;
  2249. set addKey(flag: boolean);
  2250. /** Gets or sets the value of the current key being entered */
  2251. get currentKey(): string;
  2252. set currentKey(key: string);
  2253. /** Gets or sets the text displayed in the control */
  2254. get text(): string;
  2255. set text(value: string);
  2256. private _textHasChanged;
  2257. /** Gets or sets control width */
  2258. get width(): string | number;
  2259. set width(value: string | number);
  2260. /**
  2261. * Creates a new InputText
  2262. * @param name defines the control name
  2263. * @param text defines the text of the control
  2264. */
  2265. constructor(name?: string | undefined, text?: string);
  2266. /** @hidden */
  2267. onBlur(): void;
  2268. /** @hidden */
  2269. onFocus(): void;
  2270. /**
  2271. * Function to focus an inputText programmatically
  2272. */
  2273. focus(): void;
  2274. /**
  2275. * Function to unfocus an inputText programmatically
  2276. */
  2277. blur(): void;
  2278. protected _getTypeName(): string;
  2279. /**
  2280. * Function called to get the list of controls that should not steal the focus from this control
  2281. * @returns an array of controls
  2282. */
  2283. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  2284. /** @hidden */
  2285. processKey(keyCode: number, key?: string, evt?: BABYLON.IKeyboardEvent): void;
  2286. /** @hidden */
  2287. private _updateValueFromCursorIndex;
  2288. /** @hidden */
  2289. private _processDblClick;
  2290. /** @hidden */
  2291. private _selectAllText;
  2292. /**
  2293. * Handles the keyboard event
  2294. * @param evt Defines the KeyboardEvent
  2295. */
  2296. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  2297. /** @hidden */
  2298. private _onCopyText;
  2299. /** @hidden */
  2300. private _onCutText;
  2301. /** @hidden */
  2302. private _onPasteText;
  2303. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2304. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2305. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  2306. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2307. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  2308. dispose(): void;
  2309. }
  2310. }
  2311. declare module BABYLON.GUI {
  2312. /**
  2313. * Class used to create a 2D grid container
  2314. */
  2315. export class Grid extends Container {
  2316. name?: string | undefined;
  2317. private _rowDefinitions;
  2318. private _columnDefinitions;
  2319. private _cells;
  2320. private _childControls;
  2321. /**
  2322. * Gets the number of columns
  2323. */
  2324. get columnCount(): number;
  2325. /**
  2326. * Gets the number of rows
  2327. */
  2328. get rowCount(): number;
  2329. /** Gets the list of children */
  2330. get children(): Control[];
  2331. /** Gets the list of cells (e.g. the containers) */
  2332. get cells(): {
  2333. [key: string]: Container;
  2334. };
  2335. /**
  2336. * Gets the definition of a specific row
  2337. * @param index defines the index of the row
  2338. * @returns the row definition
  2339. */
  2340. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  2341. /**
  2342. * Gets the definition of a specific column
  2343. * @param index defines the index of the column
  2344. * @returns the column definition
  2345. */
  2346. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  2347. /**
  2348. * Adds a new row to the grid
  2349. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2350. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  2351. * @returns the current grid
  2352. */
  2353. addRowDefinition(height: number, isPixel?: boolean): Grid;
  2354. /**
  2355. * Adds a new column to the grid
  2356. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2357. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2358. * @returns the current grid
  2359. */
  2360. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  2361. /**
  2362. * Update a row definition
  2363. * @param index defines the index of the row to update
  2364. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  2365. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  2366. * @returns the current grid
  2367. */
  2368. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  2369. /**
  2370. * Update a column definition
  2371. * @param index defines the index of the column to update
  2372. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  2373. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  2374. * @returns the current grid
  2375. */
  2376. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  2377. /**
  2378. * Gets the list of children stored in a specific cell
  2379. * @param row defines the row to check
  2380. * @param column defines the column to check
  2381. * @returns the list of controls
  2382. */
  2383. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  2384. /**
  2385. * Gets a string representing the child cell info (row x column)
  2386. * @param child defines the control to get info from
  2387. * @returns a string containing the child cell info (row x column)
  2388. */
  2389. getChildCellInfo(child: Control): string;
  2390. private _removeCell;
  2391. private _offsetCell;
  2392. /**
  2393. * Remove a column definition at specified index
  2394. * @param index defines the index of the column to remove
  2395. * @returns the current grid
  2396. */
  2397. removeColumnDefinition(index: number): Grid;
  2398. /**
  2399. * Remove a row definition at specified index
  2400. * @param index defines the index of the row to remove
  2401. * @returns the current grid
  2402. */
  2403. removeRowDefinition(index: number): Grid;
  2404. /**
  2405. * Adds a new control to the current grid
  2406. * @param control defines the control to add
  2407. * @param row defines the row where to add the control (0 by default)
  2408. * @param column defines the column where to add the control (0 by default)
  2409. * @returns the current grid
  2410. */
  2411. addControl(control: Control, row?: number, column?: number): Grid;
  2412. /**
  2413. * Removes a control from the current container
  2414. * @param control defines the control to remove
  2415. * @returns the current container
  2416. */
  2417. removeControl(control: Control): Container;
  2418. /**
  2419. * Creates a new Grid
  2420. * @param name defines control name
  2421. */
  2422. constructor(name?: string | undefined);
  2423. protected _getTypeName(): string;
  2424. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  2425. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2426. _flagDescendantsAsMatrixDirty(): void;
  2427. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2428. /** Releases associated resources */
  2429. dispose(): void;
  2430. }
  2431. }
  2432. declare module BABYLON.GUI {
  2433. /** Class used to create color pickers */
  2434. export class ColorPicker extends Control {
  2435. name?: string | undefined;
  2436. private static _Epsilon;
  2437. private _colorWheelCanvas;
  2438. private _value;
  2439. private _tmpColor;
  2440. private _pointerStartedOnSquare;
  2441. private _pointerStartedOnWheel;
  2442. private _squareLeft;
  2443. private _squareTop;
  2444. private _squareSize;
  2445. private _h;
  2446. private _s;
  2447. private _v;
  2448. private _lastPointerDownID;
  2449. /**
  2450. * BABYLON.Observable raised when the value changes
  2451. */
  2452. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  2453. /** Gets or sets the color of the color picker */
  2454. get value(): BABYLON.Color3;
  2455. set value(value: BABYLON.Color3);
  2456. /**
  2457. * Gets or sets control width
  2458. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  2459. */
  2460. get width(): string | number;
  2461. set width(value: string | number);
  2462. /**
  2463. * Gets or sets control height
  2464. * @see https://doc.babylonjs.com/how_to/gui#position-and-size
  2465. */
  2466. get height(): string | number;
  2467. /** Gets or sets control height */
  2468. set height(value: string | number);
  2469. /** Gets or sets control size */
  2470. get size(): string | number;
  2471. set size(value: string | number);
  2472. /**
  2473. * Creates a new ColorPicker
  2474. * @param name defines the control name
  2475. */
  2476. constructor(name?: string | undefined);
  2477. protected _getTypeName(): string;
  2478. /** @hidden */
  2479. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2480. private _updateSquareProps;
  2481. private _drawGradientSquare;
  2482. private _drawCircle;
  2483. private _createColorWheelCanvas;
  2484. /** @hidden */
  2485. _draw(context: CanvasRenderingContext2D): void;
  2486. private _pointerIsDown;
  2487. private _updateValueFromPointer;
  2488. private _isPointOnSquare;
  2489. private _isPointOnWheel;
  2490. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2491. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  2492. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  2493. _onCanvasBlur(): void;
  2494. /**
  2495. * This function expands the color picker by creating a color picker dialog with manual
  2496. * color value input and the ability to save colors into an array to be used later in
  2497. * subsequent launches of the dialogue.
  2498. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  2499. * @param options defines size for dialog and options for saved colors. Also accepts last color picked as hex string and saved colors array as hex strings.
  2500. * @returns picked color as a hex string and the saved colors array as hex strings.
  2501. */
  2502. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  2503. pickerWidth?: string;
  2504. pickerHeight?: string;
  2505. headerHeight?: string;
  2506. lastColor?: string;
  2507. swatchLimit?: number;
  2508. numSwatchesPerLine?: number;
  2509. savedColors?: Array<string>;
  2510. }): Promise<{
  2511. savedColors?: string[];
  2512. pickedColor: string;
  2513. }>;
  2514. }
  2515. }
  2516. declare module BABYLON.GUI {
  2517. /** Class used to create 2D ellipse containers */
  2518. export class Ellipse extends Container {
  2519. name?: string | undefined;
  2520. private _thickness;
  2521. /** Gets or sets border thickness */
  2522. get thickness(): number;
  2523. set thickness(value: number);
  2524. /**
  2525. * Creates a new Ellipse
  2526. * @param name defines the control name
  2527. */
  2528. constructor(name?: string | undefined);
  2529. protected _getTypeName(): string;
  2530. protected _localDraw(context: CanvasRenderingContext2D): void;
  2531. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2532. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2533. }
  2534. }
  2535. declare module BABYLON.GUI {
  2536. /**
  2537. * Class used to create a focusable button that can easily handle keyboard events
  2538. */
  2539. export class FocusableButton extends Button implements IFocusableControl {
  2540. name?: string | undefined;
  2541. /** Highlight color when button is focused */
  2542. focusedColor: BABYLON.Nullable<string>;
  2543. private _isFocused;
  2544. private _unfocusedColor;
  2545. /** BABYLON.Observable raised when the control gets the focus */
  2546. onFocusObservable: BABYLON.Observable<Button>;
  2547. /** BABYLON.Observable raised when the control loses the focus */
  2548. onBlurObservable: BABYLON.Observable<Button>;
  2549. /** BABYLON.Observable raised when a key event was processed */
  2550. onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
  2551. constructor(name?: string | undefined);
  2552. /** @hidden */
  2553. onBlur(): void;
  2554. /** @hidden */
  2555. onFocus(): void;
  2556. /**
  2557. * Function called to get the list of controls that should not steal the focus from this control
  2558. * @returns an array of controls
  2559. */
  2560. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  2561. /**
  2562. * Function to focus a button programmatically
  2563. */
  2564. focus(): void;
  2565. /**
  2566. * Function to unfocus a button programmatically
  2567. */
  2568. blur(): void;
  2569. /**
  2570. * Handles the keyboard event
  2571. * @param evt Defines the KeyboardEvent
  2572. */
  2573. processKeyboard(evt: BABYLON.IKeyboardEvent): void;
  2574. /** @hidden */
  2575. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2576. /** @hidden */
  2577. displose(): void;
  2578. }
  2579. }
  2580. declare module BABYLON.GUI {
  2581. /**
  2582. * Class used to create a password control
  2583. */
  2584. export class InputPassword extends InputText {
  2585. protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
  2586. }
  2587. }
  2588. declare module BABYLON.GUI {
  2589. /** Class used to render 2D lines */
  2590. export class Line extends Control {
  2591. name?: string | undefined;
  2592. private _lineWidth;
  2593. private _x1;
  2594. private _y1;
  2595. private _x2;
  2596. private _y2;
  2597. private _dash;
  2598. private _connectedControl;
  2599. private _connectedControlDirtyObserver;
  2600. /** Gets or sets the dash pattern */
  2601. get dash(): Array<number>;
  2602. set dash(value: Array<number>);
  2603. /** Gets or sets the control connected with the line end */
  2604. get connectedControl(): Control;
  2605. set connectedControl(value: Control);
  2606. /** Gets or sets start coordinates on X axis */
  2607. get x1(): string | number;
  2608. set x1(value: string | number);
  2609. /** Gets or sets start coordinates on Y axis */
  2610. get y1(): string | number;
  2611. set y1(value: string | number);
  2612. /** Gets or sets end coordinates on X axis */
  2613. get x2(): string | number;
  2614. set x2(value: string | number);
  2615. /** Gets or sets end coordinates on Y axis */
  2616. get y2(): string | number;
  2617. set y2(value: string | number);
  2618. /** Gets or sets line width */
  2619. get lineWidth(): number;
  2620. set lineWidth(value: number);
  2621. /** Gets or sets horizontal alignment */
  2622. set horizontalAlignment(value: number);
  2623. /** Gets or sets vertical alignment */
  2624. set verticalAlignment(value: number);
  2625. private get _effectiveX2();
  2626. private get _effectiveY2();
  2627. /**
  2628. * Creates a new Line
  2629. * @param name defines the control name
  2630. */
  2631. constructor(name?: string | undefined);
  2632. protected _getTypeName(): string;
  2633. _draw(context: CanvasRenderingContext2D): void;
  2634. _measure(): void;
  2635. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2636. /**
  2637. * Move one end of the line given 3D cartesian coordinates.
  2638. * @param position Targeted world position
  2639. * @param scene BABYLON.Scene
  2640. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2641. */
  2642. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  2643. /**
  2644. * Move one end of the line to a position in screen absolute space.
  2645. * @param projectedPosition Position in screen absolute space (X, Y)
  2646. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  2647. */
  2648. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  2649. }
  2650. }
  2651. declare module BABYLON.GUI {
  2652. /**
  2653. * Class used to store a point for a MultiLine object.
  2654. * The point can be pure 2D coordinates, a mesh or a control
  2655. */
  2656. export class MultiLinePoint {
  2657. private _multiLine;
  2658. private _x;
  2659. private _y;
  2660. private _control;
  2661. private _mesh;
  2662. private _controlObserver;
  2663. private _meshObserver;
  2664. /** @hidden */
  2665. _point: BABYLON.Vector3;
  2666. /**
  2667. * Creates a new MultiLinePoint
  2668. * @param multiLine defines the source MultiLine object
  2669. */
  2670. constructor(multiLine: MultiLine);
  2671. /** Gets or sets x coordinate */
  2672. get x(): string | number;
  2673. set x(value: string | number);
  2674. /** Gets or sets y coordinate */
  2675. get y(): string | number;
  2676. set y(value: string | number);
  2677. /** Gets or sets the control associated with this point */
  2678. get control(): BABYLON.Nullable<Control>;
  2679. set control(value: BABYLON.Nullable<Control>);
  2680. /** Gets or sets the mesh associated with this point */
  2681. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  2682. set mesh(value: BABYLON.Nullable<BABYLON.AbstractMesh>);
  2683. /** Resets links */
  2684. resetLinks(): void;
  2685. /**
  2686. * Gets a translation vector with Z component
  2687. * @returns the translation vector
  2688. */
  2689. translate(): BABYLON.Vector3;
  2690. private _translatePoint;
  2691. /** Release associated resources */
  2692. dispose(): void;
  2693. }
  2694. }
  2695. declare module BABYLON.GUI {
  2696. /**
  2697. * Class used to create multi line control
  2698. */
  2699. export class MultiLine extends Control {
  2700. name?: string | undefined;
  2701. private _lineWidth;
  2702. private _dash;
  2703. private _points;
  2704. private _minX;
  2705. private _minY;
  2706. private _maxX;
  2707. private _maxY;
  2708. /**
  2709. * Creates a new MultiLine
  2710. * @param name defines the control name
  2711. */
  2712. constructor(name?: string | undefined);
  2713. /** Gets or sets dash pattern */
  2714. get dash(): Array<number>;
  2715. set dash(value: Array<number>);
  2716. /**
  2717. * Gets point stored at specified index
  2718. * @param index defines the index to look for
  2719. * @returns the requested point if found
  2720. */
  2721. getAt(index: number): MultiLinePoint;
  2722. /** Function called when a point is updated */
  2723. onPointUpdate: () => void;
  2724. /**
  2725. * Adds new points to the point collection
  2726. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  2727. * @returns the list of created MultiLinePoint
  2728. */
  2729. add(...items: (AbstractMesh | Control | {
  2730. x: string | number;
  2731. y: string | number;
  2732. })[]): MultiLinePoint[];
  2733. /**
  2734. * Adds a new point to the point collection
  2735. * @param item defines the item (mesh, control or 2d coordiantes) to add
  2736. * @returns the created MultiLinePoint
  2737. */
  2738. push(item?: (AbstractMesh | Control | {
  2739. x: string | number;
  2740. y: string | number;
  2741. })): MultiLinePoint;
  2742. /**
  2743. * Remove a specific value or point from the active point collection
  2744. * @param value defines the value or point to remove
  2745. */
  2746. remove(value: number | MultiLinePoint): void;
  2747. /**
  2748. * Resets this object to initial state (no point)
  2749. */
  2750. reset(): void;
  2751. /**
  2752. * Resets all links
  2753. */
  2754. resetLinks(): void;
  2755. /** Gets or sets line width */
  2756. get lineWidth(): number;
  2757. set lineWidth(value: number);
  2758. set horizontalAlignment(value: number);
  2759. set verticalAlignment(value: number);
  2760. protected _getTypeName(): string;
  2761. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2762. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2763. _measure(): void;
  2764. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2765. dispose(): void;
  2766. }
  2767. }
  2768. declare module BABYLON.GUI {
  2769. /**
  2770. * Class used to create radio button controls
  2771. */
  2772. export class RadioButton extends Control {
  2773. name?: string | undefined;
  2774. private _isChecked;
  2775. private _background;
  2776. private _checkSizeRatio;
  2777. private _thickness;
  2778. /** Gets or sets border thickness */
  2779. get thickness(): number;
  2780. set thickness(value: number);
  2781. /** Gets or sets group name */
  2782. group: string;
  2783. /** BABYLON.Observable raised when isChecked is changed */
  2784. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  2785. /** Gets or sets a value indicating the ratio between overall size and check size */
  2786. get checkSizeRatio(): number;
  2787. set checkSizeRatio(value: number);
  2788. /** Gets or sets background color */
  2789. get background(): string;
  2790. set background(value: string);
  2791. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  2792. get isChecked(): boolean;
  2793. set isChecked(value: boolean);
  2794. /**
  2795. * Creates a new RadioButton
  2796. * @param name defines the control name
  2797. */
  2798. constructor(name?: string | undefined);
  2799. protected _getTypeName(): string;
  2800. _draw(context: CanvasRenderingContext2D): void;
  2801. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2802. /**
  2803. * Utility function to easily create a radio button with a header
  2804. * @param title defines the label to use for the header
  2805. * @param group defines the group to use for the radio button
  2806. * @param isChecked defines the initial state of the radio button
  2807. * @param onValueChanged defines the callback to call when value changes
  2808. * @returns a StackPanel containing the radio button and a textBlock
  2809. */
  2810. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  2811. }
  2812. }
  2813. declare module BABYLON.GUI {
  2814. /**
  2815. * Class used to create slider controls
  2816. */
  2817. export class BaseSlider extends Control {
  2818. name?: string | undefined;
  2819. protected _thumbWidth: ValueAndUnit;
  2820. private _minimum;
  2821. private _maximum;
  2822. private _value;
  2823. private _isVertical;
  2824. protected _barOffset: ValueAndUnit;
  2825. private _isThumbClamped;
  2826. protected _displayThumb: boolean;
  2827. private _step;
  2828. private _lastPointerDownID;
  2829. protected _effectiveBarOffset: number;
  2830. protected _renderLeft: number;
  2831. protected _renderTop: number;
  2832. protected _renderWidth: number;
  2833. protected _renderHeight: number;
  2834. protected _backgroundBoxLength: number;
  2835. protected _backgroundBoxThickness: number;
  2836. protected _effectiveThumbThickness: number;
  2837. /** BABYLON.Observable raised when the sldier value changes */
  2838. onValueChangedObservable: BABYLON.Observable<number>;
  2839. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2840. get displayThumb(): boolean;
  2841. set displayThumb(value: boolean);
  2842. /** Gets or sets a step to apply to values (0 by default) */
  2843. get step(): number;
  2844. set step(value: number);
  2845. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2846. get barOffset(): string | number;
  2847. /** Gets main bar offset in pixels*/
  2848. get barOffsetInPixels(): number;
  2849. set barOffset(value: string | number);
  2850. /** Gets or sets thumb width */
  2851. get thumbWidth(): string | number;
  2852. /** Gets thumb width in pixels */
  2853. get thumbWidthInPixels(): number;
  2854. set thumbWidth(value: string | number);
  2855. /** Gets or sets minimum value */
  2856. get minimum(): number;
  2857. set minimum(value: number);
  2858. /** Gets or sets maximum value */
  2859. get maximum(): number;
  2860. set maximum(value: number);
  2861. /** Gets or sets current value */
  2862. get value(): number;
  2863. set value(value: number);
  2864. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2865. get isVertical(): boolean;
  2866. set isVertical(value: boolean);
  2867. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2868. get isThumbClamped(): boolean;
  2869. set isThumbClamped(value: boolean);
  2870. /**
  2871. * Creates a new BaseSlider
  2872. * @param name defines the control name
  2873. */
  2874. constructor(name?: string | undefined);
  2875. protected _getTypeName(): string;
  2876. protected _getThumbPosition(): number;
  2877. protected _getThumbThickness(type: string): number;
  2878. protected _prepareRenderingData(type: string): void;
  2879. private _pointerIsDown;
  2880. /** @hidden */
  2881. protected _updateValueFromPointer(x: number, y: number): void;
  2882. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  2883. _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
  2884. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2885. _onCanvasBlur(): void;
  2886. }
  2887. }
  2888. declare module BABYLON.GUI {
  2889. /**
  2890. * Class used to create slider controls
  2891. */
  2892. export class Slider extends BaseSlider {
  2893. name?: string | undefined;
  2894. private _background;
  2895. private _borderColor;
  2896. private _thumbColor;
  2897. private _isThumbCircle;
  2898. protected _displayValueBar: boolean;
  2899. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2900. get displayValueBar(): boolean;
  2901. set displayValueBar(value: boolean);
  2902. /** Gets or sets border color */
  2903. get borderColor(): string;
  2904. set borderColor(value: string);
  2905. /** Gets or sets background color */
  2906. get background(): string;
  2907. set background(value: string);
  2908. /** Gets or sets thumb's color */
  2909. get thumbColor(): string;
  2910. set thumbColor(value: string);
  2911. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2912. get isThumbCircle(): boolean;
  2913. set isThumbCircle(value: boolean);
  2914. /**
  2915. * Creates a new Slider
  2916. * @param name defines the control name
  2917. */
  2918. constructor(name?: string | undefined);
  2919. protected _getTypeName(): string;
  2920. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  2921. }
  2922. }
  2923. declare module BABYLON.GUI {
  2924. /** Class used to create a RadioGroup
  2925. * which contains groups of radio buttons
  2926. */
  2927. export class SelectorGroup {
  2928. /** name of SelectorGroup */
  2929. name: string;
  2930. private _groupPanel;
  2931. private _selectors;
  2932. private _groupHeader;
  2933. /**
  2934. * Creates a new SelectorGroup
  2935. * @param name of group, used as a group heading
  2936. */
  2937. constructor(
  2938. /** name of SelectorGroup */
  2939. name: string);
  2940. /** Gets the groupPanel of the SelectorGroup */
  2941. get groupPanel(): StackPanel;
  2942. /** Gets the selectors array */
  2943. get selectors(): StackPanel[];
  2944. /** Gets and sets the group header */
  2945. get header(): string;
  2946. set header(label: string);
  2947. /** @hidden */
  2948. private _addGroupHeader;
  2949. /** @hidden*/
  2950. _getSelector(selectorNb: number): StackPanel | undefined;
  2951. /** Removes the selector at the given position
  2952. * @param selectorNb the position of the selector within the group
  2953. */
  2954. removeSelector(selectorNb: number): void;
  2955. }
  2956. /** Class used to create a CheckboxGroup
  2957. * which contains groups of checkbox buttons
  2958. */
  2959. export class CheckboxGroup extends SelectorGroup {
  2960. /** Adds a checkbox as a control
  2961. * @param text is the label for the selector
  2962. * @param func is the function called when the Selector is checked
  2963. * @param checked is true when Selector is checked
  2964. */
  2965. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  2966. /** @hidden */
  2967. _setSelectorLabel(selectorNb: number, label: string): void;
  2968. /** @hidden */
  2969. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2970. /** @hidden */
  2971. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2972. /** @hidden */
  2973. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2974. }
  2975. /** Class used to create a RadioGroup
  2976. * which contains groups of radio buttons
  2977. */
  2978. export class RadioGroup extends SelectorGroup {
  2979. private _selectNb;
  2980. /** Adds a radio button as a control
  2981. * @param label is the label for the selector
  2982. * @param func is the function called when the Selector is checked
  2983. * @param checked is true when Selector is checked
  2984. */
  2985. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  2986. /** @hidden */
  2987. _setSelectorLabel(selectorNb: number, label: string): void;
  2988. /** @hidden */
  2989. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2990. /** @hidden */
  2991. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2992. /** @hidden */
  2993. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2994. }
  2995. /** Class used to create a SliderGroup
  2996. * which contains groups of slider buttons
  2997. */
  2998. export class SliderGroup extends SelectorGroup {
  2999. /**
  3000. * Adds a slider to the SelectorGroup
  3001. * @param label is the label for the SliderBar
  3002. * @param func is the function called when the Slider moves
  3003. * @param unit is a string describing the units used, eg degrees or metres
  3004. * @param min is the minimum value for the Slider
  3005. * @param max is the maximum value for the Slider
  3006. * @param value is the start value for the Slider between min and max
  3007. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  3008. */
  3009. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  3010. /** @hidden */
  3011. _setSelectorLabel(selectorNb: number, label: string): void;
  3012. /** @hidden */
  3013. _setSelectorLabelColor(selectorNb: number, color: string): void;
  3014. /** @hidden */
  3015. _setSelectorButtonColor(selectorNb: number, color: string): void;
  3016. /** @hidden */
  3017. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  3018. }
  3019. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  3020. * @see https://doc.babylonjs.com/how_to/selector
  3021. */
  3022. export class SelectionPanel extends Rectangle {
  3023. /** name of SelectionPanel */
  3024. name: string;
  3025. /** an array of SelectionGroups */
  3026. groups: SelectorGroup[];
  3027. private _panel;
  3028. private _buttonColor;
  3029. private _buttonBackground;
  3030. private _headerColor;
  3031. private _barColor;
  3032. private _barHeight;
  3033. private _spacerHeight;
  3034. private _labelColor;
  3035. private _groups;
  3036. private _bars;
  3037. /**
  3038. * Creates a new SelectionPanel
  3039. * @param name of SelectionPanel
  3040. * @param groups is an array of SelectionGroups
  3041. */
  3042. constructor(
  3043. /** name of SelectionPanel */
  3044. name: string,
  3045. /** an array of SelectionGroups */
  3046. groups?: SelectorGroup[]);
  3047. protected _getTypeName(): string;
  3048. /** Gets the (stack) panel of the SelectionPanel */
  3049. get panel(): StackPanel;
  3050. /** Gets or sets the headerColor */
  3051. get headerColor(): string;
  3052. set headerColor(color: string);
  3053. private _setHeaderColor;
  3054. /** Gets or sets the button color */
  3055. get buttonColor(): string;
  3056. set buttonColor(color: string);
  3057. private _setbuttonColor;
  3058. /** Gets or sets the label color */
  3059. get labelColor(): string;
  3060. set labelColor(color: string);
  3061. private _setLabelColor;
  3062. /** Gets or sets the button background */
  3063. get buttonBackground(): string;
  3064. set buttonBackground(color: string);
  3065. private _setButtonBackground;
  3066. /** Gets or sets the color of separator bar */
  3067. get barColor(): string;
  3068. set barColor(color: string);
  3069. private _setBarColor;
  3070. /** Gets or sets the height of separator bar */
  3071. get barHeight(): string;
  3072. set barHeight(value: string);
  3073. private _setBarHeight;
  3074. /** Gets or sets the height of spacers*/
  3075. get spacerHeight(): string;
  3076. set spacerHeight(value: string);
  3077. private _setSpacerHeight;
  3078. /** Adds a bar between groups */
  3079. private _addSpacer;
  3080. /** Add a group to the selection panel
  3081. * @param group is the selector group to add
  3082. */
  3083. addGroup(group: SelectorGroup): void;
  3084. /** Remove the group from the given position
  3085. * @param groupNb is the position of the group in the list
  3086. */
  3087. removeGroup(groupNb: number): void;
  3088. /** Change a group header label
  3089. * @param label is the new group header label
  3090. * @param groupNb is the number of the group to relabel
  3091. * */
  3092. setHeaderName(label: string, groupNb: number): void;
  3093. /** Change selector label to the one given
  3094. * @param label is the new selector label
  3095. * @param groupNb is the number of the groupcontaining the selector
  3096. * @param selectorNb is the number of the selector within a group to relabel
  3097. * */
  3098. relabel(label: string, groupNb: number, selectorNb: number): void;
  3099. /** For a given group position remove the selector at the given position
  3100. * @param groupNb is the number of the group to remove the selector from
  3101. * @param selectorNb is the number of the selector within the group
  3102. */
  3103. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  3104. /** For a given group position of correct type add a checkbox button
  3105. * @param groupNb is the number of the group to remove the selector from
  3106. * @param label is the label for the selector
  3107. * @param func is the function called when the Selector is checked
  3108. * @param checked is true when Selector is checked
  3109. */
  3110. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  3111. /** For a given group position of correct type add a radio button
  3112. * @param groupNb is the number of the group to remove the selector from
  3113. * @param label is the label for the selector
  3114. * @param func is the function called when the Selector is checked
  3115. * @param checked is true when Selector is checked
  3116. */
  3117. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  3118. /**
  3119. * For a given slider group add a slider
  3120. * @param groupNb is the number of the group to add the slider to
  3121. * @param label is the label for the Slider
  3122. * @param func is the function called when the Slider moves
  3123. * @param unit is a string describing the units used, eg degrees or metres
  3124. * @param min is the minimum value for the Slider
  3125. * @param max is the maximum value for the Slider
  3126. * @param value is the start value for the Slider between min and max
  3127. * @param onVal is the function used to format the value displayed, eg radians to degrees
  3128. */
  3129. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  3130. }
  3131. }
  3132. declare module BABYLON.GUI {
  3133. /**
  3134. * Class used to hold a the container for ScrollViewer
  3135. * @hidden
  3136. */
  3137. export class _ScrollViewerWindow extends Container {
  3138. parentClientWidth: number;
  3139. parentClientHeight: number;
  3140. private _freezeControls;
  3141. private _parentMeasure;
  3142. private _oldLeft;
  3143. private _oldTop;
  3144. get freezeControls(): boolean;
  3145. set freezeControls(value: boolean);
  3146. private _bucketWidth;
  3147. private _bucketHeight;
  3148. private _buckets;
  3149. private _bucketLen;
  3150. get bucketWidth(): number;
  3151. get bucketHeight(): number;
  3152. setBucketSizes(width: number, height: number): void;
  3153. private _useBuckets;
  3154. private _makeBuckets;
  3155. private _dispatchInBuckets;
  3156. private _updateMeasures;
  3157. private _updateChildrenMeasures;
  3158. private _restoreMeasures;
  3159. /**
  3160. * Creates a new ScrollViewerWindow
  3161. * @param name of ScrollViewerWindow
  3162. */
  3163. constructor(name?: string);
  3164. protected _getTypeName(): string;
  3165. /** @hidden */
  3166. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3167. /** @hidden */
  3168. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3169. private _scrollChildren;
  3170. private _scrollChildrenWithBuckets;
  3171. /** @hidden */
  3172. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  3173. protected _postMeasure(): void;
  3174. }
  3175. }
  3176. declare module BABYLON.GUI {
  3177. /**
  3178. * Class used to create slider controls
  3179. */
  3180. export class ScrollBar extends BaseSlider {
  3181. name?: string | undefined;
  3182. private _background;
  3183. private _borderColor;
  3184. private _tempMeasure;
  3185. /** Gets or sets border color */
  3186. get borderColor(): string;
  3187. set borderColor(value: string);
  3188. /** Gets or sets background color */
  3189. get background(): string;
  3190. set background(value: string);
  3191. /**
  3192. * Creates a new Slider
  3193. * @param name defines the control name
  3194. */
  3195. constructor(name?: string | undefined);
  3196. protected _getTypeName(): string;
  3197. protected _getThumbThickness(): number;
  3198. _draw(context: CanvasRenderingContext2D): void;
  3199. private _first;
  3200. private _originX;
  3201. private _originY;
  3202. /** @hidden */
  3203. protected _updateValueFromPointer(x: number, y: number): void;
  3204. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  3205. }
  3206. }
  3207. declare module BABYLON.GUI {
  3208. /**
  3209. * Class used to create slider controls
  3210. */
  3211. export class ImageScrollBar extends BaseSlider {
  3212. name?: string | undefined;
  3213. private _backgroundBaseImage;
  3214. private _backgroundImage;
  3215. private _thumbImage;
  3216. private _thumbBaseImage;
  3217. private _thumbLength;
  3218. private _thumbHeight;
  3219. private _barImageHeight;
  3220. private _tempMeasure;
  3221. /** Number of 90° rotation to apply on the images when in vertical mode */
  3222. num90RotationInVerticalMode: number;
  3223. /**
  3224. * Gets or sets the image used to render the background for horizontal bar
  3225. */
  3226. get backgroundImage(): Image;
  3227. set backgroundImage(value: Image);
  3228. /**
  3229. * Gets or sets the image used to render the thumb
  3230. */
  3231. get thumbImage(): Image;
  3232. set thumbImage(value: Image);
  3233. /**
  3234. * Gets or sets the length of the thumb
  3235. */
  3236. get thumbLength(): number;
  3237. set thumbLength(value: number);
  3238. /**
  3239. * Gets or sets the height of the thumb
  3240. */
  3241. get thumbHeight(): number;
  3242. set thumbHeight(value: number);
  3243. /**
  3244. * Gets or sets the height of the bar image
  3245. */
  3246. get barImageHeight(): number;
  3247. set barImageHeight(value: number);
  3248. /**
  3249. * Creates a new ImageScrollBar
  3250. * @param name defines the control name
  3251. */
  3252. constructor(name?: string | undefined);
  3253. protected _getTypeName(): string;
  3254. protected _getThumbThickness(): number;
  3255. _draw(context: CanvasRenderingContext2D): void;
  3256. private _first;
  3257. private _originX;
  3258. private _originY;
  3259. /** @hidden */
  3260. protected _updateValueFromPointer(x: number, y: number): void;
  3261. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  3262. }
  3263. }
  3264. declare module BABYLON.GUI {
  3265. /**
  3266. * Class used to hold a viewer window and sliders in a grid
  3267. */
  3268. export class ScrollViewer extends Rectangle {
  3269. private _grid;
  3270. private _horizontalBarSpace;
  3271. private _verticalBarSpace;
  3272. private _dragSpace;
  3273. private _horizontalBar;
  3274. private _verticalBar;
  3275. private _barColor;
  3276. private _barBackground;
  3277. private _barImage;
  3278. private _horizontalBarImage;
  3279. private _verticalBarImage;
  3280. private _barBackgroundImage;
  3281. private _horizontalBarBackgroundImage;
  3282. private _verticalBarBackgroundImage;
  3283. private _barSize;
  3284. private _window;
  3285. private _pointerIsOver;
  3286. private _wheelPrecision;
  3287. private _onWheelObserver;
  3288. private _clientWidth;
  3289. private _clientHeight;
  3290. private _useImageBar;
  3291. private _thumbLength;
  3292. private _thumbHeight;
  3293. private _barImageHeight;
  3294. private _horizontalBarImageHeight;
  3295. private _verticalBarImageHeight;
  3296. private _oldWindowContentsWidth;
  3297. private _oldWindowContentsHeight;
  3298. /**
  3299. * Gets the horizontal scrollbar
  3300. */
  3301. get horizontalBar(): ScrollBar | ImageScrollBar;
  3302. /**
  3303. * Gets the vertical scrollbar
  3304. */
  3305. get verticalBar(): ScrollBar | ImageScrollBar;
  3306. /**
  3307. * Adds a new control to the current container
  3308. * @param control defines the control to add
  3309. * @returns the current container
  3310. */
  3311. addControl(control: BABYLON.Nullable<Control>): Container;
  3312. /**
  3313. * Removes a control from the current container
  3314. * @param control defines the control to remove
  3315. * @returns the current container
  3316. */
  3317. removeControl(control: Control): Container;
  3318. /** Gets the list of children */
  3319. get children(): Control[];
  3320. _flagDescendantsAsMatrixDirty(): void;
  3321. /**
  3322. * Freezes or unfreezes the controls in the window.
  3323. * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls
  3324. * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again
  3325. */
  3326. get freezeControls(): boolean;
  3327. set freezeControls(value: boolean);
  3328. /** Gets the bucket width */
  3329. get bucketWidth(): number;
  3330. /** Gets the bucket height */
  3331. get bucketHeight(): number;
  3332. /**
  3333. * Sets the bucket sizes.
  3334. * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only
  3335. * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which
  3336. * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of
  3337. * the window. To disable the usage of buckets, sets either width or height (or both) to 0.
  3338. * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory
  3339. * used), that's why it is not enabled by default.
  3340. * @param width width of the bucket
  3341. * @param height height of the bucket
  3342. */
  3343. setBucketSizes(width: number, height: number): void;
  3344. private _forceHorizontalBar;
  3345. private _forceVerticalBar;
  3346. /**
  3347. * Forces the horizontal scroll bar to be displayed
  3348. */
  3349. get forceHorizontalBar(): boolean;
  3350. set forceHorizontalBar(value: boolean);
  3351. /**
  3352. * Forces the vertical scroll bar to be displayed
  3353. */
  3354. get forceVerticalBar(): boolean;
  3355. set forceVerticalBar(value: boolean);
  3356. /**
  3357. * Creates a new ScrollViewer
  3358. * @param name of ScrollViewer
  3359. */
  3360. constructor(name?: string, isImageBased?: boolean);
  3361. /** Reset the scroll viewer window to initial size */
  3362. resetWindow(): void;
  3363. protected _getTypeName(): string;
  3364. private _buildClientSizes;
  3365. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3366. protected _postMeasure(): void;
  3367. /**
  3368. * Gets or sets the mouse wheel precision
  3369. * from 0 to 1 with a default value of 0.05
  3370. * */
  3371. get wheelPrecision(): number;
  3372. set wheelPrecision(value: number);
  3373. /** Gets or sets the scroll bar container background color */
  3374. get scrollBackground(): string;
  3375. set scrollBackground(color: string);
  3376. /** Gets or sets the bar color */
  3377. get barColor(): string;
  3378. set barColor(color: string);
  3379. /** Gets or sets the bar image */
  3380. get thumbImage(): Image;
  3381. set thumbImage(value: Image);
  3382. /** Gets or sets the horizontal bar image */
  3383. get horizontalThumbImage(): Image;
  3384. set horizontalThumbImage(value: Image);
  3385. /** Gets or sets the vertical bar image */
  3386. get verticalThumbImage(): Image;
  3387. set verticalThumbImage(value: Image);
  3388. /** Gets or sets the size of the bar */
  3389. get barSize(): number;
  3390. set barSize(value: number);
  3391. /** Gets or sets the length of the thumb */
  3392. get thumbLength(): number;
  3393. set thumbLength(value: number);
  3394. /** Gets or sets the height of the thumb */
  3395. get thumbHeight(): number;
  3396. set thumbHeight(value: number);
  3397. /** Gets or sets the height of the bar image */
  3398. get barImageHeight(): number;
  3399. set barImageHeight(value: number);
  3400. /** Gets or sets the height of the horizontal bar image */
  3401. get horizontalBarImageHeight(): number;
  3402. set horizontalBarImageHeight(value: number);
  3403. /** Gets or sets the height of the vertical bar image */
  3404. get verticalBarImageHeight(): number;
  3405. set verticalBarImageHeight(value: number);
  3406. /** Gets or sets the bar background */
  3407. get barBackground(): string;
  3408. set barBackground(color: string);
  3409. /** Gets or sets the bar background image */
  3410. get barImage(): Image;
  3411. set barImage(value: Image);
  3412. /** Gets or sets the horizontal bar background image */
  3413. get horizontalBarImage(): Image;
  3414. set horizontalBarImage(value: Image);
  3415. /** Gets or sets the vertical bar background image */
  3416. get verticalBarImage(): Image;
  3417. set verticalBarImage(value: Image);
  3418. private _setWindowPosition;
  3419. /** @hidden */
  3420. private _updateScroller;
  3421. _link(host: AdvancedDynamicTexture): void;
  3422. /** @hidden */
  3423. private _addBar;
  3424. /** @hidden */
  3425. private _attachWheel;
  3426. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  3427. /** Releases associated resources */
  3428. dispose(): void;
  3429. }
  3430. }
  3431. declare module BABYLON.GUI {
  3432. /**
  3433. * Class used to create toggle buttons
  3434. */
  3435. export class ToggleButton extends Rectangle {
  3436. name?: string | undefined;
  3437. /**
  3438. * Function called to generate the toActive animation
  3439. */
  3440. toActiveAnimation: () => void;
  3441. /**
  3442. * Function called to generate the toInactive animation
  3443. */
  3444. toInactiveAnimation: () => void;
  3445. /**
  3446. * Function called to generate a pointer enter animation when the toggle button is active.
  3447. */
  3448. pointerEnterActiveAnimation: () => void;
  3449. /**
  3450. * Function called to generate a pointer out animation when the toggle button is active.
  3451. */
  3452. pointerOutActiveAnimation: () => void;
  3453. /**
  3454. * Function called to generate a pointer down animation when the toggle button is active.
  3455. */
  3456. pointerDownActiveAnimation: () => void;
  3457. /**
  3458. * Function called to generate a pointer up animation when the toggle button is active.
  3459. */
  3460. pointerUpActiveAnimation: () => void;
  3461. /**
  3462. * Function called to generate a pointer enter animation when the toggle button is inactive.
  3463. */
  3464. pointerEnterInactiveAnimation: () => void;
  3465. /**
  3466. * Function called to generate a pointer out animation when the toggle button is inactive.
  3467. */
  3468. pointerOutInactiveAnimation: () => void;
  3469. /**
  3470. * Function called to generate a pointer down animation when the toggle button is inactive.
  3471. */
  3472. pointerDownInactiveAnimation: () => void;
  3473. /**
  3474. * Function called to generate a pointer up animation when the toggle button is inactive.
  3475. */
  3476. pointerUpInactiveAnimation: () => void;
  3477. /** BABYLON.Observable raised when isActive is changed */
  3478. onIsActiveChangedObservable: BABYLON.Observable<boolean>;
  3479. /**
  3480. * Gets or sets a boolean indicating that the toggle button will let internal controls handle picking instead of doing it directly using its bounding info
  3481. */
  3482. delegatePickingToChildren: boolean;
  3483. private _image;
  3484. /**
  3485. * Returns the ToggleButton's image control if it exists
  3486. */
  3487. get image(): BABYLON.Nullable<Image>;
  3488. private _textBlock;
  3489. /**
  3490. * Returns the ToggleButton's child TextBlock control if it exists
  3491. */
  3492. get textBlock(): BABYLON.Nullable<TextBlock>;
  3493. private _group;
  3494. /** Gets or sets group name this toggle button belongs to */
  3495. get group(): string;
  3496. set group(value: string);
  3497. private _isActive;
  3498. /** Gets or sets a boolean indicating if the toogle button is active or not */
  3499. get isActive(): boolean;
  3500. set isActive(value: boolean);
  3501. /**
  3502. * Creates a new ToggleButton
  3503. * @param name defines the control name
  3504. * @param group defines the toggle group this toggle belongs to
  3505. */
  3506. constructor(name?: string | undefined, group?: string);
  3507. protected _getTypeName(): string;
  3508. /** @hidden */
  3509. _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
  3510. /** @hidden */
  3511. _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
  3512. /** @hidden */
  3513. _onPointerOut(target: Control, pi: BABYLON.PointerInfoBase, force?: boolean): void;
  3514. /** @hidden */
  3515. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
  3516. /** @hidden */
  3517. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: BABYLON.PointerInfoBase): void;
  3518. }
  3519. }
  3520. declare module BABYLON.GUI {
  3521. /** Class used to render a grid */
  3522. export class DisplayGrid extends Control {
  3523. name?: string | undefined;
  3524. private _cellWidth;
  3525. private _cellHeight;
  3526. private _minorLineTickness;
  3527. private _minorLineColor;
  3528. private _majorLineTickness;
  3529. private _majorLineColor;
  3530. private _majorLineFrequency;
  3531. private _background;
  3532. private _displayMajorLines;
  3533. private _displayMinorLines;
  3534. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  3535. get displayMinorLines(): boolean;
  3536. set displayMinorLines(value: boolean);
  3537. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  3538. get displayMajorLines(): boolean;
  3539. set displayMajorLines(value: boolean);
  3540. /** Gets or sets background color (Black by default) */
  3541. get background(): string;
  3542. set background(value: string);
  3543. /** Gets or sets the width of each cell (20 by default) */
  3544. get cellWidth(): number;
  3545. set cellWidth(value: number);
  3546. /** Gets or sets the height of each cell (20 by default) */
  3547. get cellHeight(): number;
  3548. set cellHeight(value: number);
  3549. /** Gets or sets the tickness of minor lines (1 by default) */
  3550. get minorLineTickness(): number;
  3551. set minorLineTickness(value: number);
  3552. /** Gets or sets the color of minor lines (DarkGray by default) */
  3553. get minorLineColor(): string;
  3554. set minorLineColor(value: string);
  3555. /** Gets or sets the tickness of major lines (2 by default) */
  3556. get majorLineTickness(): number;
  3557. set majorLineTickness(value: number);
  3558. /** Gets or sets the color of major lines (White by default) */
  3559. get majorLineColor(): string;
  3560. set majorLineColor(value: string);
  3561. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  3562. get majorLineFrequency(): number;
  3563. set majorLineFrequency(value: number);
  3564. /**
  3565. * Creates a new GridDisplayRectangle
  3566. * @param name defines the control name
  3567. */
  3568. constructor(name?: string | undefined);
  3569. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  3570. protected _getTypeName(): string;
  3571. }
  3572. }
  3573. declare module BABYLON.GUI {
  3574. /**
  3575. * Class used to create slider controls based on images
  3576. */
  3577. export class ImageBasedSlider extends BaseSlider {
  3578. name?: string | undefined;
  3579. private _backgroundImage;
  3580. private _thumbImage;
  3581. private _valueBarImage;
  3582. private _tempMeasure;
  3583. get displayThumb(): boolean;
  3584. set displayThumb(value: boolean);
  3585. /**
  3586. * Gets or sets the image used to render the background
  3587. */
  3588. get backgroundImage(): Image;
  3589. set backgroundImage(value: Image);
  3590. /**
  3591. * Gets or sets the image used to render the value bar
  3592. */
  3593. get valueBarImage(): Image;
  3594. set valueBarImage(value: Image);
  3595. /**
  3596. * Gets or sets the image used to render the thumb
  3597. */
  3598. get thumbImage(): Image;
  3599. set thumbImage(value: Image);
  3600. /**
  3601. * Creates a new ImageBasedSlider
  3602. * @param name defines the control name
  3603. */
  3604. constructor(name?: string | undefined);
  3605. protected _getTypeName(): string;
  3606. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  3607. }
  3608. }
  3609. declare module BABYLON.GUI {
  3610. /**
  3611. * Forcing an export so that this code will execute
  3612. * @hidden
  3613. */
  3614. const name = "Statics";
  3615. }
  3616. declare module BABYLON.GUI {
  3617. /**
  3618. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  3619. */
  3620. export class AdvancedDynamicTextureInstrumentation implements BABYLON.IDisposable {
  3621. /**
  3622. * Define the instrumented AdvancedDynamicTexture.
  3623. */
  3624. texture: AdvancedDynamicTexture;
  3625. private _captureRenderTime;
  3626. private _renderTime;
  3627. private _captureLayoutTime;
  3628. private _layoutTime;
  3629. private _onBeginRenderObserver;
  3630. private _onEndRenderObserver;
  3631. private _onBeginLayoutObserver;
  3632. private _onEndLayoutObserver;
  3633. /**
  3634. * Gets the perf counter used to capture render time
  3635. */
  3636. get renderTimeCounter(): BABYLON.PerfCounter;
  3637. /**
  3638. * Gets the perf counter used to capture layout time
  3639. */
  3640. get layoutTimeCounter(): BABYLON.PerfCounter;
  3641. /**
  3642. * Enable or disable the render time capture
  3643. */
  3644. get captureRenderTime(): boolean;
  3645. set captureRenderTime(value: boolean);
  3646. /**
  3647. * Enable or disable the layout time capture
  3648. */
  3649. get captureLayoutTime(): boolean;
  3650. set captureLayoutTime(value: boolean);
  3651. /**
  3652. * Instantiates a new advanced dynamic texture instrumentation.
  3653. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  3654. * @param texture Defines the AdvancedDynamicTexture to instrument
  3655. */
  3656. constructor(
  3657. /**
  3658. * Define the instrumented AdvancedDynamicTexture.
  3659. */
  3660. texture: AdvancedDynamicTexture);
  3661. /**
  3662. * Dispose and release associated resources.
  3663. */
  3664. dispose(): void;
  3665. }
  3666. }
  3667. declare module BABYLON.GUI {
  3668. /**
  3669. * Class used to load GUI via XML.
  3670. */
  3671. export class XmlLoader {
  3672. private _nodes;
  3673. private _nodeTypes;
  3674. private _isLoaded;
  3675. private _objectAttributes;
  3676. private _parentClass;
  3677. /**
  3678. * Create a new xml loader
  3679. * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context
  3680. */
  3681. constructor(parentClass?: null);
  3682. private _getChainElement;
  3683. private _getClassAttribute;
  3684. private _createGuiElement;
  3685. private _parseGrid;
  3686. private _parseElement;
  3687. private _prepareSourceElement;
  3688. private _parseElementsFromSource;
  3689. private _parseXml;
  3690. /**
  3691. * Gets if the loading has finished.
  3692. * @returns whether the loading has finished or not
  3693. */
  3694. isLoaded(): boolean;
  3695. /**
  3696. * Gets a loaded node / control by id.
  3697. * @param id the Controls id set in the xml
  3698. * @returns element of type Control
  3699. */
  3700. getNodeById(id: string): any;
  3701. /**
  3702. * Gets all loaded nodes / controls
  3703. * @returns Array of controls
  3704. */
  3705. getNodes(): any;
  3706. /**
  3707. * Initiates the xml layout loading
  3708. * @param xmlFile defines the xml layout to load
  3709. * @param rootNode defines the node / control to use as a parent for the loaded layout controls.
  3710. * @param callback defines the callback called on layout load.
  3711. */
  3712. loadLayout(xmlFile: any, rootNode: any, callback: any): void;
  3713. }
  3714. }
  3715. declare module BABYLON.GUI {
  3716. /**
  3717. * Class used to create containers for controls
  3718. */
  3719. export class Container3D extends Control3D {
  3720. private _blockLayout;
  3721. /**
  3722. * Gets the list of child controls
  3723. */
  3724. protected _children: Control3D[];
  3725. /**
  3726. * Gets the list of child controls
  3727. */
  3728. get children(): Array<Control3D>;
  3729. /**
  3730. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  3731. * This is helpful to optimize layout operation when adding multiple children in a row
  3732. */
  3733. get blockLayout(): boolean;
  3734. set blockLayout(value: boolean);
  3735. /**
  3736. * Creates a new container
  3737. * @param name defines the container name
  3738. */
  3739. constructor(name?: string);
  3740. /**
  3741. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  3742. * @returns the current container
  3743. */
  3744. updateLayout(): Container3D;
  3745. /**
  3746. * Gets a boolean indicating if the given control is in the children of this control
  3747. * @param control defines the control to check
  3748. * @returns true if the control is in the child list
  3749. */
  3750. containsControl(control: Control3D): boolean;
  3751. /**
  3752. * Adds a control to the children of this control
  3753. * @param control defines the control to add
  3754. * @returns the current container
  3755. */
  3756. addControl(control: Control3D): Container3D;
  3757. /**
  3758. * This function will be called everytime a new control is added
  3759. */
  3760. protected _arrangeChildren(): void;
  3761. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  3762. /**
  3763. * Removes a control from the children of this control
  3764. * @param control defines the control to remove
  3765. * @returns the current container
  3766. */
  3767. removeControl(control: Control3D): Container3D;
  3768. protected _getTypeName(): string;
  3769. /**
  3770. * Releases all associated resources
  3771. */
  3772. dispose(): void;
  3773. /** Control rotation will remain unchanged */
  3774. static readonly UNSET_ORIENTATION: number;
  3775. /** Control will rotate to make it look at sphere central axis */
  3776. static readonly FACEORIGIN_ORIENTATION: number;
  3777. /** Control will rotate to make it look back at sphere central axis */
  3778. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  3779. /** Control will rotate to look at z axis (0, 0, 1) */
  3780. static readonly FACEFORWARD_ORIENTATION: number;
  3781. /** Control will rotate to look at negative z axis (0, 0, -1) */
  3782. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  3783. }
  3784. }
  3785. declare module BABYLON.GUI {
  3786. /**
  3787. * Class used to create a button in 3D
  3788. */
  3789. export class Button3D extends AbstractButton3D {
  3790. /** @hidden */
  3791. protected _currentMaterial: BABYLON.Material;
  3792. private _facadeTexture;
  3793. private _content;
  3794. private _contentResolution;
  3795. private _contentScaleRatio;
  3796. /**
  3797. * Gets or sets the texture resolution used to render content (512 by default)
  3798. */
  3799. get contentResolution(): BABYLON.int;
  3800. set contentResolution(value: BABYLON.int);
  3801. /**
  3802. * Gets or sets the texture scale ratio used to render content (2 by default)
  3803. */
  3804. get contentScaleRatio(): number;
  3805. set contentScaleRatio(value: number);
  3806. protected _disposeFacadeTexture(): void;
  3807. protected _resetContent(): void;
  3808. /**
  3809. * Creates a new button
  3810. * @param name defines the control name
  3811. */
  3812. constructor(name?: string);
  3813. /**
  3814. * Gets or sets the GUI 2D content used to display the button's facade
  3815. */
  3816. get content(): Control;
  3817. set content(value: Control);
  3818. /**
  3819. * Apply the facade texture (created from the content property).
  3820. * This function can be overloaded by child classes
  3821. * @param facadeTexture defines the AdvancedDynamicTexture to use
  3822. */
  3823. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  3824. protected _getTypeName(): string;
  3825. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3826. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  3827. /**
  3828. * Releases all associated resources
  3829. */
  3830. dispose(): void;
  3831. }
  3832. }
  3833. declare module BABYLON.GUI {
  3834. /**
  3835. * Class used to create a touchable button in 3D
  3836. */
  3837. export class TouchButton3D extends Button3D {
  3838. private _collisionMesh;
  3839. private _collidableFrontDirection;
  3840. private _lastTouchPoint;
  3841. private _tempButtonForwardRay;
  3842. private _lastKnownCollidableScale;
  3843. private _collidableInitialized;
  3844. private _frontOffset;
  3845. private _backOffset;
  3846. private _hoverOffset;
  3847. private _pushThroughBackOffset;
  3848. private _activeInteractions;
  3849. private _previousHeight;
  3850. /**
  3851. * Creates a new touchable button
  3852. * @param name defines the control name
  3853. * @param collisionMesh mesh to track collisions with
  3854. */
  3855. constructor(name?: string, collisionMesh?: BABYLON.Mesh);
  3856. /**
  3857. * Sets the front-facing direction of the button
  3858. * @param frontDir the forward direction of the button
  3859. */
  3860. set collidableFrontDirection(frontWorldDir: BABYLON.Vector3);
  3861. private _getWorldMatrixData;
  3862. /**
  3863. * Sets the mesh used for testing input collision
  3864. * @param collisionMesh the new collision mesh for the button
  3865. */
  3866. set collisionMesh(collisionMesh: BABYLON.Mesh);
  3867. private _getShortestDistancePointToLine;
  3868. private _isPrimedForInteraction;
  3869. private _getPointOnButton;
  3870. private _updateDistanceOffsets;
  3871. private _getHeightFromButtonCenter;
  3872. private _getDistanceOffPlane;
  3873. private _updateButtonState;
  3874. /** @hidden */
  3875. _collisionCheckForStateChange(mesh: BABYLON.AbstractMesh): void;
  3876. protected _getTypeName(): string;
  3877. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  3878. /**
  3879. * Releases all associated resources
  3880. */
  3881. dispose(): void;
  3882. }
  3883. }
  3884. declare module BABYLON.GUI {
  3885. /**
  3886. * Class used to manage 3D user interface
  3887. * @see https://doc.babylonjs.com/how_to/gui3d
  3888. */
  3889. export class GUI3DManager implements BABYLON.IDisposable {
  3890. private _scene;
  3891. private _sceneDisposeObserver;
  3892. private _utilityLayer;
  3893. private _rootContainer;
  3894. private _pointerObserver;
  3895. private _pointerOutObserver;
  3896. private _touchableButtons;
  3897. /** @hidden */
  3898. _lastPickedControl: Control3D;
  3899. /** @hidden */
  3900. _lastControlOver: {
  3901. [pointerId: number]: Control3D;
  3902. };
  3903. /** @hidden */
  3904. _lastControlDown: {
  3905. [pointerId: number]: Control3D;
  3906. };
  3907. /**
  3908. * BABYLON.Observable raised when the point picked by the pointer events changed
  3909. */
  3910. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3911. /** @hidden */
  3912. _sharedMaterials: {
  3913. [key: string]: BABYLON.Material;
  3914. };
  3915. /** @hidden */
  3916. _touchSharedMaterials: {
  3917. [key: string]: BABYLON.Material;
  3918. };
  3919. /** Gets the hosting scene */
  3920. get scene(): BABYLON.Scene;
  3921. /** Gets associated utility layer */
  3922. get utilityLayer(): BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3923. /**
  3924. * Creates a new GUI3DManager
  3925. * @param scene
  3926. */
  3927. constructor(scene?: BABYLON.Scene);
  3928. private _handlePointerOut;
  3929. private _doPicking;
  3930. private _processTouchControls;
  3931. /**
  3932. * Gets the root container
  3933. */
  3934. get rootContainer(): Container3D;
  3935. /**
  3936. * Gets a boolean indicating if the given control is in the root child list
  3937. * @param control defines the control to check
  3938. * @returns true if the control is in the root child list
  3939. */
  3940. containsControl(control: Control3D): boolean;
  3941. /**
  3942. * Adds a control to the root child list
  3943. * @param control defines the control to add
  3944. * @returns the current manager
  3945. */
  3946. addControl(control: Control3D): GUI3DManager;
  3947. /**
  3948. * Removes a control from the root child list
  3949. * @param control defines the control to remove
  3950. * @returns the current container
  3951. */
  3952. removeControl(control: Control3D): GUI3DManager;
  3953. /**
  3954. * Releases all associated resources
  3955. */
  3956. dispose(): void;
  3957. }
  3958. }
  3959. declare module BABYLON.GUI {
  3960. /**
  3961. * Class used to transport BABYLON.Vector3 information for pointer events
  3962. */
  3963. export class Vector3WithInfo extends BABYLON.Vector3 {
  3964. /** defines the current mouse button index */
  3965. buttonIndex: number;
  3966. /**
  3967. * Creates a new Vector3WithInfo
  3968. * @param source defines the vector3 data to transport
  3969. * @param buttonIndex defines the current mouse button index
  3970. */
  3971. constructor(source: BABYLON.Vector3,
  3972. /** defines the current mouse button index */
  3973. buttonIndex?: number);
  3974. }
  3975. }
  3976. declare module BABYLON.GUI {
  3977. /**
  3978. * Class used as base class for controls
  3979. */
  3980. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  3981. /** Defines the control name */
  3982. name?: string | undefined;
  3983. /** @hidden */
  3984. _host: GUI3DManager;
  3985. private _node;
  3986. private _downCount;
  3987. private _enterCount;
  3988. private _downPointerIds;
  3989. private _isVisible;
  3990. /** Gets or sets the control position in world space */
  3991. get position(): BABYLON.Vector3;
  3992. set position(value: BABYLON.Vector3);
  3993. /** Gets or sets the control scaling in world space */
  3994. get scaling(): BABYLON.Vector3;
  3995. set scaling(value: BABYLON.Vector3);
  3996. /** Callback used to start pointer enter animation */
  3997. pointerEnterAnimation: () => void;
  3998. /** Callback used to start pointer out animation */
  3999. pointerOutAnimation: () => void;
  4000. /** Callback used to start pointer down animation */
  4001. pointerDownAnimation: () => void;
  4002. /** Callback used to start pointer up animation */
  4003. pointerUpAnimation: () => void;
  4004. /**
  4005. * An event triggered when the pointer move over the control
  4006. */
  4007. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  4008. /**
  4009. * An event triggered when the pointer move out of the control
  4010. */
  4011. onPointerOutObservable: BABYLON.Observable<Control3D>;
  4012. /**
  4013. * An event triggered when the pointer taps the control
  4014. */
  4015. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  4016. /**
  4017. * An event triggered when pointer is up
  4018. */
  4019. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  4020. /**
  4021. * An event triggered when a control is clicked on (with a mouse)
  4022. */
  4023. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  4024. /**
  4025. * An event triggered when pointer enters the control
  4026. */
  4027. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  4028. /**
  4029. * Gets or sets the parent container
  4030. */
  4031. parent: BABYLON.Nullable<Container3D>;
  4032. private _behaviors;
  4033. /**
  4034. * Gets the list of attached behaviors
  4035. * @see https://doc.babylonjs.com/features/behaviour
  4036. */
  4037. get behaviors(): BABYLON.Behavior<Control3D>[];
  4038. /**
  4039. * Attach a behavior to the control
  4040. * @see https://doc.babylonjs.com/features/behaviour
  4041. * @param behavior defines the behavior to attach
  4042. * @returns the current control
  4043. */
  4044. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4045. /**
  4046. * Remove an attached behavior
  4047. * @see https://doc.babylonjs.com/features/behaviour
  4048. * @param behavior defines the behavior to attach
  4049. * @returns the current control
  4050. */
  4051. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4052. /**
  4053. * Gets an attached behavior by name
  4054. * @param name defines the name of the behavior to look for
  4055. * @see https://doc.babylonjs.com/features/behaviour
  4056. * @returns null if behavior was not found else the requested behavior
  4057. */
  4058. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  4059. /** Gets or sets a boolean indicating if the control is visible */
  4060. get isVisible(): boolean;
  4061. set isVisible(value: boolean);
  4062. /**
  4063. * Creates a new control
  4064. * @param name defines the control name
  4065. */
  4066. constructor(
  4067. /** Defines the control name */
  4068. name?: string | undefined);
  4069. /**
  4070. * Gets a string representing the class name
  4071. */
  4072. get typeName(): string;
  4073. /**
  4074. * Get the current class name of the control.
  4075. * @returns current class name
  4076. */
  4077. getClassName(): string;
  4078. protected _getTypeName(): string;
  4079. /**
  4080. * Gets the transform node used by this control
  4081. */
  4082. get node(): BABYLON.Nullable<BABYLON.TransformNode>;
  4083. /**
  4084. * Gets the mesh used to render this control
  4085. */
  4086. get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
  4087. /**
  4088. * Link the control as child of the given node
  4089. * @param node defines the node to link to. Use null to unlink the control
  4090. * @returns the current control
  4091. */
  4092. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  4093. /** @hidden **/
  4094. _prepareNode(scene: BABYLON.Scene): void;
  4095. protected _injectGUI3DMetadata(node: BABYLON.TransformNode): any;
  4096. /**
  4097. * Node creation.
  4098. * Can be overriden by children
  4099. * @param scene defines the scene where the node must be attached
  4100. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  4101. */
  4102. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  4103. /**
  4104. * Affect a material to the given mesh
  4105. * @param mesh defines the mesh which will represent the control
  4106. */
  4107. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4108. /** @hidden */
  4109. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  4110. /** @hidden */
  4111. _onPointerEnter(target: Control3D): boolean;
  4112. /** @hidden */
  4113. _onPointerOut(target: Control3D): void;
  4114. /** @hidden */
  4115. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4116. /** @hidden */
  4117. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4118. /** @hidden */
  4119. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4120. /** @hidden */
  4121. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4122. /** @hidden */
  4123. _disposeNode(): void;
  4124. /**
  4125. * Releases all associated resources
  4126. */
  4127. dispose(): void;
  4128. }
  4129. }
  4130. declare module BABYLON.GUI {
  4131. /**
  4132. * Class used as a root to all buttons
  4133. */
  4134. export class AbstractButton3D extends Control3D {
  4135. /**
  4136. * Creates a new button
  4137. * @param name defines the control name
  4138. */
  4139. constructor(name?: string);
  4140. protected _getTypeName(): string;
  4141. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4142. }
  4143. }
  4144. declare module BABYLON.GUI {
  4145. /**
  4146. * Abstract class used to create a container panel deployed on the surface of a volume
  4147. */
  4148. export abstract class VolumeBasedPanel extends Container3D {
  4149. private _columns;
  4150. private _rows;
  4151. private _rowThenColum;
  4152. private _orientation;
  4153. protected _cellWidth: number;
  4154. protected _cellHeight: number;
  4155. /**
  4156. * Gets or sets the distance between elements
  4157. */
  4158. margin: number;
  4159. /**
  4160. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  4161. * | Value | Type | Description |
  4162. * | ----- | ----------------------------------- | ----------- |
  4163. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  4164. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  4165. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  4166. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  4167. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  4168. */
  4169. get orientation(): number;
  4170. set orientation(value: number);
  4171. /**
  4172. * Gets or sets the number of columns requested (10 by default).
  4173. * The panel will automatically compute the number of rows based on number of child controls.
  4174. */
  4175. get columns(): BABYLON.int;
  4176. set columns(value: BABYLON.int);
  4177. /**
  4178. * Gets or sets a the number of rows requested.
  4179. * The panel will automatically compute the number of columns based on number of child controls.
  4180. */
  4181. get rows(): BABYLON.int;
  4182. set rows(value: BABYLON.int);
  4183. /**
  4184. * Creates new VolumeBasedPanel
  4185. */
  4186. constructor();
  4187. protected _arrangeChildren(): void;
  4188. /** Child classes must implement this function to provide correct control positioning */
  4189. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4190. /** Child classes can implement this function to provide additional processing */
  4191. protected _finalProcessing(): void;
  4192. }
  4193. }
  4194. declare module BABYLON.GUI {
  4195. /**
  4196. * Class used to create a container panel deployed on the surface of a cylinder
  4197. */
  4198. export class CylinderPanel extends VolumeBasedPanel {
  4199. private _radius;
  4200. /**
  4201. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  4202. */
  4203. get radius(): BABYLON.float;
  4204. set radius(value: BABYLON.float);
  4205. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4206. private _cylindricalMapping;
  4207. }
  4208. }
  4209. declare module BABYLON.GUI {
  4210. /** @hidden */
  4211. export var fluentVertexShader: {
  4212. name: string;
  4213. shader: string;
  4214. };
  4215. }
  4216. declare module BABYLON.GUI {
  4217. /** @hidden */
  4218. export var fluentPixelShader: {
  4219. name: string;
  4220. shader: string;
  4221. };
  4222. }
  4223. declare module BABYLON.GUI {
  4224. /** @hidden */
  4225. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  4226. INNERGLOW: boolean;
  4227. BORDER: boolean;
  4228. HOVERLIGHT: boolean;
  4229. TEXTURE: boolean;
  4230. constructor();
  4231. }
  4232. /**
  4233. * Class used to render controls with fluent desgin
  4234. */
  4235. export class FluentMaterial extends BABYLON.PushMaterial {
  4236. /**
  4237. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  4238. */
  4239. innerGlowColorIntensity: number;
  4240. /**
  4241. * Gets or sets the inner glow color (white by default)
  4242. */
  4243. innerGlowColor: BABYLON.Color3;
  4244. /**
  4245. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  4246. */
  4247. albedoColor: BABYLON.Color3;
  4248. /**
  4249. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  4250. */
  4251. renderBorders: boolean;
  4252. /**
  4253. * Gets or sets border width (default is 0.5)
  4254. */
  4255. borderWidth: number;
  4256. /**
  4257. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  4258. */
  4259. edgeSmoothingValue: number;
  4260. /**
  4261. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  4262. */
  4263. borderMinValue: number;
  4264. /**
  4265. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  4266. */
  4267. renderHoverLight: boolean;
  4268. /**
  4269. * Gets or sets the radius used to render the hover light (default is 1.0)
  4270. */
  4271. hoverRadius: number;
  4272. /**
  4273. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  4274. */
  4275. hoverColor: BABYLON.Color4;
  4276. /**
  4277. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  4278. */
  4279. hoverPosition: BABYLON.Vector3;
  4280. private _albedoTexture;
  4281. /** Gets or sets the texture to use for albedo color */
  4282. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  4283. /**
  4284. * Creates a new Fluent material
  4285. * @param name defines the name of the material
  4286. * @param scene defines the hosting scene
  4287. */
  4288. constructor(name: string, scene: BABYLON.Scene);
  4289. needAlphaBlending(): boolean;
  4290. needAlphaTesting(): boolean;
  4291. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  4292. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  4293. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  4294. getActiveTextures(): BABYLON.BaseTexture[];
  4295. hasTexture(texture: BABYLON.BaseTexture): boolean;
  4296. dispose(forceDisposeEffect?: boolean): void;
  4297. clone(name: string): FluentMaterial;
  4298. serialize(): any;
  4299. getClassName(): string;
  4300. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  4301. }
  4302. }
  4303. declare module BABYLON.GUI {
  4304. /**
  4305. * Class used to create a holographic button in 3D
  4306. */
  4307. export class HolographicButton extends Button3D {
  4308. private _backPlate;
  4309. private _textPlate;
  4310. private _frontPlate;
  4311. private _text;
  4312. private _imageUrl;
  4313. private _shareMaterials;
  4314. private _frontMaterial;
  4315. private _backMaterial;
  4316. private _plateMaterial;
  4317. private _pickedPointObserver;
  4318. private _tooltipFade;
  4319. private _tooltipTextBlock;
  4320. private _tooltipTexture;
  4321. private _tooltipMesh;
  4322. private _tooltipHoverObserver;
  4323. private _tooltipOutObserver;
  4324. private _disposeTooltip;
  4325. /**
  4326. * Rendering ground id of all the mesh in the button
  4327. */
  4328. set renderingGroupId(id: number);
  4329. get renderingGroupId(): number;
  4330. /**
  4331. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4332. */
  4333. set tooltipText(text: BABYLON.Nullable<string>);
  4334. get tooltipText(): BABYLON.Nullable<string>;
  4335. /**
  4336. * Gets or sets text for the button
  4337. */
  4338. get text(): string;
  4339. set text(value: string);
  4340. /**
  4341. * Gets or sets the image url for the button
  4342. */
  4343. get imageUrl(): string;
  4344. set imageUrl(value: string);
  4345. /**
  4346. * Gets the back material used by this button
  4347. */
  4348. get backMaterial(): FluentMaterial;
  4349. /**
  4350. * Gets the front material used by this button
  4351. */
  4352. get frontMaterial(): FluentMaterial;
  4353. /**
  4354. * Gets the plate material used by this button
  4355. */
  4356. get plateMaterial(): BABYLON.StandardMaterial;
  4357. /**
  4358. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4359. */
  4360. get shareMaterials(): boolean;
  4361. /**
  4362. * Creates a new button
  4363. * @param name defines the control name
  4364. */
  4365. constructor(name?: string, shareMaterials?: boolean);
  4366. protected _getTypeName(): string;
  4367. private _rebuildContent;
  4368. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4369. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4370. private _createBackMaterial;
  4371. private _createFrontMaterial;
  4372. private _createPlateMaterial;
  4373. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  4374. /**
  4375. * Releases all associated resources
  4376. */
  4377. dispose(): void;
  4378. }
  4379. }
  4380. declare module BABYLON.GUI {
  4381. /**
  4382. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  4383. */
  4384. export class MeshButton3D extends Button3D {
  4385. /** @hidden */
  4386. protected _currentMesh: BABYLON.Mesh;
  4387. /**
  4388. * Creates a new 3D button based on a mesh
  4389. * @param mesh mesh to become a 3D button
  4390. * @param name defines the control name
  4391. */
  4392. constructor(mesh: BABYLON.Mesh, name?: string);
  4393. protected _getTypeName(): string;
  4394. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4395. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4396. }
  4397. }
  4398. declare module BABYLON.GUI {
  4399. /**
  4400. * Class used to create a container panel deployed on the surface of a plane
  4401. */
  4402. export class PlanePanel extends VolumeBasedPanel {
  4403. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4404. }
  4405. }
  4406. declare module BABYLON.GUI {
  4407. /**
  4408. * Class used to create a container panel where items get randomized planar mapping
  4409. */
  4410. export class ScatterPanel extends VolumeBasedPanel {
  4411. private _iteration;
  4412. /**
  4413. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  4414. */
  4415. get iteration(): BABYLON.float;
  4416. set iteration(value: BABYLON.float);
  4417. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4418. private _scatterMapping;
  4419. protected _finalProcessing(): void;
  4420. }
  4421. }
  4422. declare module BABYLON.GUI {
  4423. /**
  4424. * Class used to create a container panel deployed on the surface of a sphere
  4425. */
  4426. export class SpherePanel extends VolumeBasedPanel {
  4427. private _radius;
  4428. /**
  4429. * Gets or sets the radius of the sphere where to project controls (5 by default)
  4430. */
  4431. get radius(): BABYLON.float;
  4432. set radius(value: BABYLON.float);
  4433. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4434. private _sphericalMapping;
  4435. }
  4436. }
  4437. declare module BABYLON.GUI {
  4438. /**
  4439. * Class used to create a stack panel in 3D on XY plane
  4440. */
  4441. export class StackPanel3D extends Container3D {
  4442. private _isVertical;
  4443. /**
  4444. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  4445. */
  4446. get isVertical(): boolean;
  4447. set isVertical(value: boolean);
  4448. /**
  4449. * Gets or sets the distance between elements
  4450. */
  4451. margin: number;
  4452. /**
  4453. * Creates new StackPanel
  4454. * @param isVertical
  4455. */
  4456. constructor(isVertical?: boolean);
  4457. protected _arrangeChildren(): void;
  4458. }
  4459. }
  4460. declare module BABYLON.GUI {
  4461. /**
  4462. * Class used to create an interactable object. It's a touchable 3D button using a mesh coming from the current scene
  4463. */
  4464. export class TouchMeshButton3D extends TouchButton3D {
  4465. /** @hidden */
  4466. protected _currentMesh: BABYLON.Mesh;
  4467. /**
  4468. * Creates a new 3D button based on a mesh
  4469. * @param mesh mesh to become a 3D button
  4470. * @param collisionMesh mesh to track collisions with
  4471. * @param name defines the control name
  4472. */
  4473. constructor(mesh: BABYLON.Mesh, options: {
  4474. collisionMesh: BABYLON.Mesh;
  4475. useDynamicMesh?: boolean;
  4476. }, name?: string);
  4477. protected _getTypeName(): string;
  4478. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4479. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4480. }
  4481. }
  4482. declare module BABYLON.GUI {
  4483. /**
  4484. * Class used to create a holographic button in 3D
  4485. */
  4486. export class TouchHolographicButton extends TouchButton3D {
  4487. private _backPlate;
  4488. private _textPlate;
  4489. private _frontPlate;
  4490. private _text;
  4491. private _imageUrl;
  4492. private _shareMaterials;
  4493. private _frontMaterial;
  4494. private _backMaterial;
  4495. private _plateMaterial;
  4496. private _pickedPointObserver;
  4497. private _tooltipFade;
  4498. private _tooltipTextBlock;
  4499. private _tooltipTexture;
  4500. private _tooltipMesh;
  4501. private _tooltipHoverObserver;
  4502. private _tooltipOutObserver;
  4503. private _disposeTooltip;
  4504. /**
  4505. * Rendering ground id of all the mesh in the button
  4506. */
  4507. set renderingGroupId(id: number);
  4508. get renderingGroupId(): number;
  4509. /**
  4510. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  4511. */
  4512. set tooltipText(text: BABYLON.Nullable<string>);
  4513. get tooltipText(): BABYLON.Nullable<string>;
  4514. /**
  4515. * Gets or sets text for the button
  4516. */
  4517. get text(): string;
  4518. set text(value: string);
  4519. /**
  4520. * Gets or sets the image url for the button
  4521. */
  4522. get imageUrl(): string;
  4523. set imageUrl(value: string);
  4524. /**
  4525. * Gets the back material used by this button
  4526. */
  4527. get backMaterial(): FluentMaterial;
  4528. /**
  4529. * Gets the front material used by this button
  4530. */
  4531. get frontMaterial(): FluentMaterial;
  4532. /**
  4533. * Gets the plate material used by this button
  4534. */
  4535. get plateMaterial(): BABYLON.StandardMaterial;
  4536. /**
  4537. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4538. */
  4539. get shareMaterials(): boolean;
  4540. /**
  4541. * Creates a new button
  4542. * @param name defines the control name
  4543. */
  4544. constructor(name?: string, shareMaterials?: boolean);
  4545. protected _getTypeName(): string;
  4546. private _rebuildContent;
  4547. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4548. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4549. private _createBackMaterial;
  4550. private _createFrontMaterial;
  4551. private _createPlateMaterial;
  4552. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  4553. /**
  4554. * Releases all associated resources
  4555. */
  4556. dispose(): void;
  4557. }
  4558. }