更新编译输出为es5支持老旧的浏览器

This commit is contained in:
ChenX
2018-06-06 17:23:22 +08:00
parent 256a7ea8a6
commit 29a6dd0fff
38 changed files with 616 additions and 533 deletions

54
dist/Text.js vendored
View File

@@ -1,19 +1,33 @@
"use strict";
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const three_1 = require("three");
const ColorPalette_1 = require("./ColorPalette");
const GeUtils_1 = require("./GeUtils");
class FontLoaderUtil {
static Load() {
var three_1 = require("three");
var ColorPalette_1 = require("./ColorPalette");
var GeUtils_1 = require("./GeUtils");
var FontLoaderUtil = /** @class */ (function () {
function FontLoaderUtil() {
}
FontLoaderUtil.Load = function () {
if (!this.defFont) {
const f = require("../resources/fonts/helvetiker_regular.typeface.json");
let loader = new three_1.FontLoader();
var f = require("../resources/fonts/helvetiker_regular.typeface.json");
var loader = new three_1.FontLoader();
this.defFont = loader.parse(f);
}
return this.defFont;
}
}
class DbText extends three_1.Mesh {
};
return FontLoaderUtil;
}());
var DbText = /** @class */ (function (_super) {
__extends(DbText, _super);
/**
*
* 构造一个文本对象,8位点(中心点下面)在0点
@@ -21,15 +35,19 @@ class DbText extends three_1.Mesh {
* @param {number} height 文本高度
* @memberof DbText
*/
constructor(str, height = 5) {
let font = FontLoaderUtil.Load();
let shapes = font.generateShapes(str, height, 0.1);
let geometry = new three_1.ShapeGeometry(shapes);
function DbText(str, height) {
if (height === void 0) { height = 5; }
var _this = this;
var font = FontLoaderUtil.Load();
var shapes = font.generateShapes(str, height, 0.1);
var geometry = new three_1.ShapeGeometry(shapes);
geometry.computeBoundingBox();
super(geometry, ColorPalette_1.ColorMaterial.GetLineMaterial(5));
let center = geometry.boundingBox.getCenter(new three_1.Vector3());
this.applyMatrix(GeUtils_1.MoveMatrix(new three_1.Vector3(-center.x, 0, 0)));
_this = _super.call(this, geometry, ColorPalette_1.ColorMaterial.GetLineMaterial(5)) || this;
var center = geometry.boundingBox.getCenter(new three_1.Vector3());
_this.applyMatrix(GeUtils_1.MoveMatrix(new three_1.Vector3(-center.x, 0, 0)));
return _this;
}
}
return DbText;
}(three_1.Mesh));
exports.DbText = DbText;
//# sourceMappingURL=Text.js.map