babylon.gui.d.ts 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. declare module BABYLON.GUI {
  2. interface IFocusableControl {
  3. onFocus(): void;
  4. onBlur(): void;
  5. processKeyboard(evt: KeyboardEvent): void;
  6. }
  7. class AdvancedDynamicTexture extends DynamicTexture {
  8. private _isDirty;
  9. private _renderObserver;
  10. private _resizeObserver;
  11. private _preKeyboardObserver;
  12. private _pointerMoveObserver;
  13. private _pointerObserver;
  14. private _canvasPointerOutObserver;
  15. private _background;
  16. _rootContainer: Container;
  17. _lastPickedControl: Control;
  18. _lastControlOver: Control;
  19. _lastControlDown: Control;
  20. _capturingControl: Control;
  21. _shouldBlockPointer: boolean;
  22. _layerToDispose: Layer;
  23. _linkedControls: Control[];
  24. private _isFullscreen;
  25. private _fullscreenViewport;
  26. private _idealWidth;
  27. private _idealHeight;
  28. private _renderAtIdealSize;
  29. private _focusedControl;
  30. private _blockNextFocusCheck;
  31. background: string;
  32. idealWidth: number;
  33. idealHeight: number;
  34. renderAtIdealSize: boolean;
  35. readonly layer: Layer;
  36. readonly rootContainer: Container;
  37. focusedControl: IFocusableControl;
  38. constructor(name: string, width: number, height: number, scene: Scene, generateMipMaps?: boolean, samplingMode?: number);
  39. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  40. markAsDirty(): void;
  41. addControl(control: Control): AdvancedDynamicTexture;
  42. removeControl(control: Control): AdvancedDynamicTexture;
  43. dispose(): void;
  44. private _onResize();
  45. _getGlobalViewport(scene: Scene): Viewport;
  46. private _checkUpdate(camera);
  47. private _render();
  48. private _doPicking(x, y, type, buttonIndex);
  49. attach(): void;
  50. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  51. moveFocusToControl(control: IFocusableControl): void;
  52. private _manageFocus();
  53. private _attachToOnPointerOut(scene);
  54. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
  55. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Scene): AdvancedDynamicTexture;
  56. }
  57. }
  58. declare module BABYLON.GUI {
  59. class Measure {
  60. left: number;
  61. top: number;
  62. width: number;
  63. height: number;
  64. constructor(left: number, top: number, width: number, height: number);
  65. copyFrom(other: Measure): void;
  66. isEqualsTo(other: Measure): boolean;
  67. static Empty(): Measure;
  68. }
  69. }
  70. declare module BABYLON.GUI {
  71. class Vector2WithInfo extends Vector2 {
  72. buttonIndex: number;
  73. constructor(source: Vector2, buttonIndex?: number);
  74. }
  75. class Matrix2D {
  76. m: Float32Array;
  77. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  78. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  79. determinant(): number;
  80. invertToRef(result: Matrix2D): Matrix2D;
  81. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  82. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  83. static Identity(): Matrix2D;
  84. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  85. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  86. static RotationToRef(angle: number, result: Matrix2D): void;
  87. private static _TempPreTranslationMatrix;
  88. private static _TempPostTranslationMatrix;
  89. private static _TempRotationMatrix;
  90. private static _TempScalingMatrix;
  91. private static _TempCompose0;
  92. private static _TempCompose1;
  93. private static _TempCompose2;
  94. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Matrix2D, result: Matrix2D): void;
  95. }
  96. }
  97. declare module BABYLON.GUI {
  98. class ValueAndUnit {
  99. unit: number;
  100. negativeValueAllowed: boolean;
  101. private _value;
  102. ignoreAdaptiveScaling: boolean;
  103. constructor(value: any, unit?: number, negativeValueAllowed?: boolean);
  104. readonly isPercentage: boolean;
  105. readonly isPixel: boolean;
  106. readonly internalValue: number;
  107. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  108. getValue(host: AdvancedDynamicTexture): number;
  109. toString(host: AdvancedDynamicTexture): string;
  110. fromString(source: string | number): boolean;
  111. private static _Regex;
  112. private static _UNITMODE_PERCENTAGE;
  113. private static _UNITMODE_PIXEL;
  114. static readonly UNITMODE_PERCENTAGE: number;
  115. static readonly UNITMODE_PIXEL: number;
  116. }
  117. }
  118. declare module BABYLON.GUI {
  119. class Control {
  120. name: string;
  121. private _alpha;
  122. private _alphaSet;
  123. private _zIndex;
  124. _root: Container;
  125. _host: AdvancedDynamicTexture;
  126. _currentMeasure: Measure;
  127. private _fontFamily;
  128. private _fontStyle;
  129. private _fontSize;
  130. private _font;
  131. _width: ValueAndUnit;
  132. _height: ValueAndUnit;
  133. private _lastMeasuredFont;
  134. protected _fontOffset: {
  135. ascent: number;
  136. height: number;
  137. descent: number;
  138. };
  139. private _color;
  140. protected _horizontalAlignment: number;
  141. protected _verticalAlignment: number;
  142. private _isDirty;
  143. protected _cachedParentMeasure: Measure;
  144. private _paddingLeft;
  145. private _paddingRight;
  146. private _paddingTop;
  147. private _paddingBottom;
  148. _left: ValueAndUnit;
  149. _top: ValueAndUnit;
  150. private _scaleX;
  151. private _scaleY;
  152. private _rotation;
  153. private _transformCenterX;
  154. private _transformCenterY;
  155. private _transformMatrix;
  156. private _invertTransformMatrix;
  157. private _transformedPosition;
  158. private _isMatrixDirty;
  159. private _cachedOffsetX;
  160. private _cachedOffsetY;
  161. private _isVisible;
  162. _linkedMesh: AbstractMesh;
  163. private _fontSet;
  164. private _dummyVector2;
  165. private _downCount;
  166. private _enterCount;
  167. private _doNotRender;
  168. isHitTestVisible: boolean;
  169. isPointerBlocker: boolean;
  170. isFocusInvisible: boolean;
  171. protected _linkOffsetX: ValueAndUnit;
  172. protected _linkOffsetY: ValueAndUnit;
  173. readonly typeName: string;
  174. /**
  175. * An event triggered when the pointer move over the control.
  176. * @type {BABYLON.Observable}
  177. */
  178. onPointerMoveObservable: Observable<Vector2>;
  179. /**
  180. * An event triggered when the pointer move out of the control.
  181. * @type {BABYLON.Observable}
  182. */
  183. onPointerOutObservable: Observable<Control>;
  184. /**
  185. * An event triggered when the pointer taps the control
  186. * @type {BABYLON.Observable}
  187. */
  188. onPointerDownObservable: Observable<Vector2WithInfo>;
  189. /**
  190. * An event triggered when pointer up
  191. * @type {BABYLON.Observable}
  192. */
  193. onPointerUpObservable: Observable<Vector2WithInfo>;
  194. /**
  195. * An event triggered when pointer enters the control
  196. * @type {BABYLON.Observable}
  197. */
  198. onPointerEnterObservable: Observable<Control>;
  199. /**
  200. * An event triggered when the control is marked as dirty
  201. * @type {BABYLON.Observable}
  202. */
  203. onDirtyObservable: Observable<Control>;
  204. /**
  205. * An event triggered after the control is drawn
  206. * @type {BABYLON.Observable}
  207. */
  208. onAfterDrawObservable: Observable<Control>;
  209. alpha: number;
  210. scaleX: number;
  211. scaleY: number;
  212. rotation: number;
  213. transformCenterY: number;
  214. transformCenterX: number;
  215. horizontalAlignment: number;
  216. verticalAlignment: number;
  217. width: string | number;
  218. readonly widthInPixels: number;
  219. height: string | number;
  220. readonly heightInPixels: number;
  221. fontFamily: string;
  222. fontStyle: string;
  223. readonly fontSizeInPixels: number;
  224. fontSize: string | number;
  225. color: string;
  226. zIndex: number;
  227. notRenderable: boolean;
  228. isVisible: boolean;
  229. readonly isDirty: boolean;
  230. paddingLeft: string | number;
  231. readonly paddingLeftInPixels: number;
  232. paddingRight: string | number;
  233. readonly paddingRightInPixels: number;
  234. paddingTop: string | number;
  235. readonly paddingTopInPixels: number;
  236. paddingBottom: string | number;
  237. readonly paddingBottomInPixels: number;
  238. left: string | number;
  239. readonly leftInPixels: number;
  240. top: string | number;
  241. readonly topInPixels: number;
  242. linkOffsetX: string | number;
  243. readonly linkOffsetXInPixels: number;
  244. linkOffsetY: string | number;
  245. readonly linkOffsetYInPixels: number;
  246. readonly centerX: number;
  247. readonly centerY: number;
  248. constructor(name?: string);
  249. protected _getTypeName(): string;
  250. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  251. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  252. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  253. moveToVector3(position: Vector3, scene: Scene): void;
  254. linkWithMesh(mesh: AbstractMesh): void;
  255. _moveToProjectedPosition(projectedPosition: Vector3): void;
  256. _markMatrixAsDirty(): void;
  257. _markAsDirty(): void;
  258. _markAllAsDirty(): void;
  259. _link(root: Container, host: AdvancedDynamicTexture): void;
  260. protected _transform(context: CanvasRenderingContext2D): void;
  261. protected _applyStates(context: CanvasRenderingContext2D): void;
  262. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  263. protected _clip(context: CanvasRenderingContext2D): void;
  264. _measure(): void;
  265. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  266. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  267. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  268. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  269. contains(x: number, y: number): boolean;
  270. _processPicking(x: number, y: number, type: number, buttonIndex: number): boolean;
  271. protected _onPointerMove(coordinates: Vector2): void;
  272. protected _onPointerEnter(): boolean;
  273. _onPointerOut(): void;
  274. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  275. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  276. forcePointerUp(): void;
  277. _processObservables(type: number, x: number, y: number, buttonIndex: number): boolean;
  278. private _prepareFont();
  279. dispose(): void;
  280. private static _HORIZONTAL_ALIGNMENT_LEFT;
  281. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  282. private static _HORIZONTAL_ALIGNMENT_CENTER;
  283. private static _VERTICAL_ALIGNMENT_TOP;
  284. private static _VERTICAL_ALIGNMENT_BOTTOM;
  285. private static _VERTICAL_ALIGNMENT_CENTER;
  286. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  287. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  288. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  289. static readonly VERTICAL_ALIGNMENT_TOP: number;
  290. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  291. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  292. private static _FontHeightSizes;
  293. static _GetFontOffset(font: string): {
  294. ascent: number;
  295. height: number;
  296. descent: number;
  297. };
  298. static AddHeader(control: Control, text: string, size: string | number, options: {
  299. isHorizontal: boolean;
  300. controlFirst: boolean;
  301. }): StackPanel;
  302. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  303. }
  304. }
  305. declare module BABYLON.GUI {
  306. class Container extends Control {
  307. name: string;
  308. protected _children: Control[];
  309. protected _measureForChildren: Measure;
  310. protected _background: string;
  311. background: string;
  312. readonly children: Control[];
  313. constructor(name?: string);
  314. protected _getTypeName(): string;
  315. getChildByName(name: string): Control;
  316. getChildByType(name: string, type: string): Control;
  317. containsControl(control: Control): boolean;
  318. addControl(control: Control): Container;
  319. removeControl(control: Control): Container;
  320. _reOrderControl(control: Control): void;
  321. _markMatrixAsDirty(): void;
  322. _markAllAsDirty(): void;
  323. protected _localDraw(context: CanvasRenderingContext2D): void;
  324. _link(root: Container, host: AdvancedDynamicTexture): void;
  325. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  326. _processPicking(x: number, y: number, type: number, buttonIndex: number): boolean;
  327. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  328. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  329. dispose(): void;
  330. }
  331. }
  332. declare module BABYLON.GUI {
  333. class StackPanel extends Container {
  334. name: string;
  335. private _isVertical;
  336. private _manualWidth;
  337. private _manualHeight;
  338. private _doNotTrackManualChanges;
  339. private _tempMeasureStore;
  340. isVertical: boolean;
  341. width: string | number;
  342. height: string | number;
  343. constructor(name?: string);
  344. protected _getTypeName(): string;
  345. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  346. }
  347. }
  348. declare module BABYLON.GUI {
  349. class Rectangle extends Container {
  350. name: string;
  351. private _thickness;
  352. private _cornerRadius;
  353. thickness: number;
  354. cornerRadius: number;
  355. constructor(name?: string);
  356. protected _getTypeName(): string;
  357. protected _localDraw(context: CanvasRenderingContext2D): void;
  358. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  359. private _drawRoundedRect(context, offset?);
  360. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  361. }
  362. }
  363. declare module BABYLON.GUI {
  364. class Ellipse extends Container {
  365. name: string;
  366. private _thickness;
  367. thickness: number;
  368. constructor(name?: string);
  369. protected _getTypeName(): string;
  370. protected _localDraw(context: CanvasRenderingContext2D): void;
  371. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  372. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  373. }
  374. }
  375. declare module BABYLON.GUI {
  376. class Line extends Control {
  377. name: string;
  378. private _lineWidth;
  379. private _background;
  380. private _x1;
  381. private _y1;
  382. private _x2;
  383. private _y2;
  384. private _dash;
  385. private _connectedControl;
  386. private _connectedControlDirtyObserver;
  387. dash: Array<number>;
  388. connectedControl: Control;
  389. x1: string | number;
  390. y1: string | number;
  391. x2: string | number;
  392. y2: string | number;
  393. lineWidth: number;
  394. horizontalAlignment: number;
  395. verticalAlignment: number;
  396. private readonly _effectiveX2;
  397. private readonly _effectiveY2;
  398. constructor(name?: string);
  399. protected _getTypeName(): string;
  400. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  401. _measure(): void;
  402. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  403. _moveToProjectedPosition(projectedPosition: Vector3): void;
  404. }
  405. }
  406. declare module BABYLON.GUI {
  407. class Slider extends Control {
  408. name: string;
  409. private _thumbWidth;
  410. private _minimum;
  411. private _maximum;
  412. private _value;
  413. private _background;
  414. private _borderColor;
  415. private _barOffset;
  416. onValueChangedObservable: Observable<number>;
  417. borderColor: string;
  418. background: string;
  419. barOffset: string | number;
  420. readonly barOffsetInPixels: number;
  421. thumbWidth: string | number;
  422. readonly thumbWidthInPixels: number;
  423. minimum: number;
  424. maximum: number;
  425. value: number;
  426. constructor(name?: string);
  427. protected _getTypeName(): string;
  428. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  429. private _pointerIsDown;
  430. private _updateValueFromPointer(x);
  431. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  432. protected _onPointerMove(coordinates: Vector2): void;
  433. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  434. }
  435. }
  436. declare module BABYLON.GUI {
  437. class Checkbox extends Control {
  438. name: string;
  439. private _isChecked;
  440. private _background;
  441. private _checkSizeRatio;
  442. private _thickness;
  443. thickness: number;
  444. onIsCheckedChangedObservable: Observable<boolean>;
  445. checkSizeRatio: number;
  446. background: string;
  447. isChecked: boolean;
  448. constructor(name?: string);
  449. protected _getTypeName(): string;
  450. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  451. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  452. }
  453. }
  454. declare module BABYLON.GUI {
  455. class RadioButton extends Control {
  456. name: string;
  457. private _isChecked;
  458. private _background;
  459. private _checkSizeRatio;
  460. private _thickness;
  461. thickness: number;
  462. group: string;
  463. onIsCheckedChangedObservable: Observable<boolean>;
  464. checkSizeRatio: number;
  465. background: string;
  466. isChecked: boolean;
  467. constructor(name?: string);
  468. protected _getTypeName(): string;
  469. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  470. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  471. }
  472. }
  473. declare module BABYLON.GUI {
  474. class TextBlock extends Control {
  475. name: string;
  476. private _text;
  477. private _textY;
  478. private _textWrapping;
  479. private _textHorizontalAlignment;
  480. private _textVerticalAlignment;
  481. private _lines;
  482. private _totalHeight;
  483. private _resizeToFit;
  484. /**
  485. * An event triggered after the text is changed
  486. * @type {BABYLON.Observable}
  487. */
  488. onTextChangedObservable: Observable<TextBlock>;
  489. resizeToFit: boolean;
  490. textWrapping: boolean;
  491. text: string;
  492. textHorizontalAlignment: number;
  493. textVerticalAlignment: number;
  494. constructor(name?: string, text?: string);
  495. protected _getTypeName(): string;
  496. private _drawText(text, textWidth, y, context);
  497. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  498. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  499. protected _parseLine(line: string, context: CanvasRenderingContext2D): object;
  500. protected _parseLineWithTextWrapping(line: string, context: CanvasRenderingContext2D): object;
  501. protected _renderLines(context: CanvasRenderingContext2D): void;
  502. dispose(): void;
  503. }
  504. }
  505. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  506. declare module BABYLON.GUI {
  507. class Image extends Control {
  508. name: string;
  509. private _domImage;
  510. private _imageWidth;
  511. private _imageHeight;
  512. private _loaded;
  513. private _stretch;
  514. private _source;
  515. private _autoScale;
  516. private _sourceLeft;
  517. private _sourceTop;
  518. private _sourceWidth;
  519. private _sourceHeight;
  520. sourceLeft: number;
  521. sourceTop: number;
  522. sourceWidth: number;
  523. sourceHeight: number;
  524. autoScale: boolean;
  525. stretch: number;
  526. domImage: HTMLImageElement;
  527. private _onImageLoaded();
  528. source: string;
  529. constructor(name?: string, url?: string);
  530. protected _getTypeName(): string;
  531. synchronizeSizeWithContent(): void;
  532. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  533. private static _STRETCH_NONE;
  534. private static _STRETCH_FILL;
  535. private static _STRETCH_UNIFORM;
  536. private static _STRETCH_EXTEND;
  537. static readonly STRETCH_NONE: number;
  538. static readonly STRETCH_FILL: number;
  539. static readonly STRETCH_UNIFORM: number;
  540. static readonly STRETCH_EXTEND: number;
  541. }
  542. }
  543. declare module BABYLON.GUI {
  544. class Button extends Rectangle {
  545. name: string;
  546. pointerEnterAnimation: () => void;
  547. pointerOutAnimation: () => void;
  548. pointerDownAnimation: () => void;
  549. pointerUpAnimation: () => void;
  550. constructor(name?: string);
  551. protected _getTypeName(): string;
  552. _processPicking(x: number, y: number, type: number, buttonIndex: number): boolean;
  553. protected _onPointerEnter(): boolean;
  554. _onPointerOut(): void;
  555. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  556. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  557. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  558. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  559. static CreateSimpleButton(name: string, text: string): Button;
  560. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  561. }
  562. }
  563. declare module BABYLON.GUI {
  564. class ColorPicker extends Control {
  565. name: string;
  566. private _colorWheelCanvas;
  567. private _value;
  568. private _tmpColor;
  569. private _pointerStartedOnSquare;
  570. private _pointerStartedOnWheel;
  571. private _squareLeft;
  572. private _squareTop;
  573. private _squareSize;
  574. private _h;
  575. private _s;
  576. private _v;
  577. onValueChangedObservable: Observable<Color3>;
  578. value: Color3;
  579. width: string | number;
  580. height: string | number;
  581. size: string | number;
  582. constructor(name?: string);
  583. protected _getTypeName(): string;
  584. private _updateSquareProps();
  585. private _drawGradientSquare(hueValue, left, top, width, height, context);
  586. private _drawCircle(centerX, centerY, radius, context);
  587. private _createColorWheelCanvas(radius, thickness);
  588. private _RGBtoHSV(color, result);
  589. private _HSVtoRGB(hue, saturation, value, result);
  590. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  591. private _pointerIsDown;
  592. private _updateValueFromPointer(x, y);
  593. private _isPointOnSquare(coordinates);
  594. private _isPointOnWheel(coordinates);
  595. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  596. protected _onPointerMove(coordinates: Vector2): void;
  597. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  598. }
  599. }
  600. declare module BABYLON.GUI {
  601. class InputText extends Control implements IFocusableControl {
  602. name: string;
  603. private _text;
  604. private _placeholderText;
  605. private _background;
  606. private _focusedBackground;
  607. private _placeholderColor;
  608. private _thickness;
  609. private _margin;
  610. private _autoStretchWidth;
  611. private _maxWidth;
  612. private _isFocused;
  613. private _blinkTimeout;
  614. private _blinkIsEven;
  615. private _cursorOffset;
  616. private _scrollLeft;
  617. private _textWidth;
  618. private _clickedCoordinate;
  619. promptMessage: string;
  620. onTextChangedObservable: Observable<InputText>;
  621. onFocusObservable: Observable<InputText>;
  622. onBlurObservable: Observable<InputText>;
  623. maxWidth: string | number;
  624. readonly maxWidthInPixels: number;
  625. margin: string;
  626. readonly marginInPixels: number;
  627. autoStretchWidth: boolean;
  628. thickness: number;
  629. focusedBackground: string;
  630. background: string;
  631. placeholderColor: string;
  632. placeholderText: string;
  633. text: string;
  634. constructor(name?: string, text?: string);
  635. onBlur(): void;
  636. onFocus(): void;
  637. protected _getTypeName(): string;
  638. processKey(keyCode: number, key?: string): void;
  639. processKeyboard(evt: KeyboardEvent): void;
  640. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  641. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  642. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  643. dispose(): void;
  644. }
  645. }
  646. declare module BABYLON.GUI {
  647. class KeyPropertySet {
  648. width?: string;
  649. height?: string;
  650. paddingLeft?: string;
  651. paddingRight?: string;
  652. paddingTop?: string;
  653. paddingBottom?: string;
  654. color?: string;
  655. background?: string;
  656. }
  657. class VirtualKeyboard extends StackPanel {
  658. onKeyPressObservable: Observable<string>;
  659. defaultButtonWidth: string;
  660. defaultButtonHeight: string;
  661. defaultButtonPaddingLeft: string;
  662. defaultButtonPaddingRight: string;
  663. defaultButtonPaddingTop: string;
  664. defaultButtonPaddingBottom: string;
  665. defaultButtonColor: string;
  666. defaultButtonBackground: string;
  667. protected _getTypeName(): string;
  668. private _createKey(key, propertySet?);
  669. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  670. private _connectedInputText;
  671. private _onFocusObserver;
  672. private _onBlurObserver;
  673. private _onKeyPressObserver;
  674. readonly connectedInputText: InputText;
  675. connect(input: InputText): void;
  676. disconnect(): void;
  677. static CreateDefaultLayout(): VirtualKeyboard;
  678. }
  679. }