babylon.gui.module.d.ts 26 KB

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