1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /// <reference path="../../../dist/preview release/babylon.d.ts"/>
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var BABYLON;
- (function (BABYLON) {
- var GUI;
- (function (GUI) {
- var Container = (function (_super) {
- __extends(Container, _super);
- function Container(name) {
- var _this = _super.call(this, name) || this;
- _this.name = name;
- _this._children = new Array();
- return _this;
- }
- Container.prototype.addControl = function (control) {
- var index = this._children.indexOf(control);
- if (index !== -1) {
- return this;
- }
- control._setRoot(this);
- this._reOrderControl(control);
- this._markAsDirty();
- return this;
- };
- Container.prototype.removeControl = function (control) {
- var index = this._children.indexOf(control);
- if (index !== -1) {
- this._children.splice(index, 1);
- }
- this._markAsDirty();
- return this;
- };
- Container.prototype._reOrderControl = function (control) {
- this.removeControl(control);
- for (var index = 0; index < this._children.length; index++) {
- if (this._children[index].zIndex > control.zIndex) {
- this._children.splice(index, 0, control);
- return;
- }
- }
- this._children.push(control);
- this._markAsDirty();
- };
- Container.prototype._draw = function (parentMeasure, context) {
- this._currentMeasure = parentMeasure.copy();
- context.save();
- if (this.font) {
- context.font = this.font;
- }
- if (this.color) {
- context.fillStyle = this.color;
- }
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
- var child = _a[_i];
- child._draw(this._currentMeasure, context);
- }
- context.restore();
- };
- return Container;
- }(GUI.Control));
- GUI.Container = Container;
- })(GUI = BABYLON.GUI || (BABYLON.GUI = {}));
- })(BABYLON || (BABYLON = {}));
- //# sourceMappingURL=container.js.map
|