babylon.gui.d.ts 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /// <reference path="../../dist/preview release/babylon.d.ts" />
  2. declare module BABYLON.GUI {
  3. class AdvancedDynamicTexture extends DynamicTexture {
  4. private _isDirty;
  5. private _renderObserver;
  6. private _resizeObserver;
  7. private _pointerMoveObserver;
  8. private _background;
  9. private _rootContainer;
  10. _lastControlOver: Control;
  11. background: string;
  12. constructor(name: string, width: number, height: number, scene: Scene, generateMipMaps?: boolean, samplingMode?: number);
  13. markAsDirty(): void;
  14. addControl(control: Control): AdvancedDynamicTexture;
  15. removeControl(control: Control): AdvancedDynamicTexture;
  16. dispose(): void;
  17. private _onResize();
  18. private _checkUpdate();
  19. private _render();
  20. private _doPicking(x, y, type);
  21. attach(): void;
  22. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number): AdvancedDynamicTexture;
  23. static CreateFullscreenUI(name: string, foreground: boolean, scene: Scene): AdvancedDynamicTexture;
  24. }
  25. }
  26. /// <reference path="../../dist/preview release/babylon.d.ts" />
  27. declare module BABYLON.GUI {
  28. class Measure {
  29. left: number;
  30. top: number;
  31. width: number;
  32. height: number;
  33. constructor(left: number, top: number, width: number, height: number);
  34. copyFrom(other: Measure): void;
  35. isEqualsTo(other: Measure): boolean;
  36. static Empty(): Measure;
  37. }
  38. }
  39. /// <reference path="../../dist/preview release/babylon.d.ts" />
  40. declare module BABYLON.GUI {
  41. class ValueAndUnit {
  42. value: number;
  43. unit: number;
  44. negativeValueAllowed: boolean;
  45. constructor(value?: number, unit?: number, negativeValueAllowed?: boolean);
  46. readonly isPercentage: boolean;
  47. readonly isPixel: boolean;
  48. toString(): string;
  49. fromString(source: string): boolean;
  50. private static _Regex;
  51. private static _UNITMODE_PERCENTAGE;
  52. private static _UNITMODE_PIXEL;
  53. static readonly UNITMODE_PERCENTAGE: number;
  54. static readonly UNITMODE_PIXEL: number;
  55. }
  56. }
  57. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  58. declare module BABYLON.GUI {
  59. class Control {
  60. name: string;
  61. private _zIndex;
  62. _root: Container;
  63. _host: AdvancedDynamicTexture;
  64. _currentMeasure: Measure;
  65. private _fontFamily;
  66. private _fontSize;
  67. private _font;
  68. private _width;
  69. private _height;
  70. private _lastMeasuredFont;
  71. protected _fontOffset: {
  72. ascent: number;
  73. height: number;
  74. descent: number;
  75. };
  76. private _color;
  77. private _horizontalAlignment;
  78. private _verticalAlignment;
  79. private _isDirty;
  80. private _cachedParentMeasure;
  81. private _marginLeft;
  82. private _marginRight;
  83. private _marginTop;
  84. private _marginBottom;
  85. private _left;
  86. private _top;
  87. /**
  88. * An event triggered when the pointer move over the control.
  89. * @type {BABYLON.Observable}
  90. */
  91. onPointerMoveObservable: Observable<Control>;
  92. /**
  93. * An event triggered when the pointer move out of the control.
  94. * @type {BABYLON.Observable}
  95. */
  96. onPointerOutObservable: Observable<Control>;
  97. /**
  98. * An event triggered when the pointer taps the control
  99. * @type {BABYLON.Observable}
  100. */
  101. onPointerDownObservable: Observable<Control>;
  102. /**
  103. * An event triggered when pointer up
  104. * @type {BABYLON.Observable}
  105. */
  106. onPointerUpObservable: Observable<Control>;
  107. horizontalAlignment: number;
  108. verticalAlignment: number;
  109. width: string;
  110. height: string;
  111. fontFamily: string;
  112. fontSize: number;
  113. color: string;
  114. zIndex: number;
  115. readonly isDirty: boolean;
  116. marginLeft: string;
  117. marginRight: string;
  118. marginTop: string;
  119. marginBottom: string;
  120. left: string;
  121. top: string;
  122. constructor(name: string);
  123. protected _markAsDirty(): void;
  124. _link(root: Container, host: AdvancedDynamicTexture): void;
  125. protected applyStates(context: CanvasRenderingContext2D): void;
  126. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  127. protected _clip(context: CanvasRenderingContext2D): void;
  128. protected _measure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  129. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  130. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  131. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  132. protected _contains(x: number, y: number): boolean;
  133. _processPicking(x: number, y: number, type: number): boolean;
  134. protected _processObservables(type: number): boolean;
  135. private _prepareFont();
  136. private static _HORIZONTAL_ALIGNMENT_LEFT;
  137. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  138. private static _HORIZONTAL_ALIGNMENT_CENTER;
  139. private static _VERTICAL_ALIGNMENT_TOP;
  140. private static _VERTICAL_ALIGNMENT_BOTTOM;
  141. private static _VERTICAL_ALIGNMENT_CENTER;
  142. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  143. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  144. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  145. static readonly VERTICAL_ALIGNMENT_TOP: number;
  146. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  147. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  148. private static _FontHeightSizes;
  149. static _GetFontOffset(font: string): {
  150. ascent: number;
  151. height: number;
  152. descent: number;
  153. };
  154. }
  155. }
  156. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  157. declare module BABYLON.GUI {
  158. class Container extends Control {
  159. name: string;
  160. private _children;
  161. protected _measureForChildren: Measure;
  162. constructor(name: string);
  163. addControl(control: Control): Container;
  164. removeControl(control: Control): Container;
  165. _reOrderControl(control: Control): void;
  166. protected _localDraw(context: CanvasRenderingContext2D): void;
  167. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  168. _processPicking(x: number, y: number, type: number): boolean;
  169. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  170. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  171. }
  172. }
  173. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  174. declare module BABYLON.GUI {
  175. class Rectangle extends Container {
  176. name: string;
  177. private _thickness;
  178. private _background;
  179. private _cornerRadius;
  180. thickness: number;
  181. cornerRadius: number;
  182. background: string;
  183. constructor(name: string);
  184. protected _localDraw(context: CanvasRenderingContext2D): void;
  185. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  186. private _drawRoundedRect(context, offset?);
  187. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  188. }
  189. }
  190. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  191. declare module BABYLON.GUI {
  192. class TextBlock extends Control {
  193. name: string;
  194. private _text;
  195. private _textY;
  196. private _textWrapping;
  197. private _textHorizontalAlignment;
  198. private _textVerticalAlignment;
  199. private _lines;
  200. private _totalHeight;
  201. textWrapping: boolean;
  202. text: string;
  203. textHorizontalAlignment: number;
  204. textVerticalAlignment: number;
  205. constructor(name: string, text: string);
  206. private _drawText(text, textWidth, y, context);
  207. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  208. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  209. protected _renderLines(context: CanvasRenderingContext2D): void;
  210. }
  211. }
  212. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  213. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  214. declare module BABYLON.GUI {
  215. class Image extends Control {
  216. name: string;
  217. private _domImage;
  218. private _imageWidth;
  219. private _imageHeight;
  220. private _loaded;
  221. private _stretch;
  222. stretch: number;
  223. constructor(name: string, url: string);
  224. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  225. private static _STRETCH_NONE;
  226. private static _STRETCH_FILL;
  227. private static _STRETCH_UNIFORM;
  228. static readonly STRETCH_NONE: number;
  229. static readonly STRETCH_FILL: number;
  230. static readonly STRETCH_UNIFORM: number;
  231. }
  232. }
  233. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  234. declare module BABYLON.GUI {
  235. class Button extends Rectangle {
  236. name: string;
  237. constructor(name: string);
  238. _processPicking(x: number, y: number, type: number): boolean;
  239. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  240. }
  241. }