babylon.gui.d.ts 141 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108
  1. /*Babylon.js GUI*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. declare module BABYLON.GUI {
  5. }
  6. declare module BABYLON.GUI {
  7. }
  8. declare module BABYLON.GUI {
  9. }
  10. declare module BABYLON.GUI {
  11. }
  12. declare module BABYLON.GUI {
  13. /**
  14. * Interface used to define a control that can receive focus
  15. */
  16. export interface IFocusableControl {
  17. /**
  18. * Function called when the control receives the focus
  19. */
  20. onFocus(): void;
  21. /**
  22. * Function called when the control loses the focus
  23. */
  24. onBlur(): void;
  25. /**
  26. * Function called to let the control handle keyboard events
  27. * @param evt defines the current keyboard event
  28. */
  29. processKeyboard(evt: KeyboardEvent): void;
  30. /**
  31. * Function called to get the list of controls that should not steal the focus from this control
  32. * @returns an array of controls
  33. */
  34. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  35. }
  36. /**
  37. * Class used to create texture to support 2D GUI elements
  38. * @see http://doc.babylonjs.com/how_to/gui
  39. */
  40. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  41. /** @hidden */
  42. _rootContainer: Container;
  43. /** @hidden */
  44. _lastPickedControl: Control;
  45. /** @hidden */
  46. _lastControlOver: {
  47. [pointerId: number]: Control;
  48. };
  49. /** @hidden */
  50. _lastControlDown: {
  51. [pointerId: number]: Control;
  52. };
  53. /** @hidden */
  54. _capturingControl: {
  55. [pointerId: number]: Control;
  56. };
  57. /** @hidden */
  58. _shouldBlockPointer: boolean;
  59. /** @hidden */
  60. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  61. /** @hidden */
  62. _linkedControls: Control[];
  63. /**
  64. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  65. */
  66. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  67. /**
  68. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  69. */
  70. onControlPickedObservable: BABYLON.Observable<Control>;
  71. /**
  72. * BABYLON.Observable event triggered before layout is evaluated
  73. */
  74. onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  75. /**
  76. * BABYLON.Observable event triggered after the layout was evaluated
  77. */
  78. onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  79. /**
  80. * BABYLON.Observable event triggered before the texture is rendered
  81. */
  82. onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  83. /**
  84. * BABYLON.Observable event triggered after the texture was rendered
  85. */
  86. onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
  87. /**
  88. * Gets or sets a boolean defining if alpha is stored as premultiplied
  89. */
  90. premulAlpha: boolean;
  91. /**
  92. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  93. * Useful when you want more antialiasing
  94. */
  95. renderScale: number;
  96. /** Gets or sets the background color */
  97. background: string;
  98. /**
  99. * Gets or sets the ideal width used to design controls.
  100. * The GUI will then rescale everything accordingly
  101. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  102. */
  103. idealWidth: number;
  104. /**
  105. * Gets or sets the ideal height used to design controls.
  106. * The GUI will then rescale everything accordingly
  107. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  108. */
  109. idealHeight: number;
  110. /**
  111. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  112. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  113. */
  114. useSmallestIdeal: boolean;
  115. /**
  116. * Gets or sets a boolean indicating if adaptive scaling must be used
  117. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  118. */
  119. renderAtIdealSize: boolean;
  120. /**
  121. * Gets the underlying layer used to render the texture when in fullscreen mode
  122. */
  123. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  124. /**
  125. * Gets the root container control
  126. */
  127. readonly rootContainer: Container;
  128. /**
  129. * Returns an array containing the root container.
  130. * This is mostly used to let the Inspector introspects the ADT
  131. * @returns an array containing the rootContainer
  132. */
  133. getChildren(): Array<Container>;
  134. /**
  135. * Will return all controls that are inside this texture
  136. * @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
  137. * @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
  138. * @return all child controls
  139. */
  140. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  141. /**
  142. * Gets or sets the current focused control
  143. */
  144. focusedControl: BABYLON.Nullable<IFocusableControl>;
  145. /**
  146. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  147. */
  148. isForeground: boolean;
  149. /**
  150. * Gets or set information about clipboardData
  151. */
  152. clipboardData: string;
  153. /**
  154. * Creates a new AdvancedDynamicTexture
  155. * @param name defines the name of the texture
  156. * @param width defines the width of the texture
  157. * @param height defines the height of the texture
  158. * @param scene defines the hosting scene
  159. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  160. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  161. */
  162. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  163. /**
  164. * Get the current class name of the texture useful for serialization or dynamic coding.
  165. * @returns "AdvancedDynamicTexture"
  166. */
  167. getClassName(): string;
  168. /**
  169. * Function used to execute a function on all controls
  170. * @param func defines the function to execute
  171. * @param container defines the container where controls belong. If null the root container will be used
  172. */
  173. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  174. /**
  175. * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
  176. */
  177. useInvalidateRectOptimization: boolean;
  178. /**
  179. * Invalidates a rectangle area on the gui texture
  180. * @param clearMinX left most position of the rectangle to clear in the texture
  181. * @param clearMinY top most position of the rectangle to clear in the texture
  182. * @param clearMaxX right most position of the rectangle to clear in the texture
  183. * @param clearMaxY bottom most position of the rectangle to clear in the texture
  184. * @param minX left most position of the rectangle to invalidate in absolute coordinates (not taking in account local transformation)
  185. * @param minY top most position of the rectangle to invalidate in absolute coordinates (not taking in account local transformation)
  186. * @param maxX right most position of the rectangle to invalidate in absolute coordinates (not taking in account local transformation)
  187. * @param maxY bottom most position of the rectangle to invalidate in absolute coordinates (not taking in account local transformation)
  188. */
  189. invalidateRect(clearMinX: number, clearMinY: number, clearMaxX: number, clearMaxY: number, minX: number, minY: number, maxX: number, maxY: number): void;
  190. /**
  191. * Marks the texture as dirty forcing a complete update
  192. */
  193. markAsDirty(): void;
  194. /**
  195. * Helper function used to create a new style
  196. * @returns a new style
  197. * @see http://doc.babylonjs.com/how_to/gui#styles
  198. */
  199. createStyle(): Style;
  200. /**
  201. * Adds a new control to the root container
  202. * @param control defines the control to add
  203. * @returns the current texture
  204. */
  205. addControl(control: Control): AdvancedDynamicTexture;
  206. /**
  207. * Removes a control from the root container
  208. * @param control defines the control to remove
  209. * @returns the current texture
  210. */
  211. removeControl(control: Control): AdvancedDynamicTexture;
  212. /**
  213. * Release all resources
  214. */
  215. dispose(): void;
  216. /** @hidden */
  217. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  218. /**
  219. * Get screen coordinates for a vector3
  220. * @param position defines the position to project
  221. * @param worldMatrix defines the world matrix to use
  222. * @returns the projected position
  223. */
  224. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  225. /** @hidden */
  226. _changeCursor(cursor: string): void;
  227. /** @hidden */
  228. _registerLastControlDown(control: Control, pointerId: number): void;
  229. /** @hidden */
  230. _cleanControlAfterRemovalFromList(list: {
  231. [pointerId: number]: Control;
  232. }, control: Control): void;
  233. /** @hidden */
  234. _cleanControlAfterRemoval(control: Control): void;
  235. /** Attach to all scene events required to support pointer events */
  236. attach(): void;
  237. /**
  238. * Register the clipboard Events onto the canvas
  239. */
  240. registerClipboardEvents(): void;
  241. /**
  242. * Unregister the clipboard Events from the canvas
  243. */
  244. unRegisterClipboardEvents(): void;
  245. /**
  246. * Connect the texture to a hosting mesh to enable interactions
  247. * @param mesh defines the mesh to attach to
  248. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  249. */
  250. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  251. /**
  252. * Move the focus to a specific control
  253. * @param control defines the control which will receive the focus
  254. */
  255. moveFocusToControl(control: IFocusableControl): void;
  256. /**
  257. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  258. * @param mesh defines the mesh which will receive the texture
  259. * @param width defines the texture width (1024 by default)
  260. * @param height defines the texture height (1024 by default)
  261. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  262. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  263. * @returns a new AdvancedDynamicTexture
  264. */
  265. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  266. /**
  267. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  268. * In this mode the texture will rely on a layer for its rendering.
  269. * This allows it to be treated like any other layer.
  270. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  271. * LayerMask is set through advancedTexture.layer.layerMask
  272. * @param name defines name for the texture
  273. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  274. * @param scene defines the hsoting scene
  275. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  276. * @returns a new AdvancedDynamicTexture
  277. */
  278. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  279. }
  280. }
  281. declare module BABYLON.GUI {
  282. /**
  283. * This class can be used to get instrumentation data from a AdvancedDynamicTexture object
  284. */
  285. export class AdvancedDynamicTextureInstrumentation implements BABYLON.IDisposable {
  286. /**
  287. * Define the instrumented AdvancedDynamicTexture.
  288. */
  289. texture: AdvancedDynamicTexture;
  290. /**
  291. * Gets the perf counter used to capture render time
  292. */
  293. readonly renderTimeCounter: BABYLON.PerfCounter;
  294. /**
  295. * Gets the perf counter used to capture layout time
  296. */
  297. readonly layoutTimeCounter: BABYLON.PerfCounter;
  298. /**
  299. * Enable or disable the render time capture
  300. */
  301. captureRenderTime: boolean;
  302. /**
  303. * Enable or disable the layout time capture
  304. */
  305. captureLayoutTime: boolean;
  306. /**
  307. * Instantiates a new advanced dynamic texture instrumentation.
  308. * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
  309. * @param texture Defines the AdvancedDynamicTexture to instrument
  310. */
  311. constructor(
  312. /**
  313. * Define the instrumented AdvancedDynamicTexture.
  314. */
  315. texture: AdvancedDynamicTexture);
  316. /**
  317. * Dispose and release associated resources.
  318. */
  319. dispose(): void;
  320. }
  321. }
  322. declare module BABYLON.GUI {
  323. /**
  324. * Class used to transport BABYLON.Vector2 information for pointer events
  325. */
  326. export class Vector2WithInfo extends BABYLON.Vector2 {
  327. /** defines the current mouse button index */
  328. buttonIndex: number;
  329. /**
  330. * Creates a new Vector2WithInfo
  331. * @param source defines the vector2 data to transport
  332. * @param buttonIndex defines the current mouse button index
  333. */
  334. constructor(source: BABYLON.Vector2,
  335. /** defines the current mouse button index */
  336. buttonIndex?: number);
  337. }
  338. /** Class used to provide 2D matrix features */
  339. export class Matrix2D {
  340. /** Gets the internal array of 6 floats used to store matrix data */
  341. m: Float32Array;
  342. /**
  343. * Creates a new matrix
  344. * @param m00 defines value for (0, 0)
  345. * @param m01 defines value for (0, 1)
  346. * @param m10 defines value for (1, 0)
  347. * @param m11 defines value for (1, 1)
  348. * @param m20 defines value for (2, 0)
  349. * @param m21 defines value for (2, 1)
  350. */
  351. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  352. /**
  353. * Fills the matrix from direct values
  354. * @param m00 defines value for (0, 0)
  355. * @param m01 defines value for (0, 1)
  356. * @param m10 defines value for (1, 0)
  357. * @param m11 defines value for (1, 1)
  358. * @param m20 defines value for (2, 0)
  359. * @param m21 defines value for (2, 1)
  360. * @returns the current modified matrix
  361. */
  362. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  363. /**
  364. * Gets matrix determinant
  365. * @returns the determinant
  366. */
  367. determinant(): number;
  368. /**
  369. * Inverses the matrix and stores it in a target matrix
  370. * @param result defines the target matrix
  371. * @returns the current matrix
  372. */
  373. invertToRef(result: Matrix2D): Matrix2D;
  374. /**
  375. * Multiplies the current matrix with another one
  376. * @param other defines the second operand
  377. * @param result defines the target matrix
  378. * @returns the current matrix
  379. */
  380. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  381. /**
  382. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  383. * @param x defines the x coordinate to transform
  384. * @param y defines the x coordinate to transform
  385. * @param result defines the target vector2
  386. * @returns the current matrix
  387. */
  388. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  389. /**
  390. * Creates an identity matrix
  391. * @returns a new matrix
  392. */
  393. static Identity(): Matrix2D;
  394. /**
  395. * Creates a translation matrix and stores it in a target matrix
  396. * @param x defines the x coordinate of the translation
  397. * @param y defines the y coordinate of the translation
  398. * @param result defines the target matrix
  399. */
  400. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  401. /**
  402. * Creates a scaling matrix and stores it in a target matrix
  403. * @param x defines the x coordinate of the scaling
  404. * @param y defines the y coordinate of the scaling
  405. * @param result defines the target matrix
  406. */
  407. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  408. /**
  409. * Creates a rotation matrix and stores it in a target matrix
  410. * @param angle defines the rotation angle
  411. * @param result defines the target matrix
  412. */
  413. static RotationToRef(angle: number, result: Matrix2D): void;
  414. /**
  415. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  416. * @param tx defines the x coordinate of the translation
  417. * @param ty defines the y coordinate of the translation
  418. * @param angle defines the rotation angle
  419. * @param scaleX defines the x coordinate of the scaling
  420. * @param scaleY defines the y coordinate of the scaling
  421. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  422. * @param result defines the target matrix
  423. */
  424. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  425. }
  426. }
  427. declare module BABYLON.GUI {
  428. /**
  429. * Class used to store 2D control sizes
  430. */
  431. export class Measure {
  432. /** defines left coordinate */
  433. left: number;
  434. /** defines top coordinate */
  435. top: number;
  436. /** defines width dimension */
  437. width: number;
  438. /** defines height dimension */
  439. height: number;
  440. /**
  441. * Creates a new measure
  442. * @param left defines left coordinate
  443. * @param top defines top coordinate
  444. * @param width defines width dimension
  445. * @param height defines height dimension
  446. */
  447. constructor(
  448. /** defines left coordinate */
  449. left: number,
  450. /** defines top coordinate */
  451. top: number,
  452. /** defines width dimension */
  453. width: number,
  454. /** defines height dimension */
  455. height: number);
  456. /**
  457. * Copy from another measure
  458. * @param other defines the other measure to copy from
  459. */
  460. copyFrom(other: Measure): void;
  461. /**
  462. * Copy from a group of 4 floats
  463. * @param left defines left coordinate
  464. * @param top defines top coordinate
  465. * @param width defines width dimension
  466. * @param height defines height dimension
  467. */
  468. copyFromFloats(left: number, top: number, width: number, height: number): void;
  469. /**
  470. * Check equality between this measure and another one
  471. * @param other defines the other measures
  472. * @returns true if both measures are equals
  473. */
  474. isEqualsTo(other: Measure): boolean;
  475. /**
  476. * Creates an empty measure
  477. * @returns a new measure
  478. */
  479. static Empty(): Measure;
  480. }
  481. }
  482. declare module BABYLON.GUI {
  483. /**
  484. * Class used to store a point for a MultiLine object.
  485. * The point can be pure 2D coordinates, a mesh or a control
  486. */
  487. export class MultiLinePoint {
  488. /** @hidden */
  489. _point: BABYLON.Vector2;
  490. /**
  491. * Creates a new MultiLinePoint
  492. * @param multiLine defines the source MultiLine object
  493. */
  494. constructor(multiLine: MultiLine);
  495. /** Gets or sets x coordinate */
  496. x: string | number;
  497. /** Gets or sets y coordinate */
  498. y: string | number;
  499. /** Gets or sets the control associated with this point */
  500. control: BABYLON.Nullable<Control>;
  501. /** Gets or sets the mesh associated with this point */
  502. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  503. /** Resets links */
  504. resetLinks(): void;
  505. /**
  506. * Gets a translation vector
  507. * @returns the translation vector
  508. */
  509. translate(): BABYLON.Vector2;
  510. /** Release associated resources */
  511. dispose(): void;
  512. }
  513. }
  514. declare module BABYLON.GUI {
  515. /**
  516. * Define a style used by control to automatically setup properties based on a template.
  517. * Only support font related properties so far
  518. */
  519. export class Style implements BABYLON.IDisposable {
  520. /** @hidden */
  521. _host: AdvancedDynamicTexture;
  522. /** @hidden */
  523. _fontSize: ValueAndUnit;
  524. /**
  525. * BABYLON.Observable raised when the style values are changed
  526. */
  527. onChangedObservable: BABYLON.Observable<Style>;
  528. /**
  529. * Creates a new style object
  530. * @param host defines the AdvancedDynamicTexture which hosts this style
  531. */
  532. constructor(host: AdvancedDynamicTexture);
  533. /**
  534. * Gets or sets the font size
  535. */
  536. fontSize: string | number;
  537. /**
  538. * Gets or sets the font family
  539. */
  540. fontFamily: string;
  541. /**
  542. * Gets or sets the font style
  543. */
  544. fontStyle: string;
  545. /** Gets or sets font weight */
  546. fontWeight: string;
  547. /** Dispose all associated resources */
  548. dispose(): void;
  549. }
  550. }
  551. declare module BABYLON.GUI {
  552. /**
  553. * Class used to specific a value and its associated unit
  554. */
  555. export class ValueAndUnit {
  556. /** defines the unit to store */
  557. unit: number;
  558. /** defines a boolean indicating if the value can be negative */
  559. negativeValueAllowed: boolean;
  560. /**
  561. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  562. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  563. */
  564. ignoreAdaptiveScaling: boolean;
  565. /**
  566. * Creates a new ValueAndUnit
  567. * @param value defines the value to store
  568. * @param unit defines the unit to store
  569. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  570. */
  571. constructor(value: number,
  572. /** defines the unit to store */
  573. unit?: number,
  574. /** defines a boolean indicating if the value can be negative */
  575. negativeValueAllowed?: boolean);
  576. /** Gets a boolean indicating if the value is a percentage */
  577. readonly isPercentage: boolean;
  578. /** Gets a boolean indicating if the value is store as pixel */
  579. readonly isPixel: boolean;
  580. /** Gets direct internal value */
  581. readonly internalValue: number;
  582. /**
  583. * Gets value as pixel
  584. * @param host defines the root host
  585. * @param refValue defines the reference value for percentages
  586. * @returns the value as pixel
  587. */
  588. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  589. /**
  590. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  591. * @param value defines the value to store
  592. * @param unit defines the unit to store
  593. * @returns the current ValueAndUnit
  594. */
  595. updateInPlace(value: number, unit?: number): ValueAndUnit;
  596. /**
  597. * Gets the value accordingly to its unit
  598. * @param host defines the root host
  599. * @returns the value
  600. */
  601. getValue(host: AdvancedDynamicTexture): number;
  602. /**
  603. * Gets a string representation of the value
  604. * @param host defines the root host
  605. * @returns a string
  606. */
  607. toString(host: AdvancedDynamicTexture): string;
  608. /**
  609. * Store a value parsed from a string
  610. * @param source defines the source string
  611. * @returns true if the value was successfully parsed
  612. */
  613. fromString(source: string | number): boolean;
  614. /** UNITMODE_PERCENTAGE */
  615. static readonly UNITMODE_PERCENTAGE: number;
  616. /** UNITMODE_PIXEL */
  617. static readonly UNITMODE_PIXEL: number;
  618. }
  619. }
  620. declare module BABYLON.GUI {
  621. }
  622. declare module BABYLON.GUI {
  623. }
  624. declare module BABYLON.GUI {
  625. /**
  626. * Class used to manage 3D user interface
  627. * @see http://doc.babylonjs.com/how_to/gui3d
  628. */
  629. export class GUI3DManager implements BABYLON.IDisposable {
  630. /** @hidden */
  631. _lastPickedControl: Control3D;
  632. /** @hidden */
  633. _lastControlOver: {
  634. [pointerId: number]: Control3D;
  635. };
  636. /** @hidden */
  637. _lastControlDown: {
  638. [pointerId: number]: Control3D;
  639. };
  640. /**
  641. * BABYLON.Observable raised when the point picked by the pointer events changed
  642. */
  643. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  644. /** @hidden */
  645. _sharedMaterials: {
  646. [key: string]: BABYLON.Material;
  647. };
  648. /** Gets the hosting scene */
  649. readonly scene: BABYLON.Scene;
  650. /** Gets associated utility layer */
  651. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  652. /**
  653. * Creates a new GUI3DManager
  654. * @param scene
  655. */
  656. constructor(scene?: BABYLON.Scene);
  657. /**
  658. * Gets the root container
  659. */
  660. readonly rootContainer: Container3D;
  661. /**
  662. * Gets a boolean indicating if the given control is in the root child list
  663. * @param control defines the control to check
  664. * @returns true if the control is in the root child list
  665. */
  666. containsControl(control: Control3D): boolean;
  667. /**
  668. * Adds a control to the root child list
  669. * @param control defines the control to add
  670. * @returns the current manager
  671. */
  672. addControl(control: Control3D): GUI3DManager;
  673. /**
  674. * Removes a control from the root child list
  675. * @param control defines the control to remove
  676. * @returns the current container
  677. */
  678. removeControl(control: Control3D): GUI3DManager;
  679. /**
  680. * Releases all associated resources
  681. */
  682. dispose(): void;
  683. }
  684. }
  685. declare module BABYLON.GUI {
  686. /**
  687. * Class used to transport BABYLON.Vector3 information for pointer events
  688. */
  689. export class Vector3WithInfo extends BABYLON.Vector3 {
  690. /** defines the current mouse button index */
  691. buttonIndex: number;
  692. /**
  693. * Creates a new Vector3WithInfo
  694. * @param source defines the vector3 data to transport
  695. * @param buttonIndex defines the current mouse button index
  696. */
  697. constructor(source: BABYLON.Vector3,
  698. /** defines the current mouse button index */
  699. buttonIndex?: number);
  700. }
  701. }
  702. declare module BABYLON.GUI {
  703. /**
  704. * Class used to create 2D buttons
  705. */
  706. export class Button extends Rectangle {
  707. name?: string | undefined;
  708. /**
  709. * Function called to generate a pointer enter animation
  710. */
  711. pointerEnterAnimation: () => void;
  712. /**
  713. * Function called to generate a pointer out animation
  714. */
  715. pointerOutAnimation: () => void;
  716. /**
  717. * Function called to generate a pointer down animation
  718. */
  719. pointerDownAnimation: () => void;
  720. /**
  721. * Function called to generate a pointer up animation
  722. */
  723. pointerUpAnimation: () => void;
  724. /**
  725. * Returns the image part of the button (if any)
  726. */
  727. readonly image: BABYLON.Nullable<Image>;
  728. /**
  729. * Returns the image part of the button (if any)
  730. */
  731. readonly textBlock: BABYLON.Nullable<TextBlock>;
  732. /**
  733. * Creates a new Button
  734. * @param name defines the name of the button
  735. */
  736. constructor(name?: string | undefined);
  737. protected _getTypeName(): string;
  738. /** @hidden */
  739. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  740. /** @hidden */
  741. _onPointerEnter(target: Control): boolean;
  742. /** @hidden */
  743. _onPointerOut(target: Control): void;
  744. /** @hidden */
  745. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  746. /** @hidden */
  747. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  748. /**
  749. * Creates a new button made with an image and a text
  750. * @param name defines the name of the button
  751. * @param text defines the text of the button
  752. * @param imageUrl defines the url of the image
  753. * @returns a new Button
  754. */
  755. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  756. /**
  757. * Creates a new button made with an image
  758. * @param name defines the name of the button
  759. * @param imageUrl defines the url of the image
  760. * @returns a new Button
  761. */
  762. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  763. /**
  764. * Creates a new button made with a text
  765. * @param name defines the name of the button
  766. * @param text defines the text of the button
  767. * @returns a new Button
  768. */
  769. static CreateSimpleButton(name: string, text: string): Button;
  770. /**
  771. * Creates a new button made with an image and a centered text
  772. * @param name defines the name of the button
  773. * @param text defines the text of the button
  774. * @param imageUrl defines the url of the image
  775. * @returns a new Button
  776. */
  777. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  778. }
  779. }
  780. declare module BABYLON.GUI {
  781. /**
  782. * Class used to represent a 2D checkbox
  783. */
  784. export class Checkbox extends Control {
  785. name?: string | undefined;
  786. /** Gets or sets border thickness */
  787. thickness: number;
  788. /**
  789. * BABYLON.Observable raised when isChecked property changes
  790. */
  791. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  792. /** Gets or sets a value indicating the ratio between overall size and check size */
  793. checkSizeRatio: number;
  794. /** Gets or sets background color */
  795. background: string;
  796. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  797. isChecked: boolean;
  798. /**
  799. * Creates a new CheckBox
  800. * @param name defines the control name
  801. */
  802. constructor(name?: string | undefined);
  803. protected _getTypeName(): string;
  804. /** @hidden */
  805. _draw(context: CanvasRenderingContext2D): void;
  806. /** @hidden */
  807. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  808. /**
  809. * Utility function to easily create a checkbox with a header
  810. * @param title defines the label to use for the header
  811. * @param onValueChanged defines the callback to call when value changes
  812. * @returns a StackPanel containing the checkbox and a textBlock
  813. */
  814. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  815. }
  816. }
  817. declare module BABYLON.GUI {
  818. /** Class used to create color pickers */
  819. export class ColorPicker extends Control {
  820. name?: string | undefined;
  821. /**
  822. * BABYLON.Observable raised when the value changes
  823. */
  824. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  825. /** Gets or sets the color of the color picker */
  826. value: BABYLON.Color3;
  827. /**
  828. * Gets or sets control width
  829. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  830. */
  831. width: string | number;
  832. /** Gets or sets control height */
  833. height: string | number;
  834. /** Gets or sets control size */
  835. size: string | number;
  836. /**
  837. * Creates a new ColorPicker
  838. * @param name defines the control name
  839. */
  840. constructor(name?: string | undefined);
  841. protected _getTypeName(): string;
  842. /** @hidden */
  843. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  844. /** @hidden */
  845. _draw(context: CanvasRenderingContext2D): void;
  846. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  847. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  848. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  849. /**
  850. * This function expands the color picker by creating a color picker dialog with manual
  851. * color value input and the ability to save colors into an array to be used later in
  852. * subsequent launches of the dialogue.
  853. * @param advancedTexture defines the AdvancedDynamicTexture the dialog is assigned to
  854. * @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.
  855. * @returns picked color as a hex string and the saved colors array as hex strings.
  856. */
  857. static ShowPickerDialogAsync(advancedTexture: AdvancedDynamicTexture, options: {
  858. pickerWidth?: string;
  859. pickerHeight?: string;
  860. headerHeight?: string;
  861. lastColor?: string;
  862. swatchLimit?: number;
  863. numSwatchesPerLine?: number;
  864. savedColors?: Array<string>;
  865. }): Promise<{
  866. savedColors?: string[];
  867. pickedColor: string;
  868. }>;
  869. }
  870. }
  871. declare module BABYLON.GUI {
  872. /**
  873. * Root class for 2D containers
  874. * @see http://doc.babylonjs.com/how_to/gui#containers
  875. */
  876. export class Container extends Control {
  877. name?: string | undefined;
  878. /** @hidden */
  879. protected _children: Control[];
  880. /** @hidden */
  881. protected _measureForChildren: Measure;
  882. /** @hidden */
  883. protected _background: string;
  884. /** @hidden */
  885. protected _adaptWidthToChildren: boolean;
  886. /** @hidden */
  887. protected _adaptHeightToChildren: boolean;
  888. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  889. adaptHeightToChildren: boolean;
  890. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  891. adaptWidthToChildren: boolean;
  892. /** Gets or sets background color */
  893. background: string;
  894. /** Gets the list of children */
  895. readonly children: Control[];
  896. /**
  897. * Creates a new Container
  898. * @param name defines the name of the container
  899. */
  900. constructor(name?: string | undefined);
  901. protected _getTypeName(): string;
  902. _flagDescendantsAsMatrixDirty(): void;
  903. /**
  904. * Gets a child using its name
  905. * @param name defines the child name to look for
  906. * @returns the child control if found
  907. */
  908. getChildByName(name: string): BABYLON.Nullable<Control>;
  909. /**
  910. * Gets a child using its type and its name
  911. * @param name defines the child name to look for
  912. * @param type defines the child type to look for
  913. * @returns the child control if found
  914. */
  915. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  916. /**
  917. * Search for a specific control in children
  918. * @param control defines the control to look for
  919. * @returns true if the control is in child list
  920. */
  921. containsControl(control: Control): boolean;
  922. /**
  923. * Adds a new control to the current container
  924. * @param control defines the control to add
  925. * @returns the current container
  926. */
  927. addControl(control: BABYLON.Nullable<Control>): Container;
  928. /**
  929. * Removes all controls from the current container
  930. * @returns the current container
  931. */
  932. clearControls(): Container;
  933. /**
  934. * Removes a control from the current container
  935. * @param control defines the control to remove
  936. * @returns the current container
  937. */
  938. removeControl(control: Control): Container;
  939. /** @hidden */
  940. _reOrderControl(control: Control): void;
  941. /** @hidden */
  942. _offsetLeft(offset: number): void;
  943. /** @hidden */
  944. _offsetTop(offset: number): void;
  945. /** @hidden */
  946. _markAllAsDirty(): void;
  947. /** @hidden */
  948. protected _localDraw(context: CanvasRenderingContext2D): void;
  949. /** @hidden */
  950. _link(host: AdvancedDynamicTexture): void;
  951. /** @hidden */
  952. protected _beforeLayout(): void;
  953. /** @hidden */
  954. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  955. /** @hidden */
  956. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  957. protected _postMeasure(): void;
  958. /** @hidden */
  959. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: Measure): void;
  960. /** @hidden */
  961. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  962. /** @hidden */
  963. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  964. /** @hidden */
  965. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  966. /** Releases associated resources */
  967. dispose(): void;
  968. }
  969. }
  970. declare module BABYLON.GUI {
  971. /**
  972. * Root class used for all 2D controls
  973. * @see http://doc.babylonjs.com/how_to/gui#controls
  974. */
  975. export class Control {
  976. /** defines the name of the control */
  977. name?: string | undefined;
  978. /**
  979. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  980. */
  981. static AllowAlphaInheritance: boolean;
  982. /** @hidden */
  983. _host: AdvancedDynamicTexture;
  984. /** Gets or sets the control parent */
  985. parent: BABYLON.Nullable<Container>;
  986. /** @hidden */
  987. _currentMeasure: Measure;
  988. /** @hidden */
  989. _width: ValueAndUnit;
  990. /** @hidden */
  991. _height: ValueAndUnit;
  992. /** @hidden */
  993. protected _fontOffset: {
  994. ascent: number;
  995. height: number;
  996. descent: number;
  997. };
  998. /** @hidden */
  999. protected _horizontalAlignment: number;
  1000. /** @hidden */
  1001. protected _verticalAlignment: number;
  1002. /** @hidden */
  1003. protected _isDirty: boolean;
  1004. /** @hidden */
  1005. protected _wasDirty: boolean;
  1006. /** @hidden */
  1007. _tempParentMeasure: Measure;
  1008. /** @hidden */
  1009. _tempCurrentMeasure: Measure;
  1010. /** @hidden */
  1011. protected _cachedParentMeasure: Measure;
  1012. /** @hidden */
  1013. _left: ValueAndUnit;
  1014. /** @hidden */
  1015. _top: ValueAndUnit;
  1016. /** @hidden */
  1017. protected _invertTransformMatrix: Matrix2D;
  1018. /** @hidden */
  1019. protected _transformedPosition: BABYLON.Vector2;
  1020. /** @hidden */
  1021. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  1022. protected _isEnabled: boolean;
  1023. protected _disabledColor: string;
  1024. /** @hidden */
  1025. protected _rebuildLayout: boolean;
  1026. /** @hidden */
  1027. _isClipped: boolean;
  1028. /** @hidden */
  1029. _tag: any;
  1030. /**
  1031. * 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
  1032. */
  1033. uniqueId: number;
  1034. /**
  1035. * Gets or sets an object used to store user defined information for the node
  1036. */
  1037. metadata: any;
  1038. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  1039. isHitTestVisible: boolean;
  1040. /** Gets or sets a boolean indicating if the control can block pointer events */
  1041. isPointerBlocker: boolean;
  1042. /** Gets or sets a boolean indicating if the control can be focusable */
  1043. isFocusInvisible: boolean;
  1044. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  1045. clipChildren: boolean;
  1046. /**
  1047. * Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
  1048. */
  1049. useBitmapCache: boolean;
  1050. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  1051. shadowOffsetX: number;
  1052. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  1053. shadowOffsetY: number;
  1054. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  1055. shadowBlur: number;
  1056. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  1057. shadowColor: string;
  1058. /** Gets or sets the cursor to use when the control is hovered */
  1059. hoverCursor: string;
  1060. /** @hidden */
  1061. protected _linkOffsetX: ValueAndUnit;
  1062. /** @hidden */
  1063. protected _linkOffsetY: ValueAndUnit;
  1064. /** Gets the control type name */
  1065. readonly typeName: string;
  1066. /**
  1067. * Get the current class name of the control.
  1068. * @returns current class name
  1069. */
  1070. getClassName(): string;
  1071. /**
  1072. * An event triggered when the pointer move over the control.
  1073. */
  1074. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  1075. /**
  1076. * An event triggered when the pointer move out of the control.
  1077. */
  1078. onPointerOutObservable: BABYLON.Observable<Control>;
  1079. /**
  1080. * An event triggered when the pointer taps the control
  1081. */
  1082. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  1083. /**
  1084. * An event triggered when pointer up
  1085. */
  1086. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  1087. /**
  1088. * An event triggered when a control is clicked on
  1089. */
  1090. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  1091. /**
  1092. * An event triggered when pointer enters the control
  1093. */
  1094. onPointerEnterObservable: BABYLON.Observable<Control>;
  1095. /**
  1096. * An event triggered when the control is marked as dirty
  1097. */
  1098. onDirtyObservable: BABYLON.Observable<Control>;
  1099. /**
  1100. * An event triggered before drawing the control
  1101. */
  1102. onBeforeDrawObservable: BABYLON.Observable<Control>;
  1103. /**
  1104. * An event triggered after the control was drawn
  1105. */
  1106. onAfterDrawObservable: BABYLON.Observable<Control>;
  1107. /**
  1108. * Get the hosting AdvancedDynamicTexture
  1109. */
  1110. readonly host: AdvancedDynamicTexture;
  1111. /** Gets or set information about font offsets (used to render and align text) */
  1112. fontOffset: {
  1113. ascent: number;
  1114. height: number;
  1115. descent: number;
  1116. };
  1117. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  1118. alpha: number;
  1119. /**
  1120. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  1121. */
  1122. isHighlighted: boolean;
  1123. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  1124. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1125. */
  1126. scaleX: number;
  1127. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  1128. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1129. */
  1130. scaleY: number;
  1131. /** Gets or sets the rotation angle (0 by default)
  1132. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1133. */
  1134. rotation: number;
  1135. /** Gets or sets the transformation center on Y axis (0 by default)
  1136. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1137. */
  1138. transformCenterY: number;
  1139. /** Gets or sets the transformation center on X axis (0 by default)
  1140. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1141. */
  1142. transformCenterX: number;
  1143. /**
  1144. * Gets or sets the horizontal alignment
  1145. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1146. */
  1147. horizontalAlignment: number;
  1148. /**
  1149. * Gets or sets the vertical alignment
  1150. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1151. */
  1152. verticalAlignment: number;
  1153. /**
  1154. * Gets or sets control width
  1155. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1156. */
  1157. width: string | number;
  1158. /**
  1159. * Gets control width in pixel
  1160. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1161. */
  1162. readonly widthInPixels: number;
  1163. /**
  1164. * Gets or sets control height
  1165. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1166. */
  1167. height: string | number;
  1168. /**
  1169. * Gets control height in pixel
  1170. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1171. */
  1172. readonly heightInPixels: number;
  1173. /** Gets or set font family */
  1174. fontFamily: string;
  1175. /** Gets or sets font style */
  1176. fontStyle: string;
  1177. /** Gets or sets font weight */
  1178. fontWeight: string;
  1179. /**
  1180. * Gets or sets style
  1181. * @see http://doc.babylonjs.com/how_to/gui#styles
  1182. */
  1183. style: BABYLON.Nullable<Style>;
  1184. /** @hidden */
  1185. readonly _isFontSizeInPercentage: boolean;
  1186. /** Gets font size in pixels */
  1187. readonly fontSizeInPixels: number;
  1188. /** Gets or sets font size */
  1189. fontSize: string | number;
  1190. /** Gets or sets foreground color */
  1191. color: string;
  1192. /** Gets or sets z index which is used to reorder controls on the z axis */
  1193. zIndex: number;
  1194. /** Gets or sets a boolean indicating if the control can be rendered */
  1195. notRenderable: boolean;
  1196. /** Gets or sets a boolean indicating if the control is visible */
  1197. isVisible: boolean;
  1198. /** Gets a boolean indicating that the control needs to update its rendering */
  1199. readonly isDirty: boolean;
  1200. /**
  1201. * Gets the current linked mesh (or null if none)
  1202. */
  1203. readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  1204. /**
  1205. * Gets or sets a value indicating the padding to use on the left of the control
  1206. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1207. */
  1208. paddingLeft: string | number;
  1209. /**
  1210. * Gets a value indicating the padding in pixels to use on the left of the control
  1211. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1212. */
  1213. readonly paddingLeftInPixels: number;
  1214. /**
  1215. * Gets or sets a value indicating the padding to use on the right of the control
  1216. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1217. */
  1218. paddingRight: string | number;
  1219. /**
  1220. * Gets a value indicating the padding in pixels to use on the right of the control
  1221. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1222. */
  1223. readonly paddingRightInPixels: number;
  1224. /**
  1225. * Gets or sets a value indicating the padding to use on the top of the control
  1226. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1227. */
  1228. paddingTop: string | number;
  1229. /**
  1230. * Gets a value indicating the padding in pixels to use on the top of the control
  1231. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1232. */
  1233. readonly paddingTopInPixels: number;
  1234. /**
  1235. * Gets or sets a value indicating the padding to use on the bottom of the control
  1236. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1237. */
  1238. paddingBottom: string | number;
  1239. /**
  1240. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1241. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1242. */
  1243. readonly paddingBottomInPixels: number;
  1244. /**
  1245. * Gets or sets a value indicating the left coordinate of the control
  1246. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1247. */
  1248. left: string | number;
  1249. /**
  1250. * Gets a value indicating the left coordinate in pixels of the control
  1251. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1252. */
  1253. readonly leftInPixels: number;
  1254. /**
  1255. * Gets or sets a value indicating the top coordinate of the control
  1256. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1257. */
  1258. top: string | number;
  1259. /**
  1260. * Gets a value indicating the top coordinate in pixels of the control
  1261. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1262. */
  1263. readonly topInPixels: number;
  1264. /**
  1265. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1266. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1267. */
  1268. linkOffsetX: string | number;
  1269. /**
  1270. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1271. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1272. */
  1273. readonly linkOffsetXInPixels: number;
  1274. /**
  1275. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1276. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1277. */
  1278. linkOffsetY: string | number;
  1279. /**
  1280. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1281. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1282. */
  1283. readonly linkOffsetYInPixels: number;
  1284. /** Gets the center coordinate on X axis */
  1285. readonly centerX: number;
  1286. /** Gets the center coordinate on Y axis */
  1287. readonly centerY: number;
  1288. /** Gets or sets if control is Enabled*/
  1289. isEnabled: boolean;
  1290. /** Gets or sets background color of control if it's disabled*/
  1291. disabledColor: string;
  1292. /**
  1293. * Creates a new control
  1294. * @param name defines the name of the control
  1295. */
  1296. constructor(
  1297. /** defines the name of the control */
  1298. name?: string | undefined);
  1299. /** @hidden */
  1300. protected _getTypeName(): string;
  1301. /**
  1302. * Gets the first ascendant in the hierarchy of the given type
  1303. * @param className defines the required type
  1304. * @returns the ascendant or null if not found
  1305. */
  1306. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  1307. /** @hidden */
  1308. _resetFontCache(): void;
  1309. /**
  1310. * Determines if a container is an ascendant of the current control
  1311. * @param container defines the container to look for
  1312. * @returns true if the container is one of the ascendant of the control
  1313. */
  1314. isAscendant(container: Control): boolean;
  1315. /**
  1316. * Gets coordinates in local control space
  1317. * @param globalCoordinates defines the coordinates to transform
  1318. * @returns the new coordinates in local space
  1319. */
  1320. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1321. /**
  1322. * Gets coordinates in local control space
  1323. * @param globalCoordinates defines the coordinates to transform
  1324. * @param result defines the target vector2 where to store the result
  1325. * @returns the current control
  1326. */
  1327. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  1328. /**
  1329. * Gets coordinates in parent local control space
  1330. * @param globalCoordinates defines the coordinates to transform
  1331. * @returns the new coordinates in parent local space
  1332. */
  1333. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  1334. /**
  1335. * Move the current control to a vector3 position projected onto the screen.
  1336. * @param position defines the target position
  1337. * @param scene defines the hosting scene
  1338. */
  1339. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  1340. /** @hidden */
  1341. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  1342. /**
  1343. * Will return all controls that have this control as ascendant
  1344. * @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
  1345. * @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
  1346. * @return all child controls
  1347. */
  1348. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  1349. /**
  1350. * Link current control with a target mesh
  1351. * @param mesh defines the mesh to link with
  1352. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1353. */
  1354. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  1355. /** @hidden */
  1356. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  1357. /** @hidden */
  1358. _offsetLeft(offset: number): void;
  1359. /** @hidden */
  1360. _offsetTop(offset: number): void;
  1361. /** @hidden */
  1362. _markMatrixAsDirty(): void;
  1363. /** @hidden */
  1364. _flagDescendantsAsMatrixDirty(): void;
  1365. /** @hidden */
  1366. _intersectsRect(rect: Measure): boolean;
  1367. /** @hidden */
  1368. protected invalidateRect(left: number, top: number, right: number, bottom: number): void;
  1369. /** @hidden */
  1370. _markAsDirty(force?: boolean): void;
  1371. /** @hidden */
  1372. _markAllAsDirty(): void;
  1373. /** @hidden */
  1374. _link(host: AdvancedDynamicTexture): void;
  1375. /** @hidden */
  1376. protected _transform(context?: CanvasRenderingContext2D): void;
  1377. /** @hidden */
  1378. _renderHighlight(context: CanvasRenderingContext2D): void;
  1379. /** @hidden */
  1380. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1381. /** @hidden */
  1382. protected _applyStates(context: CanvasRenderingContext2D): void;
  1383. /** @hidden */
  1384. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1385. /** @hidden */
  1386. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1387. protected _evaluateClippingState(parentMeasure: Measure): void;
  1388. /** @hidden */
  1389. _measure(): void;
  1390. /** @hidden */
  1391. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1392. /** @hidden */
  1393. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1394. /** @hidden */
  1395. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1396. /** @hidden */
  1397. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1398. /** @hidden */
  1399. _render(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): boolean;
  1400. /** @hidden */
  1401. _draw(context: CanvasRenderingContext2D, invalidatedRectangle?: BABYLON.Nullable<Measure>): void;
  1402. /**
  1403. * Tests if a given coordinates belong to the current control
  1404. * @param x defines x coordinate to test
  1405. * @param y defines y coordinate to test
  1406. * @returns true if the coordinates are inside the control
  1407. */
  1408. contains(x: number, y: number): boolean;
  1409. /** @hidden */
  1410. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1411. /** @hidden */
  1412. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  1413. /** @hidden */
  1414. _onPointerEnter(target: Control): boolean;
  1415. /** @hidden */
  1416. _onPointerOut(target: Control): void;
  1417. /** @hidden */
  1418. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1419. /** @hidden */
  1420. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1421. /** @hidden */
  1422. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  1423. /** @hidden */
  1424. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1425. /** Releases associated resources */
  1426. dispose(): void;
  1427. /** HORIZONTAL_ALIGNMENT_LEFT */
  1428. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1429. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1430. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1431. /** HORIZONTAL_ALIGNMENT_CENTER */
  1432. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1433. /** VERTICAL_ALIGNMENT_TOP */
  1434. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1435. /** VERTICAL_ALIGNMENT_BOTTOM */
  1436. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1437. /** VERTICAL_ALIGNMENT_CENTER */
  1438. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1439. /** @hidden */
  1440. static _GetFontOffset(font: string): {
  1441. ascent: number;
  1442. height: number;
  1443. descent: number;
  1444. };
  1445. /**
  1446. * Creates a stack panel that can be used to render headers
  1447. * @param control defines the control to associate with the header
  1448. * @param text defines the text of the header
  1449. * @param size defines the size of the header
  1450. * @param options defines options used to configure the header
  1451. * @returns a new StackPanel
  1452. * @ignore
  1453. * @hidden
  1454. */
  1455. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1456. isHorizontal: boolean;
  1457. controlFirst: boolean;
  1458. }) => any;
  1459. /** @hidden */
  1460. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1461. }
  1462. }
  1463. declare module BABYLON.GUI {
  1464. /** Class used to create 2D ellipse containers */
  1465. export class Ellipse extends Container {
  1466. name?: string | undefined;
  1467. /** Gets or sets border thickness */
  1468. thickness: number;
  1469. /**
  1470. * Creates a new Ellipse
  1471. * @param name defines the control name
  1472. */
  1473. constructor(name?: string | undefined);
  1474. protected _getTypeName(): string;
  1475. protected _localDraw(context: CanvasRenderingContext2D): void;
  1476. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1477. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1478. }
  1479. }
  1480. declare module BABYLON.GUI {
  1481. /**
  1482. * Class used to create a 2D grid container
  1483. */
  1484. export class Grid extends Container {
  1485. name?: string | undefined;
  1486. /**
  1487. * Gets the number of columns
  1488. */
  1489. readonly columnCount: number;
  1490. /**
  1491. * Gets the number of rows
  1492. */
  1493. readonly rowCount: number;
  1494. /** Gets the list of children */
  1495. readonly children: Control[];
  1496. /**
  1497. * Gets the definition of a specific row
  1498. * @param index defines the index of the row
  1499. * @returns the row definition
  1500. */
  1501. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  1502. /**
  1503. * Gets the definition of a specific column
  1504. * @param index defines the index of the column
  1505. * @returns the column definition
  1506. */
  1507. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  1508. /**
  1509. * Adds a new row to the grid
  1510. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1511. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1512. * @returns the current grid
  1513. */
  1514. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1515. /**
  1516. * Adds a new column to the grid
  1517. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1518. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1519. * @returns the current grid
  1520. */
  1521. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1522. /**
  1523. * Update a row definition
  1524. * @param index defines the index of the row to update
  1525. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1526. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1527. * @returns the current grid
  1528. */
  1529. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1530. /**
  1531. * Update a column definition
  1532. * @param index defines the index of the column to update
  1533. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1534. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1535. * @returns the current grid
  1536. */
  1537. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1538. /**
  1539. * Gets the list of children stored in a specific cell
  1540. * @param row defines the row to check
  1541. * @param column defines the column to check
  1542. * @returns the list of controls
  1543. */
  1544. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  1545. /**
  1546. * Gets a string representing the child cell info (row x column)
  1547. * @param child defines the control to get info from
  1548. * @returns a string containing the child cell info (row x column)
  1549. */
  1550. getChildCellInfo(child: Control): string;
  1551. /**
  1552. * Remove a column definition at specified index
  1553. * @param index defines the index of the column to remove
  1554. * @returns the current grid
  1555. */
  1556. removeColumnDefinition(index: number): Grid;
  1557. /**
  1558. * Remove a row definition at specified index
  1559. * @param index defines the index of the row to remove
  1560. * @returns the current grid
  1561. */
  1562. removeRowDefinition(index: number): Grid;
  1563. /**
  1564. * Adds a new control to the current grid
  1565. * @param control defines the control to add
  1566. * @param row defines the row where to add the control (0 by default)
  1567. * @param column defines the column where to add the control (0 by default)
  1568. * @returns the current grid
  1569. */
  1570. addControl(control: Control, row?: number, column?: number): Grid;
  1571. /**
  1572. * Removes a control from the current container
  1573. * @param control defines the control to remove
  1574. * @returns the current container
  1575. */
  1576. removeControl(control: Control): Container;
  1577. /**
  1578. * Creates a new Grid
  1579. * @param name defines control name
  1580. */
  1581. constructor(name?: string | undefined);
  1582. protected _getTypeName(): string;
  1583. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  1584. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1585. _flagDescendantsAsMatrixDirty(): void;
  1586. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1587. /** Releases associated resources */
  1588. dispose(): void;
  1589. }
  1590. }
  1591. declare module BABYLON.GUI {
  1592. /**
  1593. * Class used to create 2D images
  1594. */
  1595. export class Image extends Control {
  1596. name?: string | undefined;
  1597. /**
  1598. * BABYLON.Observable notified when the content is loaded
  1599. */
  1600. onImageLoadedObservable: BABYLON.Observable<Image>;
  1601. /**
  1602. * Gets a boolean indicating that the content is loaded
  1603. */
  1604. readonly isLoaded: boolean;
  1605. /**
  1606. * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data
  1607. */
  1608. populateNinePatchSlicesFromImage: boolean;
  1609. /**
  1610. * Gets or sets the left value for slicing (9-patch)
  1611. */
  1612. sliceLeft: number;
  1613. /**
  1614. * Gets or sets the right value for slicing (9-patch)
  1615. */
  1616. sliceRight: number;
  1617. /**
  1618. * Gets or sets the top value for slicing (9-patch)
  1619. */
  1620. sliceTop: number;
  1621. /**
  1622. * Gets or sets the bottom value for slicing (9-patch)
  1623. */
  1624. sliceBottom: number;
  1625. /**
  1626. * Gets or sets the left coordinate in the source image
  1627. */
  1628. sourceLeft: number;
  1629. /**
  1630. * Gets or sets the top coordinate in the source image
  1631. */
  1632. sourceTop: number;
  1633. /**
  1634. * Gets or sets the width to capture in the source image
  1635. */
  1636. sourceWidth: number;
  1637. /**
  1638. * Gets or sets the height to capture in the source image
  1639. */
  1640. sourceHeight: number;
  1641. /**
  1642. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1643. * @see http://doc.babylonjs.com/how_to/gui#image
  1644. */
  1645. autoScale: boolean;
  1646. /** Gets or sets the streching mode used by the image */
  1647. stretch: number;
  1648. /**
  1649. * Gets or sets the internal DOM image used to render the control
  1650. */
  1651. domImage: HTMLImageElement;
  1652. /**
  1653. * Gets or sets image source url
  1654. */
  1655. source: BABYLON.Nullable<string>;
  1656. /**
  1657. * Gets or sets the cell width to use when animation sheet is enabled
  1658. * @see http://doc.babylonjs.com/how_to/gui#image
  1659. */
  1660. cellWidth: number;
  1661. /**
  1662. * Gets or sets the cell height to use when animation sheet is enabled
  1663. * @see http://doc.babylonjs.com/how_to/gui#image
  1664. */
  1665. cellHeight: number;
  1666. /**
  1667. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1668. * @see http://doc.babylonjs.com/how_to/gui#image
  1669. */
  1670. cellId: number;
  1671. /**
  1672. * Creates a new Image
  1673. * @param name defines the control name
  1674. * @param url defines the image url
  1675. */
  1676. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  1677. protected _getTypeName(): string;
  1678. /** Force the control to synchronize with its content */
  1679. synchronizeSizeWithContent(): void;
  1680. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1681. _draw(context: CanvasRenderingContext2D): void;
  1682. dispose(): void;
  1683. /** STRETCH_NONE */
  1684. static readonly STRETCH_NONE: number;
  1685. /** STRETCH_FILL */
  1686. static readonly STRETCH_FILL: number;
  1687. /** STRETCH_UNIFORM */
  1688. static readonly STRETCH_UNIFORM: number;
  1689. /** STRETCH_EXTEND */
  1690. static readonly STRETCH_EXTEND: number;
  1691. /** NINE_PATCH */
  1692. static readonly STRETCH_NINE_PATCH: number;
  1693. }
  1694. }
  1695. declare module BABYLON.GUI {
  1696. /**
  1697. * Class used to create input text control
  1698. */
  1699. export class InputText extends Control implements IFocusableControl {
  1700. name?: string | undefined;
  1701. /** @hidden */
  1702. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  1703. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1704. promptMessage: string;
  1705. /** BABYLON.Observable raised when the text changes */
  1706. onTextChangedObservable: BABYLON.Observable<InputText>;
  1707. /** BABYLON.Observable raised just before an entered character is to be added */
  1708. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  1709. /** BABYLON.Observable raised when the control gets the focus */
  1710. onFocusObservable: BABYLON.Observable<InputText>;
  1711. /** BABYLON.Observable raised when the control loses the focus */
  1712. onBlurObservable: BABYLON.Observable<InputText>;
  1713. /**Observable raised when the text is highlighted */
  1714. onTextHighlightObservable: BABYLON.Observable<InputText>;
  1715. /**Observable raised when copy event is triggered */
  1716. onTextCopyObservable: BABYLON.Observable<InputText>;
  1717. /** BABYLON.Observable raised when cut event is triggered */
  1718. onTextCutObservable: BABYLON.Observable<InputText>;
  1719. /** BABYLON.Observable raised when paste event is triggered */
  1720. onTextPasteObservable: BABYLON.Observable<InputText>;
  1721. /** BABYLON.Observable raised when a key event was processed */
  1722. onKeyboardEventProcessedObservable: BABYLON.Observable<KeyboardEvent>;
  1723. /** Gets or sets the maximum width allowed by the control */
  1724. maxWidth: string | number;
  1725. /** Gets the maximum width allowed by the control in pixels */
  1726. readonly maxWidthInPixels: number;
  1727. /** Gets or sets the text highlighter transparency; default: 0.4 */
  1728. highligherOpacity: number;
  1729. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  1730. onFocusSelectAll: boolean;
  1731. /** Gets or sets the text hightlight color */
  1732. textHighlightColor: string;
  1733. /** Gets or sets control margin */
  1734. margin: string;
  1735. /** Gets control margin in pixels */
  1736. readonly marginInPixels: number;
  1737. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1738. autoStretchWidth: boolean;
  1739. /** Gets or sets border thickness */
  1740. thickness: number;
  1741. /** Gets or sets the background color when focused */
  1742. focusedBackground: string;
  1743. /** Gets or sets the background color when focused */
  1744. focusedColor: string;
  1745. /** Gets or sets the background color */
  1746. background: string;
  1747. /** Gets or sets the placeholder color */
  1748. placeholderColor: string;
  1749. /** Gets or sets the text displayed when the control is empty */
  1750. placeholderText: string;
  1751. /** Gets or sets the dead key flag */
  1752. deadKey: boolean;
  1753. /** Gets or sets the highlight text */
  1754. highlightedText: string;
  1755. /** Gets or sets if the current key should be added */
  1756. addKey: boolean;
  1757. /** Gets or sets the value of the current key being entered */
  1758. currentKey: string;
  1759. /** Gets or sets the text displayed in the control */
  1760. text: string;
  1761. /** Gets or sets control width */
  1762. width: string | number;
  1763. /**
  1764. * Creates a new InputText
  1765. * @param name defines the control name
  1766. * @param text defines the text of the control
  1767. */
  1768. constructor(name?: string | undefined, text?: string);
  1769. /** @hidden */
  1770. onBlur(): void;
  1771. /** @hidden */
  1772. onFocus(): void;
  1773. protected _getTypeName(): string;
  1774. /**
  1775. * Function called to get the list of controls that should not steal the focus from this control
  1776. * @returns an array of controls
  1777. */
  1778. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  1779. /** @hidden */
  1780. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  1781. /**
  1782. * Handles the keyboard event
  1783. * @param evt Defines the KeyboardEvent
  1784. */
  1785. processKeyboard(evt: KeyboardEvent): void;
  1786. _draw(context: CanvasRenderingContext2D): void;
  1787. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1788. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  1789. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1790. protected _beforeRenderText(text: string): string;
  1791. dispose(): void;
  1792. }
  1793. }
  1794. declare module BABYLON.GUI {
  1795. /**
  1796. * Class used to create a password control
  1797. */
  1798. export class InputPassword extends InputText {
  1799. protected _beforeRenderText(text: string): string;
  1800. }
  1801. }
  1802. declare module BABYLON.GUI {
  1803. /** Class used to render 2D lines */
  1804. export class Line extends Control {
  1805. name?: string | undefined;
  1806. /** Gets or sets the dash pattern */
  1807. dash: Array<number>;
  1808. /** Gets or sets the control connected with the line end */
  1809. connectedControl: Control;
  1810. /** Gets or sets start coordinates on X axis */
  1811. x1: string | number;
  1812. /** Gets or sets start coordinates on Y axis */
  1813. y1: string | number;
  1814. /** Gets or sets end coordinates on X axis */
  1815. x2: string | number;
  1816. /** Gets or sets end coordinates on Y axis */
  1817. y2: string | number;
  1818. /** Gets or sets line width */
  1819. lineWidth: number;
  1820. /** Gets or sets horizontal alignment */
  1821. horizontalAlignment: number;
  1822. /** Gets or sets vertical alignment */
  1823. verticalAlignment: number;
  1824. /**
  1825. * Creates a new Line
  1826. * @param name defines the control name
  1827. */
  1828. constructor(name?: string | undefined);
  1829. protected _getTypeName(): string;
  1830. _draw(context: CanvasRenderingContext2D): void;
  1831. _measure(): void;
  1832. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1833. /**
  1834. * Move one end of the line given 3D cartesian coordinates.
  1835. * @param position Targeted world position
  1836. * @param scene BABYLON.Scene
  1837. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1838. */
  1839. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  1840. /**
  1841. * Move one end of the line to a position in screen absolute space.
  1842. * @param projectedPosition Position in screen absolute space (X, Y)
  1843. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1844. */
  1845. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  1846. }
  1847. }
  1848. declare module BABYLON.GUI {
  1849. /**
  1850. * Class used to create multi line control
  1851. */
  1852. export class MultiLine extends Control {
  1853. name?: string | undefined;
  1854. /**
  1855. * Creates a new MultiLine
  1856. * @param name defines the control name
  1857. */
  1858. constructor(name?: string | undefined);
  1859. /** Gets or sets dash pattern */
  1860. dash: Array<number>;
  1861. /**
  1862. * Gets point stored at specified index
  1863. * @param index defines the index to look for
  1864. * @returns the requested point if found
  1865. */
  1866. getAt(index: number): MultiLinePoint;
  1867. /** Function called when a point is updated */
  1868. onPointUpdate: () => void;
  1869. /**
  1870. * Adds new points to the point collection
  1871. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1872. * @returns the list of created MultiLinePoint
  1873. */
  1874. add(...items: (AbstractMesh | Control | {
  1875. x: string | number;
  1876. y: string | number;
  1877. })[]): MultiLinePoint[];
  1878. /**
  1879. * Adds a new point to the point collection
  1880. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1881. * @returns the created MultiLinePoint
  1882. */
  1883. push(item?: (AbstractMesh | Control | {
  1884. x: string | number;
  1885. y: string | number;
  1886. })): MultiLinePoint;
  1887. /**
  1888. * Remove a specific value or point from the active point collection
  1889. * @param value defines the value or point to remove
  1890. */
  1891. remove(value: number | MultiLinePoint): void;
  1892. /**
  1893. * Resets this object to initial state (no point)
  1894. */
  1895. reset(): void;
  1896. /**
  1897. * Resets all links
  1898. */
  1899. resetLinks(): void;
  1900. /** Gets or sets line width */
  1901. lineWidth: number;
  1902. horizontalAlignment: number;
  1903. verticalAlignment: number;
  1904. protected _getTypeName(): string;
  1905. _draw(context: CanvasRenderingContext2D): void;
  1906. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1907. _measure(): void;
  1908. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1909. dispose(): void;
  1910. }
  1911. }
  1912. declare module BABYLON.GUI {
  1913. /**
  1914. * Class used to create radio button controls
  1915. */
  1916. export class RadioButton extends Control {
  1917. name?: string | undefined;
  1918. /** Gets or sets border thickness */
  1919. thickness: number;
  1920. /** Gets or sets group name */
  1921. group: string;
  1922. /** BABYLON.Observable raised when isChecked is changed */
  1923. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  1924. /** Gets or sets a value indicating the ratio between overall size and check size */
  1925. checkSizeRatio: number;
  1926. /** Gets or sets background color */
  1927. background: string;
  1928. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1929. isChecked: boolean;
  1930. /**
  1931. * Creates a new RadioButton
  1932. * @param name defines the control name
  1933. */
  1934. constructor(name?: string | undefined);
  1935. protected _getTypeName(): string;
  1936. _draw(context: CanvasRenderingContext2D): void;
  1937. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  1938. /**
  1939. * Utility function to easily create a radio button with a header
  1940. * @param title defines the label to use for the header
  1941. * @param group defines the group to use for the radio button
  1942. * @param isChecked defines the initial state of the radio button
  1943. * @param onValueChanged defines the callback to call when value changes
  1944. * @returns a StackPanel containing the radio button and a textBlock
  1945. */
  1946. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  1947. }
  1948. }
  1949. declare module BABYLON.GUI {
  1950. /**
  1951. * Class used to create a 2D stack panel container
  1952. */
  1953. export class StackPanel extends Container {
  1954. name?: string | undefined;
  1955. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1956. isVertical: boolean;
  1957. /**
  1958. * Gets or sets panel width.
  1959. * This value should not be set when in horizontal mode as it will be computed automatically
  1960. */
  1961. width: string | number;
  1962. /**
  1963. * Gets or sets panel height.
  1964. * This value should not be set when in vertical mode as it will be computed automatically
  1965. */
  1966. 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. }
  1979. declare module BABYLON.GUI {
  1980. /** Class used to create a RadioGroup
  1981. * which contains groups of radio buttons
  1982. */
  1983. export class SelectorGroup {
  1984. /** name of SelectorGroup */
  1985. name: string;
  1986. /**
  1987. * Creates a new SelectorGroup
  1988. * @param name of group, used as a group heading
  1989. */
  1990. constructor(
  1991. /** name of SelectorGroup */
  1992. name: string);
  1993. /** Gets the groupPanel of the SelectorGroup */
  1994. readonly groupPanel: StackPanel;
  1995. /** Gets the selectors array */
  1996. readonly selectors: StackPanel[];
  1997. /** Gets and sets the group header */
  1998. header: string;
  1999. /** @hidden*/
  2000. _getSelector(selectorNb: number): StackPanel | undefined;
  2001. /** Removes the selector at the given position
  2002. * @param selectorNb the position of the selector within the group
  2003. */
  2004. removeSelector(selectorNb: number): void;
  2005. }
  2006. /** Class used to create a CheckboxGroup
  2007. * which contains groups of checkbox buttons
  2008. */
  2009. export class CheckboxGroup extends SelectorGroup {
  2010. /** Adds a checkbox as a control
  2011. * @param text is the label for the selector
  2012. * @param func is the function called when the Selector is checked
  2013. * @param checked is true when Selector is checked
  2014. */
  2015. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  2016. /** @hidden */
  2017. _setSelectorLabel(selectorNb: number, label: string): void;
  2018. /** @hidden */
  2019. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2020. /** @hidden */
  2021. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2022. /** @hidden */
  2023. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2024. }
  2025. /** Class used to create a RadioGroup
  2026. * which contains groups of radio buttons
  2027. */
  2028. export class RadioGroup extends SelectorGroup {
  2029. /** Adds a radio button as a control
  2030. * @param label is the label for the selector
  2031. * @param func is the function called when the Selector is checked
  2032. * @param checked is true when Selector is checked
  2033. */
  2034. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  2035. /** @hidden */
  2036. _setSelectorLabel(selectorNb: number, label: string): void;
  2037. /** @hidden */
  2038. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2039. /** @hidden */
  2040. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2041. /** @hidden */
  2042. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2043. }
  2044. /** Class used to create a SliderGroup
  2045. * which contains groups of slider buttons
  2046. */
  2047. export class SliderGroup extends SelectorGroup {
  2048. /**
  2049. * Adds a slider to the SelectorGroup
  2050. * @param label is the label for the SliderBar
  2051. * @param func is the function called when the Slider moves
  2052. * @param unit is a string describing the units used, eg degrees or metres
  2053. * @param min is the minimum value for the Slider
  2054. * @param max is the maximum value for the Slider
  2055. * @param value is the start value for the Slider between min and max
  2056. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  2057. */
  2058. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  2059. /** @hidden */
  2060. _setSelectorLabel(selectorNb: number, label: string): void;
  2061. /** @hidden */
  2062. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2063. /** @hidden */
  2064. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2065. /** @hidden */
  2066. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2067. }
  2068. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  2069. * @see http://doc.babylonjs.com/how_to/selector
  2070. */
  2071. export class SelectionPanel extends Rectangle {
  2072. /** name of SelectionPanel */
  2073. name: string;
  2074. /** an array of SelectionGroups */
  2075. groups: SelectorGroup[];
  2076. /**
  2077. * Creates a new SelectionPanel
  2078. * @param name of SelectionPanel
  2079. * @param groups is an array of SelectionGroups
  2080. */
  2081. constructor(
  2082. /** name of SelectionPanel */
  2083. name: string,
  2084. /** an array of SelectionGroups */
  2085. groups?: SelectorGroup[]);
  2086. protected _getTypeName(): string;
  2087. /** Gets or sets the headerColor */
  2088. headerColor: string;
  2089. /** Gets or sets the button color */
  2090. buttonColor: string;
  2091. /** Gets or sets the label color */
  2092. labelColor: string;
  2093. /** Gets or sets the button background */
  2094. buttonBackground: string;
  2095. /** Gets or sets the color of separator bar */
  2096. barColor: string;
  2097. /** Gets or sets the height of separator bar */
  2098. barHeight: string;
  2099. /** Gets or sets the height of spacers*/
  2100. spacerHeight: string;
  2101. /** Add a group to the selection panel
  2102. * @param group is the selector group to add
  2103. */
  2104. addGroup(group: SelectorGroup): void;
  2105. /** Remove the group from the given position
  2106. * @param groupNb is the position of the group in the list
  2107. */
  2108. removeGroup(groupNb: number): void;
  2109. /** Change a group header label
  2110. * @param label is the new group header label
  2111. * @param groupNb is the number of the group to relabel
  2112. * */
  2113. setHeaderName(label: string, groupNb: number): void;
  2114. /** Change selector label to the one given
  2115. * @param label is the new selector label
  2116. * @param groupNb is the number of the groupcontaining the selector
  2117. * @param selectorNb is the number of the selector within a group to relabel
  2118. * */
  2119. relabel(label: string, groupNb: number, selectorNb: number): void;
  2120. /** For a given group position remove the selector at the given position
  2121. * @param groupNb is the number of the group to remove the selector from
  2122. * @param selectorNb is the number of the selector within the group
  2123. */
  2124. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  2125. /** For a given group position of correct type add a checkbox button
  2126. * @param groupNb is the number of the group to remove the selector from
  2127. * @param label is the label for the selector
  2128. * @param func is the function called when the Selector is checked
  2129. * @param checked is true when Selector is checked
  2130. */
  2131. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2132. /** For a given group position of correct type add a radio button
  2133. * @param groupNb is the number of the group to remove the selector from
  2134. * @param label is the label for the selector
  2135. * @param func is the function called when the Selector is checked
  2136. * @param checked is true when Selector is checked
  2137. */
  2138. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2139. /**
  2140. * For a given slider group add a slider
  2141. * @param groupNb is the number of the group to add the slider to
  2142. * @param label is the label for the Slider
  2143. * @param func is the function called when the Slider moves
  2144. * @param unit is a string describing the units used, eg degrees or metres
  2145. * @param min is the minimum value for the Slider
  2146. * @param max is the maximum value for the Slider
  2147. * @param value is the start value for the Slider between min and max
  2148. * @param onVal is the function used to format the value displayed, eg radians to degrees
  2149. */
  2150. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  2151. }
  2152. }
  2153. declare module BABYLON.GUI {
  2154. /**
  2155. * Class used to hold a viewer window and sliders in a grid
  2156. */
  2157. export class ScrollViewer extends Rectangle {
  2158. /**
  2159. * Gets the horizontal scrollbar
  2160. */
  2161. readonly horizontalBar: ScrollBar;
  2162. /**
  2163. * Gets the vertical scrollbar
  2164. */
  2165. readonly verticalBar: ScrollBar;
  2166. /**
  2167. * Adds a new control to the current container
  2168. * @param control defines the control to add
  2169. * @returns the current container
  2170. */
  2171. addControl(control: BABYLON.Nullable<Control>): Container;
  2172. /**
  2173. * Removes a control from the current container
  2174. * @param control defines the control to remove
  2175. * @returns the current container
  2176. */
  2177. removeControl(control: Control): Container;
  2178. /** Gets the list of children */
  2179. readonly children: Control[];
  2180. _flagDescendantsAsMatrixDirty(): void;
  2181. /**
  2182. * Creates a new ScrollViewer
  2183. * @param name of ScrollViewer
  2184. */
  2185. constructor(name?: string);
  2186. /** Reset the scroll viewer window to initial size */
  2187. resetWindow(): void;
  2188. protected _getTypeName(): string;
  2189. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2190. protected _postMeasure(): void;
  2191. /**
  2192. * Gets or sets the mouse wheel precision
  2193. * from 0 to 1 with a default value of 0.05
  2194. * */
  2195. wheelPrecision: number;
  2196. /** Gets or sets the bar color */
  2197. barColor: string;
  2198. /** Gets or sets the size of the bar */
  2199. barSize: number;
  2200. /** Gets or sets the bar background */
  2201. barBackground: string;
  2202. _link(host: AdvancedDynamicTexture): void;
  2203. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2204. /** Releases associated resources */
  2205. dispose(): void;
  2206. }
  2207. }
  2208. declare module BABYLON.GUI {
  2209. /**
  2210. * Enum that determines the text-wrapping mode to use.
  2211. */
  2212. export enum TextWrapping {
  2213. /**
  2214. * Clip the text when it's larger than Control.width; this is the default mode.
  2215. */
  2216. Clip = 0,
  2217. /**
  2218. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  2219. */
  2220. WordWrap = 1,
  2221. /**
  2222. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  2223. */
  2224. Ellipsis = 2
  2225. }
  2226. /**
  2227. * Class used to create text block control
  2228. */
  2229. export class TextBlock extends Control {
  2230. /**
  2231. * Defines the name of the control
  2232. */
  2233. name?: string | undefined;
  2234. /**
  2235. * An event triggered after the text is changed
  2236. */
  2237. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  2238. /**
  2239. * An event triggered after the text was broken up into lines
  2240. */
  2241. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  2242. /**
  2243. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  2244. */
  2245. readonly lines: any[];
  2246. /**
  2247. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  2248. */
  2249. resizeToFit: boolean;
  2250. /**
  2251. * Gets or sets a boolean indicating if text must be wrapped
  2252. */
  2253. textWrapping: TextWrapping | boolean;
  2254. /**
  2255. * Gets or sets text to display
  2256. */
  2257. text: string;
  2258. /**
  2259. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  2260. */
  2261. textHorizontalAlignment: number;
  2262. /**
  2263. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  2264. */
  2265. textVerticalAlignment: number;
  2266. /**
  2267. * Gets or sets line spacing value
  2268. */
  2269. lineSpacing: string | number;
  2270. /**
  2271. * Gets or sets outlineWidth of the text to display
  2272. */
  2273. outlineWidth: number;
  2274. /**
  2275. * Gets or sets outlineColor of the text to display
  2276. */
  2277. outlineColor: string;
  2278. /**
  2279. * Creates a new TextBlock object
  2280. * @param name defines the name of the control
  2281. * @param text defines the text to display (emptry string by default)
  2282. */
  2283. constructor(
  2284. /**
  2285. * Defines the name of the control
  2286. */
  2287. name?: string | undefined, text?: string);
  2288. protected _getTypeName(): string;
  2289. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2290. /** @hidden */
  2291. _draw(context: CanvasRenderingContext2D): void;
  2292. protected _applyStates(context: CanvasRenderingContext2D): void;
  2293. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  2294. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  2295. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  2296. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  2297. protected _renderLines(context: CanvasRenderingContext2D): void;
  2298. /**
  2299. * Given a width constraint applied on the text block, find the expected height
  2300. * @returns expected height
  2301. */
  2302. computeExpectedHeight(): number;
  2303. dispose(): void;
  2304. }
  2305. }
  2306. declare module BABYLON.GUI {
  2307. /**
  2308. * Class used to store key control properties
  2309. */
  2310. export class KeyPropertySet {
  2311. /** Width */
  2312. width?: string;
  2313. /** Height */
  2314. height?: string;
  2315. /** Left padding */
  2316. paddingLeft?: string;
  2317. /** Right padding */
  2318. paddingRight?: string;
  2319. /** Top padding */
  2320. paddingTop?: string;
  2321. /** Bottom padding */
  2322. paddingBottom?: string;
  2323. /** Foreground color */
  2324. color?: string;
  2325. /** Background color */
  2326. background?: string;
  2327. }
  2328. /**
  2329. * Class used to create virtual keyboard
  2330. */
  2331. export class VirtualKeyboard extends StackPanel {
  2332. /** BABYLON.Observable raised when a key is pressed */
  2333. onKeyPressObservable: BABYLON.Observable<string>;
  2334. /** Gets or sets default key button width */
  2335. defaultButtonWidth: string;
  2336. /** Gets or sets default key button height */
  2337. defaultButtonHeight: string;
  2338. /** Gets or sets default key button left padding */
  2339. defaultButtonPaddingLeft: string;
  2340. /** Gets or sets default key button right padding */
  2341. defaultButtonPaddingRight: string;
  2342. /** Gets or sets default key button top padding */
  2343. defaultButtonPaddingTop: string;
  2344. /** Gets or sets default key button bottom padding */
  2345. defaultButtonPaddingBottom: string;
  2346. /** Gets or sets default key button foreground color */
  2347. defaultButtonColor: string;
  2348. /** Gets or sets default key button background color */
  2349. defaultButtonBackground: string;
  2350. /** Gets or sets shift button foreground color */
  2351. shiftButtonColor: string;
  2352. /** Gets or sets shift button thickness*/
  2353. selectedShiftThickness: number;
  2354. /** Gets shift key state */
  2355. shiftState: number;
  2356. protected _getTypeName(): string;
  2357. /**
  2358. * Adds a new row of keys
  2359. * @param keys defines the list of keys to add
  2360. * @param propertySets defines the associated property sets
  2361. */
  2362. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2363. /**
  2364. * Set the shift key to a specific state
  2365. * @param shiftState defines the new shift state
  2366. */
  2367. applyShiftState(shiftState: number): void;
  2368. /** Gets the input text control currently attached to the keyboard */
  2369. readonly connectedInputText: BABYLON.Nullable<InputText>;
  2370. /**
  2371. * Connects the keyboard with an input text control
  2372. *
  2373. * @param input defines the target control
  2374. */
  2375. connect(input: InputText): void;
  2376. /**
  2377. * Disconnects the keyboard from connected InputText controls
  2378. *
  2379. * @param input optionally defines a target control, otherwise all are disconnected
  2380. */
  2381. disconnect(input?: InputText): void;
  2382. /**
  2383. * Release all resources
  2384. */
  2385. dispose(): void;
  2386. /**
  2387. * Creates a new keyboard using a default layout
  2388. *
  2389. * @param name defines control name
  2390. * @returns a new VirtualKeyboard
  2391. */
  2392. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2393. }
  2394. }
  2395. declare module BABYLON.GUI {
  2396. /** Class used to create rectangle container */
  2397. export class Rectangle extends Container {
  2398. name?: string | undefined;
  2399. /** Gets or sets border thickness */
  2400. thickness: number;
  2401. /** Gets or sets the corner radius angle */
  2402. cornerRadius: number;
  2403. /**
  2404. * Creates a new Rectangle
  2405. * @param name defines the control name
  2406. */
  2407. constructor(name?: string | undefined);
  2408. protected _getTypeName(): string;
  2409. protected _localDraw(context: CanvasRenderingContext2D): void;
  2410. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2411. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2412. }
  2413. }
  2414. declare module BABYLON.GUI {
  2415. /** Class used to render a grid */
  2416. export class DisplayGrid extends Control {
  2417. name?: string | undefined;
  2418. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  2419. displayMinorLines: boolean;
  2420. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  2421. displayMajorLines: boolean;
  2422. /** Gets or sets background color (Black by default) */
  2423. background: string;
  2424. /** Gets or sets the width of each cell (20 by default) */
  2425. cellWidth: number;
  2426. /** Gets or sets the height of each cell (20 by default) */
  2427. cellHeight: number;
  2428. /** Gets or sets the tickness of minor lines (1 by default) */
  2429. minorLineTickness: number;
  2430. /** Gets or sets the color of minor lines (DarkGray by default) */
  2431. minorLineColor: string;
  2432. /** Gets or sets the tickness of major lines (2 by default) */
  2433. majorLineTickness: number;
  2434. /** Gets or sets the color of major lines (White by default) */
  2435. majorLineColor: string;
  2436. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  2437. majorLineFrequency: number;
  2438. /**
  2439. * Creates a new GridDisplayRectangle
  2440. * @param name defines the control name
  2441. */
  2442. constructor(name?: string | undefined);
  2443. _draw(context: CanvasRenderingContext2D): void;
  2444. protected _getTypeName(): string;
  2445. }
  2446. }
  2447. declare module BABYLON.GUI {
  2448. /**
  2449. * Class used to create slider controls
  2450. */
  2451. export class BaseSlider extends Control {
  2452. name?: string | undefined;
  2453. protected _thumbWidth: ValueAndUnit;
  2454. protected _barOffset: ValueAndUnit;
  2455. protected _displayThumb: boolean;
  2456. protected _effectiveBarOffset: number;
  2457. protected _renderLeft: number;
  2458. protected _renderTop: number;
  2459. protected _renderWidth: number;
  2460. protected _renderHeight: number;
  2461. protected _backgroundBoxLength: number;
  2462. protected _backgroundBoxThickness: number;
  2463. protected _effectiveThumbThickness: number;
  2464. /** BABYLON.Observable raised when the sldier value changes */
  2465. onValueChangedObservable: BABYLON.Observable<number>;
  2466. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2467. displayThumb: boolean;
  2468. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2469. barOffset: string | number;
  2470. /** Gets main bar offset in pixels*/
  2471. readonly barOffsetInPixels: number;
  2472. /** Gets or sets thumb width */
  2473. thumbWidth: string | number;
  2474. /** Gets thumb width in pixels */
  2475. readonly thumbWidthInPixels: number;
  2476. /** Gets or sets minimum value */
  2477. minimum: number;
  2478. /** Gets or sets maximum value */
  2479. maximum: number;
  2480. /** Gets or sets current value */
  2481. value: number;
  2482. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2483. isVertical: boolean;
  2484. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2485. isThumbClamped: boolean;
  2486. /**
  2487. * Creates a new BaseSlider
  2488. * @param name defines the control name
  2489. */
  2490. constructor(name?: string | undefined);
  2491. protected _getTypeName(): string;
  2492. protected _getThumbPosition(): number;
  2493. protected _getThumbThickness(type: string): number;
  2494. protected _prepareRenderingData(type: string): void;
  2495. /** @hidden */
  2496. protected _updateValueFromPointer(x: number, y: number): void;
  2497. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  2498. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  2499. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2500. }
  2501. }
  2502. declare module BABYLON.GUI {
  2503. /**
  2504. * Class used to create slider controls
  2505. */
  2506. export class Slider extends BaseSlider {
  2507. name?: string | undefined;
  2508. protected _displayValueBar: boolean;
  2509. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2510. displayValueBar: boolean;
  2511. /** Gets or sets border color */
  2512. borderColor: string;
  2513. /** Gets or sets background color */
  2514. background: string;
  2515. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2516. isThumbCircle: boolean;
  2517. /**
  2518. * Creates a new Slider
  2519. * @param name defines the control name
  2520. */
  2521. constructor(name?: string | undefined);
  2522. protected _getTypeName(): string;
  2523. _draw(context: CanvasRenderingContext2D): void;
  2524. }
  2525. }
  2526. declare module BABYLON.GUI {
  2527. /**
  2528. * Class used to create slider controls based on images
  2529. */
  2530. export class ImageBasedSlider extends BaseSlider {
  2531. name?: string | undefined;
  2532. displayThumb: boolean;
  2533. /**
  2534. * Gets or sets the image used to render the background
  2535. */
  2536. backgroundImage: Image;
  2537. /**
  2538. * Gets or sets the image used to render the value bar
  2539. */
  2540. valueBarImage: Image;
  2541. /**
  2542. * Gets or sets the image used to render the thumb
  2543. */
  2544. thumbImage: Image;
  2545. /**
  2546. * Creates a new ImageBasedSlider
  2547. * @param name defines the control name
  2548. */
  2549. constructor(name?: string | undefined);
  2550. protected _getTypeName(): string;
  2551. _draw(context: CanvasRenderingContext2D): void;
  2552. }
  2553. }
  2554. declare module BABYLON.GUI {
  2555. /**
  2556. * Forcing an export so that this code will execute
  2557. * @hidden
  2558. */
  2559. const name = "Statics";
  2560. }
  2561. declare module BABYLON.GUI {
  2562. /**
  2563. * Class used as a root to all buttons
  2564. */
  2565. export class AbstractButton3D extends Control3D {
  2566. /**
  2567. * Creates a new button
  2568. * @param name defines the control name
  2569. */
  2570. constructor(name?: string);
  2571. protected _getTypeName(): string;
  2572. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2573. }
  2574. }
  2575. declare module BABYLON.GUI {
  2576. /**
  2577. * Class used to create a button in 3D
  2578. */
  2579. export class Button3D extends AbstractButton3D {
  2580. /** @hidden */
  2581. protected _currentMaterial: BABYLON.Material;
  2582. /**
  2583. * Gets or sets the texture resolution used to render content (512 by default)
  2584. */
  2585. contentResolution: BABYLON.int;
  2586. /**
  2587. * Gets or sets the texture scale ratio used to render content (2 by default)
  2588. */
  2589. contentScaleRatio: number;
  2590. protected _disposeFacadeTexture(): void;
  2591. protected _resetContent(): void;
  2592. /**
  2593. * Creates a new button
  2594. * @param name defines the control name
  2595. */
  2596. constructor(name?: string);
  2597. /**
  2598. * Gets or sets the GUI 2D content used to display the button's facade
  2599. */
  2600. content: Control;
  2601. /**
  2602. * Apply the facade texture (created from the content property).
  2603. * This function can be overloaded by child classes
  2604. * @param facadeTexture defines the AdvancedDynamicTexture to use
  2605. */
  2606. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2607. protected _getTypeName(): string;
  2608. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2609. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  2610. /**
  2611. * Releases all associated resources
  2612. */
  2613. dispose(): void;
  2614. }
  2615. }
  2616. declare module BABYLON.GUI {
  2617. /**
  2618. * Class used to create containers for controls
  2619. */
  2620. export class Container3D extends Control3D {
  2621. /**
  2622. * Gets the list of child controls
  2623. */
  2624. protected _children: Control3D[];
  2625. /**
  2626. * Gets the list of child controls
  2627. */
  2628. readonly children: Array<Control3D>;
  2629. /**
  2630. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2631. * This is helpful to optimize layout operation when adding multiple children in a row
  2632. */
  2633. blockLayout: boolean;
  2634. /**
  2635. * Creates a new container
  2636. * @param name defines the container name
  2637. */
  2638. constructor(name?: string);
  2639. /**
  2640. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2641. * @returns the current container
  2642. */
  2643. updateLayout(): Container3D;
  2644. /**
  2645. * Gets a boolean indicating if the given control is in the children of this control
  2646. * @param control defines the control to check
  2647. * @returns true if the control is in the child list
  2648. */
  2649. containsControl(control: Control3D): boolean;
  2650. /**
  2651. * Adds a control to the children of this control
  2652. * @param control defines the control to add
  2653. * @returns the current container
  2654. */
  2655. addControl(control: Control3D): Container3D;
  2656. /**
  2657. * This function will be called everytime a new control is added
  2658. */
  2659. protected _arrangeChildren(): void;
  2660. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  2661. /**
  2662. * Removes a control from the children of this control
  2663. * @param control defines the control to remove
  2664. * @returns the current container
  2665. */
  2666. removeControl(control: Control3D): Container3D;
  2667. protected _getTypeName(): string;
  2668. /**
  2669. * Releases all associated resources
  2670. */
  2671. dispose(): void;
  2672. /** Control rotation will remain unchanged */
  2673. static readonly UNSET_ORIENTATION: number;
  2674. /** Control will rotate to make it look at sphere central axis */
  2675. static readonly FACEORIGIN_ORIENTATION: number;
  2676. /** Control will rotate to make it look back at sphere central axis */
  2677. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2678. /** Control will rotate to look at z axis (0, 0, 1) */
  2679. static readonly FACEFORWARD_ORIENTATION: number;
  2680. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2681. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2682. }
  2683. }
  2684. declare module BABYLON.GUI {
  2685. /**
  2686. * Class used as base class for controls
  2687. */
  2688. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  2689. /** Defines the control name */
  2690. name?: string | undefined;
  2691. /** @hidden */
  2692. _host: GUI3DManager;
  2693. /** Gets or sets the control position in world space */
  2694. position: BABYLON.Vector3;
  2695. /** Gets or sets the control scaling in world space */
  2696. scaling: BABYLON.Vector3;
  2697. /** Callback used to start pointer enter animation */
  2698. pointerEnterAnimation: () => void;
  2699. /** Callback used to start pointer out animation */
  2700. pointerOutAnimation: () => void;
  2701. /** Callback used to start pointer down animation */
  2702. pointerDownAnimation: () => void;
  2703. /** Callback used to start pointer up animation */
  2704. pointerUpAnimation: () => void;
  2705. /**
  2706. * An event triggered when the pointer move over the control
  2707. */
  2708. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  2709. /**
  2710. * An event triggered when the pointer move out of the control
  2711. */
  2712. onPointerOutObservable: BABYLON.Observable<Control3D>;
  2713. /**
  2714. * An event triggered when the pointer taps the control
  2715. */
  2716. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  2717. /**
  2718. * An event triggered when pointer is up
  2719. */
  2720. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  2721. /**
  2722. * An event triggered when a control is clicked on (with a mouse)
  2723. */
  2724. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  2725. /**
  2726. * An event triggered when pointer enters the control
  2727. */
  2728. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  2729. /**
  2730. * Gets or sets the parent container
  2731. */
  2732. parent: BABYLON.Nullable<Container3D>;
  2733. /**
  2734. * Gets the list of attached behaviors
  2735. * @see http://doc.babylonjs.com/features/behaviour
  2736. */
  2737. readonly behaviors: BABYLON.Behavior<Control3D>[];
  2738. /**
  2739. * Attach a behavior to the control
  2740. * @see http://doc.babylonjs.com/features/behaviour
  2741. * @param behavior defines the behavior to attach
  2742. * @returns the current control
  2743. */
  2744. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  2745. /**
  2746. * Remove an attached behavior
  2747. * @see http://doc.babylonjs.com/features/behaviour
  2748. * @param behavior defines the behavior to attach
  2749. * @returns the current control
  2750. */
  2751. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  2752. /**
  2753. * Gets an attached behavior by name
  2754. * @param name defines the name of the behavior to look for
  2755. * @see http://doc.babylonjs.com/features/behaviour
  2756. * @returns null if behavior was not found else the requested behavior
  2757. */
  2758. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  2759. /** Gets or sets a boolean indicating if the control is visible */
  2760. isVisible: boolean;
  2761. /**
  2762. * Creates a new control
  2763. * @param name defines the control name
  2764. */
  2765. constructor(
  2766. /** Defines the control name */
  2767. name?: string | undefined);
  2768. /**
  2769. * Gets a string representing the class name
  2770. */
  2771. readonly typeName: string;
  2772. /**
  2773. * Get the current class name of the control.
  2774. * @returns current class name
  2775. */
  2776. getClassName(): string;
  2777. protected _getTypeName(): string;
  2778. /**
  2779. * Gets the transform node used by this control
  2780. */
  2781. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  2782. /**
  2783. * Gets the mesh used to render this control
  2784. */
  2785. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  2786. /**
  2787. * Link the control as child of the given node
  2788. * @param node defines the node to link to. Use null to unlink the control
  2789. * @returns the current control
  2790. */
  2791. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  2792. /** @hidden **/
  2793. _prepareNode(scene: BABYLON.Scene): void;
  2794. /**
  2795. * Node creation.
  2796. * Can be overriden by children
  2797. * @param scene defines the scene where the node must be attached
  2798. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  2799. */
  2800. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  2801. /**
  2802. * Affect a material to the given mesh
  2803. * @param mesh defines the mesh which will represent the control
  2804. */
  2805. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  2806. /** @hidden */
  2807. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  2808. /** @hidden */
  2809. _onPointerEnter(target: Control3D): boolean;
  2810. /** @hidden */
  2811. _onPointerOut(target: Control3D): void;
  2812. /** @hidden */
  2813. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  2814. /** @hidden */
  2815. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2816. /** @hidden */
  2817. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  2818. /** @hidden */
  2819. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  2820. /** @hidden */
  2821. _disposeNode(): void;
  2822. /**
  2823. * Releases all associated resources
  2824. */
  2825. dispose(): void;
  2826. }
  2827. }
  2828. declare module BABYLON.GUI {
  2829. /**
  2830. * Class used to create a container panel deployed on the surface of a cylinder
  2831. */
  2832. export class CylinderPanel extends VolumeBasedPanel {
  2833. /**
  2834. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2835. */
  2836. radius: BABYLON.float;
  2837. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2838. }
  2839. }
  2840. declare module BABYLON.GUI {
  2841. /**
  2842. * Class used to create a holographic button in 3D
  2843. */
  2844. export class HolographicButton extends Button3D {
  2845. /**
  2846. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  2847. */
  2848. tooltipText: BABYLON.Nullable<string>;
  2849. /**
  2850. * Gets or sets text for the button
  2851. */
  2852. text: string;
  2853. /**
  2854. * Gets or sets the image url for the button
  2855. */
  2856. imageUrl: string;
  2857. /**
  2858. * Gets the back material used by this button
  2859. */
  2860. readonly backMaterial: FluentMaterial;
  2861. /**
  2862. * Gets the front material used by this button
  2863. */
  2864. readonly frontMaterial: FluentMaterial;
  2865. /**
  2866. * Gets the plate material used by this button
  2867. */
  2868. readonly plateMaterial: BABYLON.StandardMaterial;
  2869. /**
  2870. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2871. */
  2872. readonly shareMaterials: boolean;
  2873. /**
  2874. * Creates a new button
  2875. * @param name defines the control name
  2876. */
  2877. constructor(name?: string, shareMaterials?: boolean);
  2878. protected _getTypeName(): string;
  2879. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2880. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2881. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  2882. /**
  2883. * Releases all associated resources
  2884. */
  2885. dispose(): void;
  2886. }
  2887. }
  2888. declare module BABYLON.GUI {
  2889. /**
  2890. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2891. */
  2892. export class MeshButton3D extends Button3D {
  2893. /** @hidden */
  2894. protected _currentMesh: BABYLON.Mesh;
  2895. /**
  2896. * Creates a new 3D button based on a mesh
  2897. * @param mesh mesh to become a 3D button
  2898. * @param name defines the control name
  2899. */
  2900. constructor(mesh: BABYLON.Mesh, name?: string);
  2901. protected _getTypeName(): string;
  2902. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  2903. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  2904. }
  2905. }
  2906. declare module BABYLON.GUI {
  2907. /**
  2908. * Class used to create a container panel deployed on the surface of a plane
  2909. */
  2910. export class PlanePanel extends VolumeBasedPanel {
  2911. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2912. }
  2913. }
  2914. declare module BABYLON.GUI {
  2915. /**
  2916. * Class used to create a container panel where items get randomized planar mapping
  2917. */
  2918. export class ScatterPanel extends VolumeBasedPanel {
  2919. /**
  2920. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2921. */
  2922. iteration: BABYLON.float;
  2923. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2924. protected _finalProcessing(): void;
  2925. }
  2926. }
  2927. declare module BABYLON.GUI {
  2928. /**
  2929. * Class used to create a container panel deployed on the surface of a sphere
  2930. */
  2931. export class SpherePanel extends VolumeBasedPanel {
  2932. /**
  2933. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2934. */
  2935. radius: BABYLON.float;
  2936. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2937. }
  2938. }
  2939. declare module BABYLON.GUI {
  2940. /**
  2941. * Class used to create a stack panel in 3D on XY plane
  2942. */
  2943. export class StackPanel3D extends Container3D {
  2944. /**
  2945. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  2946. */
  2947. isVertical: boolean;
  2948. /**
  2949. * Gets or sets the distance between elements
  2950. */
  2951. margin: number;
  2952. /**
  2953. * Creates new StackPanel
  2954. * @param isVertical
  2955. */
  2956. constructor(isVertical?: boolean);
  2957. protected _arrangeChildren(): void;
  2958. }
  2959. }
  2960. declare module BABYLON.GUI {
  2961. /**
  2962. * Abstract class used to create a container panel deployed on the surface of a volume
  2963. */
  2964. export abstract class VolumeBasedPanel extends Container3D {
  2965. protected _cellWidth: number;
  2966. protected _cellHeight: number;
  2967. /**
  2968. * Gets or sets the distance between elements
  2969. */
  2970. margin: number;
  2971. /**
  2972. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  2973. * | Value | Type | Description |
  2974. * | ----- | ----------------------------------- | ----------- |
  2975. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  2976. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  2977. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  2978. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  2979. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  2980. */
  2981. orientation: number;
  2982. /**
  2983. * Gets or sets the number of columns requested (10 by default).
  2984. * The panel will automatically compute the number of rows based on number of child controls.
  2985. */
  2986. columns: BABYLON.int;
  2987. /**
  2988. * Gets or sets a the number of rows requested.
  2989. * The panel will automatically compute the number of columns based on number of child controls.
  2990. */
  2991. rows: BABYLON.int;
  2992. /**
  2993. * Creates new VolumeBasedPanel
  2994. */
  2995. constructor();
  2996. protected _arrangeChildren(): void;
  2997. /** Child classes must implement this function to provide correct control positioning */
  2998. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  2999. /** Child classes can implement this function to provide additional processing */
  3000. protected _finalProcessing(): void;
  3001. }
  3002. }
  3003. declare module BABYLON.GUI {
  3004. /** @hidden */
  3005. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  3006. INNERGLOW: boolean;
  3007. BORDER: boolean;
  3008. HOVERLIGHT: boolean;
  3009. TEXTURE: boolean;
  3010. constructor();
  3011. }
  3012. /**
  3013. * Class used to render controls with fluent desgin
  3014. */
  3015. export class FluentMaterial extends BABYLON.PushMaterial {
  3016. /**
  3017. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  3018. */
  3019. innerGlowColorIntensity: number;
  3020. /**
  3021. * Gets or sets the inner glow color (white by default)
  3022. */
  3023. innerGlowColor: BABYLON.Color3;
  3024. /**
  3025. * Gets or sets alpha value (default is 1.0)
  3026. */
  3027. alpha: number;
  3028. /**
  3029. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  3030. */
  3031. albedoColor: BABYLON.Color3;
  3032. /**
  3033. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  3034. */
  3035. renderBorders: boolean;
  3036. /**
  3037. * Gets or sets border width (default is 0.5)
  3038. */
  3039. borderWidth: number;
  3040. /**
  3041. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  3042. */
  3043. edgeSmoothingValue: number;
  3044. /**
  3045. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  3046. */
  3047. borderMinValue: number;
  3048. /**
  3049. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  3050. */
  3051. renderHoverLight: boolean;
  3052. /**
  3053. * Gets or sets the radius used to render the hover light (default is 1.0)
  3054. */
  3055. hoverRadius: number;
  3056. /**
  3057. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  3058. */
  3059. hoverColor: BABYLON.Color4;
  3060. /**
  3061. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  3062. */
  3063. hoverPosition: BABYLON.Vector3;
  3064. /** Gets or sets the texture to use for albedo color */
  3065. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  3066. /**
  3067. * Creates a new Fluent material
  3068. * @param name defines the name of the material
  3069. * @param scene defines the hosting scene
  3070. */
  3071. constructor(name: string, scene: BABYLON.Scene);
  3072. needAlphaBlending(): boolean;
  3073. needAlphaTesting(): boolean;
  3074. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  3075. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  3076. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  3077. getActiveTextures(): BABYLON.BaseTexture[];
  3078. hasTexture(texture: BABYLON.BaseTexture): boolean;
  3079. dispose(forceDisposeEffect?: boolean): void;
  3080. clone(name: string): FluentMaterial;
  3081. serialize(): any;
  3082. getClassName(): string;
  3083. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  3084. }
  3085. }
  3086. declare module BABYLON.GUI {
  3087. /**
  3088. * Class used to create slider controls
  3089. */
  3090. export class ScrollBar extends BaseSlider {
  3091. name?: string | undefined;
  3092. /** Gets or sets border color */
  3093. borderColor: string;
  3094. /** Gets or sets background color */
  3095. background: string;
  3096. /**
  3097. * Creates a new Slider
  3098. * @param name defines the control name
  3099. */
  3100. constructor(name?: string | undefined);
  3101. protected _getTypeName(): string;
  3102. protected _getThumbThickness(): number;
  3103. _draw(context: CanvasRenderingContext2D): void;
  3104. /** @hidden */
  3105. protected _updateValueFromPointer(x: number, y: number): void;
  3106. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3107. }
  3108. }