babylon.gui.d.ts 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  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: number, 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. protected _fontOffset: {
  134. ascent: number;
  135. height: number;
  136. descent: number;
  137. };
  138. private _color;
  139. protected _horizontalAlignment: number;
  140. protected _verticalAlignment: number;
  141. private _isDirty;
  142. protected _cachedParentMeasure: Measure;
  143. private _paddingLeft;
  144. private _paddingRight;
  145. private _paddingTop;
  146. private _paddingBottom;
  147. _left: ValueAndUnit;
  148. _top: ValueAndUnit;
  149. private _scaleX;
  150. private _scaleY;
  151. private _rotation;
  152. private _transformCenterX;
  153. private _transformCenterY;
  154. private _transformMatrix;
  155. private _invertTransformMatrix;
  156. private _transformedPosition;
  157. private _isMatrixDirty;
  158. private _cachedOffsetX;
  159. private _cachedOffsetY;
  160. private _isVisible;
  161. _linkedMesh: AbstractMesh;
  162. private _fontSet;
  163. private _dummyVector2;
  164. private _downCount;
  165. private _enterCount;
  166. private _doNotRender;
  167. isHitTestVisible: boolean;
  168. isPointerBlocker: boolean;
  169. isFocusInvisible: boolean;
  170. protected _linkOffsetX: ValueAndUnit;
  171. protected _linkOffsetY: ValueAndUnit;
  172. readonly typeName: string;
  173. /**
  174. * An event triggered when the pointer move over the control.
  175. * @type {BABYLON.Observable}
  176. */
  177. onPointerMoveObservable: Observable<Vector2>;
  178. /**
  179. * An event triggered when the pointer move out of the control.
  180. * @type {BABYLON.Observable}
  181. */
  182. onPointerOutObservable: Observable<Control>;
  183. /**
  184. * An event triggered when the pointer taps the control
  185. * @type {BABYLON.Observable}
  186. */
  187. onPointerDownObservable: Observable<Vector2WithInfo>;
  188. /**
  189. * An event triggered when pointer up
  190. * @type {BABYLON.Observable}
  191. */
  192. onPointerUpObservable: Observable<Vector2WithInfo>;
  193. /**
  194. * An event triggered when pointer enters the control
  195. * @type {BABYLON.Observable}
  196. */
  197. onPointerEnterObservable: Observable<Control>;
  198. /**
  199. * An event triggered when the control is marked as dirty
  200. * @type {BABYLON.Observable}
  201. */
  202. onDirtyObservable: Observable<Control>;
  203. /**
  204. * An event triggered after the control is drawn
  205. * @type {BABYLON.Observable}
  206. */
  207. onAfterDrawObservable: Observable<Control>;
  208. alpha: number;
  209. scaleX: number;
  210. scaleY: number;
  211. rotation: number;
  212. transformCenterY: number;
  213. transformCenterX: number;
  214. horizontalAlignment: number;
  215. verticalAlignment: number;
  216. width: string | number;
  217. readonly widthInPixels: number;
  218. height: string | number;
  219. readonly heightInPixels: number;
  220. fontFamily: string;
  221. fontStyle: string;
  222. readonly fontSizeInPixels: number;
  223. fontSize: string | number;
  224. color: string;
  225. zIndex: number;
  226. notRenderable: boolean;
  227. isVisible: boolean;
  228. readonly isDirty: boolean;
  229. paddingLeft: string | number;
  230. readonly paddingLeftInPixels: number;
  231. paddingRight: string | number;
  232. readonly paddingRightInPixels: number;
  233. paddingTop: string | number;
  234. readonly paddingTopInPixels: number;
  235. paddingBottom: string | number;
  236. readonly paddingBottomInPixels: number;
  237. left: string | number;
  238. readonly leftInPixels: number;
  239. top: string | number;
  240. readonly topInPixels: number;
  241. linkOffsetX: string | number;
  242. readonly linkOffsetXInPixels: number;
  243. linkOffsetY: string | number;
  244. readonly linkOffsetYInPixels: number;
  245. readonly centerX: number;
  246. readonly centerY: number;
  247. constructor(name?: string);
  248. protected _getTypeName(): string;
  249. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  250. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  251. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  252. moveToVector3(position: Vector3, scene: Scene): void;
  253. linkWithMesh(mesh: AbstractMesh): void;
  254. _moveToProjectedPosition(projectedPosition: Vector3): void;
  255. _markMatrixAsDirty(): void;
  256. _markAsDirty(): void;
  257. _markAllAsDirty(): void;
  258. _link(root: Container, host: AdvancedDynamicTexture): void;
  259. protected _transform(context: CanvasRenderingContext2D): void;
  260. protected _applyStates(context: CanvasRenderingContext2D): void;
  261. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  262. protected _clip(context: CanvasRenderingContext2D): void;
  263. _measure(): void;
  264. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  265. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  266. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  267. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  268. contains(x: number, y: number): boolean;
  269. _processPicking(x: number, y: number, type: number, buttonIndex: number): boolean;
  270. protected _onPointerMove(coordinates: Vector2): void;
  271. protected _onPointerEnter(): boolean;
  272. _onPointerOut(): void;
  273. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  274. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  275. forcePointerUp(): void;
  276. _processObservables(type: number, x: number, y: number, buttonIndex: number): boolean;
  277. private _prepareFont();
  278. dispose(): void;
  279. private static _HORIZONTAL_ALIGNMENT_LEFT;
  280. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  281. private static _HORIZONTAL_ALIGNMENT_CENTER;
  282. private static _VERTICAL_ALIGNMENT_TOP;
  283. private static _VERTICAL_ALIGNMENT_BOTTOM;
  284. private static _VERTICAL_ALIGNMENT_CENTER;
  285. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  286. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  287. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  288. static readonly VERTICAL_ALIGNMENT_TOP: number;
  289. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  290. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  291. private static _FontHeightSizes;
  292. static _GetFontOffset(font: string): {
  293. ascent: number;
  294. height: number;
  295. descent: number;
  296. };
  297. static AddHeader(control: Control, text: string, size: string | number, options: {
  298. isHorizontal: boolean;
  299. controlFirst: boolean;
  300. }): StackPanel;
  301. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  302. }
  303. }
  304. declare module BABYLON.GUI {
  305. class Container extends Control {
  306. name: string;
  307. protected _children: Control[];
  308. protected _measureForChildren: Measure;
  309. protected _background: string;
  310. background: string;
  311. readonly children: Control[];
  312. constructor(name?: string);
  313. protected _getTypeName(): string;
  314. getChildByName(name: string): Control;
  315. getChildByType(name: string, type: string): Control;
  316. containsControl(control: Control): boolean;
  317. addControl(control: Control): Container;
  318. removeControl(control: Control): Container;
  319. _reOrderControl(control: Control): void;
  320. _markMatrixAsDirty(): void;
  321. _markAllAsDirty(): void;
  322. protected _localDraw(context: CanvasRenderingContext2D): void;
  323. _link(root: Container, host: AdvancedDynamicTexture): void;
  324. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  325. _processPicking(x: number, y: number, type: number, buttonIndex: number): boolean;
  326. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  327. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  328. dispose(): void;
  329. }
  330. }
  331. declare module BABYLON.GUI {
  332. class StackPanel extends Container {
  333. name: string;
  334. private _isVertical;
  335. private _manualWidth;
  336. private _manualHeight;
  337. private _doNotTrackManualChanges;
  338. private _tempMeasureStore;
  339. isVertical: boolean;
  340. width: string | number;
  341. height: string | number;
  342. constructor(name?: string);
  343. protected _getTypeName(): string;
  344. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  345. }
  346. }
  347. declare module BABYLON.GUI {
  348. class Rectangle extends Container {
  349. name: string;
  350. private _thickness;
  351. private _cornerRadius;
  352. thickness: number;
  353. cornerRadius: number;
  354. constructor(name?: string);
  355. protected _getTypeName(): string;
  356. protected _localDraw(context: CanvasRenderingContext2D): void;
  357. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  358. private _drawRoundedRect(context, offset?);
  359. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  360. }
  361. }
  362. declare module BABYLON.GUI {
  363. class Ellipse extends Container {
  364. name: string;
  365. private _thickness;
  366. thickness: number;
  367. constructor(name?: string);
  368. protected _getTypeName(): string;
  369. protected _localDraw(context: CanvasRenderingContext2D): void;
  370. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  371. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  372. }
  373. }
  374. declare module BABYLON.GUI {
  375. class Line extends Control {
  376. name: string;
  377. private _lineWidth;
  378. private _x1;
  379. private _y1;
  380. private _x2;
  381. private _y2;
  382. private _dash;
  383. private _connectedControl;
  384. private _connectedControlDirtyObserver;
  385. dash: Array<number>;
  386. connectedControl: Control;
  387. x1: string | number;
  388. y1: string | number;
  389. x2: string | number;
  390. y2: string | number;
  391. lineWidth: number;
  392. horizontalAlignment: number;
  393. verticalAlignment: number;
  394. private readonly _effectiveX2;
  395. private readonly _effectiveY2;
  396. constructor(name?: string);
  397. protected _getTypeName(): string;
  398. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  399. _measure(): void;
  400. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  401. _moveToProjectedPosition(projectedPosition: Vector3): void;
  402. }
  403. }
  404. declare module BABYLON.GUI {
  405. class Slider extends Control {
  406. name: string;
  407. private _thumbWidth;
  408. private _minimum;
  409. private _maximum;
  410. private _value;
  411. private _background;
  412. private _borderColor;
  413. private _barOffset;
  414. onValueChangedObservable: Observable<number>;
  415. borderColor: string;
  416. background: string;
  417. barOffset: string | number;
  418. readonly barOffsetInPixels: number;
  419. thumbWidth: string | number;
  420. readonly thumbWidthInPixels: number;
  421. minimum: number;
  422. maximum: number;
  423. value: number;
  424. constructor(name?: string);
  425. protected _getTypeName(): string;
  426. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  427. private _pointerIsDown;
  428. private _updateValueFromPointer(x);
  429. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  430. protected _onPointerMove(coordinates: Vector2): void;
  431. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  432. }
  433. }
  434. declare module BABYLON.GUI {
  435. class Checkbox extends Control {
  436. name: string;
  437. private _isChecked;
  438. private _background;
  439. private _checkSizeRatio;
  440. private _thickness;
  441. thickness: number;
  442. onIsCheckedChangedObservable: Observable<boolean>;
  443. checkSizeRatio: number;
  444. background: string;
  445. isChecked: boolean;
  446. constructor(name?: string);
  447. protected _getTypeName(): string;
  448. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  449. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  450. }
  451. }
  452. declare module BABYLON.GUI {
  453. class RadioButton extends Control {
  454. name: string;
  455. private _isChecked;
  456. private _background;
  457. private _checkSizeRatio;
  458. private _thickness;
  459. thickness: number;
  460. group: string;
  461. onIsCheckedChangedObservable: Observable<boolean>;
  462. checkSizeRatio: number;
  463. background: string;
  464. isChecked: boolean;
  465. constructor(name?: string);
  466. protected _getTypeName(): string;
  467. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  468. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  469. }
  470. }
  471. declare module BABYLON.GUI {
  472. class TextBlock extends Control {
  473. name: string;
  474. private _text;
  475. private _textWrapping;
  476. private _textHorizontalAlignment;
  477. private _textVerticalAlignment;
  478. private _lines;
  479. private _resizeToFit;
  480. /**
  481. * An event triggered after the text is changed
  482. * @type {BABYLON.Observable}
  483. */
  484. onTextChangedObservable: Observable<TextBlock>;
  485. resizeToFit: boolean;
  486. textWrapping: boolean;
  487. text: string;
  488. textHorizontalAlignment: number;
  489. textVerticalAlignment: number;
  490. constructor(name?: string, text?: string);
  491. protected _getTypeName(): string;
  492. private _drawText(text, textWidth, y, context);
  493. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  494. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  495. protected _parseLine(line: string, context: CanvasRenderingContext2D): object;
  496. protected _parseLineWithTextWrapping(line: string, context: CanvasRenderingContext2D): object;
  497. protected _renderLines(context: CanvasRenderingContext2D): void;
  498. dispose(): void;
  499. }
  500. }
  501. declare var DOMImage: new (width?: number, height?: number) => HTMLImageElement;
  502. declare module BABYLON.GUI {
  503. class Image extends Control {
  504. name: string;
  505. private _domImage;
  506. private _imageWidth;
  507. private _imageHeight;
  508. private _loaded;
  509. private _stretch;
  510. private _source;
  511. private _autoScale;
  512. private _sourceLeft;
  513. private _sourceTop;
  514. private _sourceWidth;
  515. private _sourceHeight;
  516. sourceLeft: number;
  517. sourceTop: number;
  518. sourceWidth: number;
  519. sourceHeight: number;
  520. autoScale: boolean;
  521. stretch: number;
  522. domImage: HTMLImageElement;
  523. private _onImageLoaded();
  524. source: string;
  525. constructor(name?: string, url?: string);
  526. protected _getTypeName(): string;
  527. synchronizeSizeWithContent(): void;
  528. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  529. private static _STRETCH_NONE;
  530. private static _STRETCH_FILL;
  531. private static _STRETCH_UNIFORM;
  532. private static _STRETCH_EXTEND;
  533. static readonly STRETCH_NONE: number;
  534. static readonly STRETCH_FILL: number;
  535. static readonly STRETCH_UNIFORM: number;
  536. static readonly STRETCH_EXTEND: number;
  537. }
  538. }
  539. declare module BABYLON.GUI {
  540. class Button extends Rectangle {
  541. name: string;
  542. pointerEnterAnimation: () => void;
  543. pointerOutAnimation: () => void;
  544. pointerDownAnimation: () => void;
  545. pointerUpAnimation: () => void;
  546. constructor(name?: string);
  547. protected _getTypeName(): string;
  548. _processPicking(x: number, y: number, type: number, buttonIndex: number): boolean;
  549. protected _onPointerEnter(): boolean;
  550. _onPointerOut(): void;
  551. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  552. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  553. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  554. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  555. static CreateSimpleButton(name: string, text: string): Button;
  556. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  557. }
  558. }
  559. declare module BABYLON.GUI {
  560. class ColorPicker extends Control {
  561. name: string;
  562. private _colorWheelCanvas;
  563. private _value;
  564. private _tmpColor;
  565. private _pointerStartedOnSquare;
  566. private _pointerStartedOnWheel;
  567. private _squareLeft;
  568. private _squareTop;
  569. private _squareSize;
  570. private _h;
  571. private _s;
  572. private _v;
  573. onValueChangedObservable: Observable<Color3>;
  574. value: Color3;
  575. width: string | number;
  576. height: string | number;
  577. size: string | number;
  578. constructor(name?: string);
  579. protected _getTypeName(): string;
  580. private _updateSquareProps();
  581. private _drawGradientSquare(hueValue, left, top, width, height, context);
  582. private _drawCircle(centerX, centerY, radius, context);
  583. private _createColorWheelCanvas(radius, thickness);
  584. private _RGBtoHSV(color, result);
  585. private _HSVtoRGB(hue, saturation, value, result);
  586. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  587. private _pointerIsDown;
  588. private _updateValueFromPointer(x, y);
  589. private _isPointOnSquare(coordinates);
  590. private _isPointOnWheel(coordinates);
  591. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  592. protected _onPointerMove(coordinates: Vector2): void;
  593. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  594. }
  595. }
  596. declare module BABYLON.GUI {
  597. class InputText extends Control implements IFocusableControl {
  598. name: string;
  599. private _text;
  600. private _placeholderText;
  601. private _background;
  602. private _focusedBackground;
  603. private _placeholderColor;
  604. private _thickness;
  605. private _margin;
  606. private _autoStretchWidth;
  607. private _maxWidth;
  608. private _isFocused;
  609. private _blinkTimeout;
  610. private _blinkIsEven;
  611. private _cursorOffset;
  612. private _scrollLeft;
  613. private _textWidth;
  614. private _clickedCoordinate;
  615. promptMessage: string;
  616. onTextChangedObservable: Observable<InputText>;
  617. onFocusObservable: Observable<InputText>;
  618. onBlurObservable: Observable<InputText>;
  619. maxWidth: string | number;
  620. readonly maxWidthInPixels: number;
  621. margin: string;
  622. readonly marginInPixels: number;
  623. autoStretchWidth: boolean;
  624. thickness: number;
  625. focusedBackground: string;
  626. background: string;
  627. placeholderColor: string;
  628. placeholderText: string;
  629. text: string;
  630. constructor(name?: string, text?: string);
  631. onBlur(): void;
  632. onFocus(): void;
  633. protected _getTypeName(): string;
  634. processKey(keyCode: number, key?: string): void;
  635. processKeyboard(evt: KeyboardEvent): void;
  636. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  637. protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean;
  638. protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void;
  639. dispose(): void;
  640. }
  641. }
  642. declare module BABYLON.GUI {
  643. class KeyPropertySet {
  644. width?: string;
  645. height?: string;
  646. paddingLeft?: string;
  647. paddingRight?: string;
  648. paddingTop?: string;
  649. paddingBottom?: string;
  650. color?: string;
  651. background?: string;
  652. }
  653. class VirtualKeyboard extends StackPanel {
  654. onKeyPressObservable: Observable<string>;
  655. defaultButtonWidth: string;
  656. defaultButtonHeight: string;
  657. defaultButtonPaddingLeft: string;
  658. defaultButtonPaddingRight: string;
  659. defaultButtonPaddingTop: string;
  660. defaultButtonPaddingBottom: string;
  661. defaultButtonColor: string;
  662. defaultButtonBackground: string;
  663. protected _getTypeName(): string;
  664. private _createKey(key, propertySet?);
  665. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  666. private _connectedInputText;
  667. private _onFocusObserver;
  668. private _onBlurObserver;
  669. private _onKeyPressObserver;
  670. readonly connectedInputText: InputText;
  671. connect(input: InputText): void;
  672. disconnect(): void;
  673. static CreateDefaultLayout(): VirtualKeyboard;
  674. }
  675. }