更新编译输出为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/Dimension.js vendored
View File

@@ -1,9 +1,19 @@
"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 Text_1 = require("./Text");
const GeUtils_1 = require("./GeUtils");
var three_1 = require("three");
var ColorPalette_1 = require("./ColorPalette");
var Text_1 = require("./Text");
var GeUtils_1 = require("./GeUtils");
/**
* 标注实体
*
@@ -11,36 +21,42 @@ const GeUtils_1 = require("./GeUtils");
* @class Dimension
* @extends {Group}
*/
class Dimension extends three_1.Group {
constructor(length, textHeight = 25, mirror = false, mirrorFoot = false) {
super();
let footLength = 60;
var Dimension = /** @class */ (function (_super) {
__extends(Dimension, _super);
function Dimension(length, textHeight, mirror, mirrorFoot) {
if (textHeight === void 0) { textHeight = 25; }
if (mirror === void 0) { mirror = false; }
if (mirrorFoot === void 0) { mirrorFoot = false; }
var _this = _super.call(this) || this;
var footLength = 60;
if (mirrorFoot) {
footLength = -footLength;
}
//针脚几何体
let lineGeo = new three_1.Geometry();
var lineGeo = new three_1.Geometry();
lineGeo.vertices.push(new three_1.Vector3(), new three_1.Vector3(0, footLength, 0));
//托盘几何体
let lineGeo2 = new three_1.Geometry();
var lineGeo2 = new three_1.Geometry();
lineGeo2.vertices.push(new three_1.Vector3(0, footLength), new three_1.Vector3(length, footLength, 0));
let material = ColorPalette_1.ColorMaterial.GetLineMaterial(5);
let line1 = new three_1.Line(lineGeo, material);
let line2 = new three_1.Line(lineGeo, material);
var material = ColorPalette_1.ColorMaterial.GetLineMaterial(5);
var line1 = new three_1.Line(lineGeo, material);
var line2 = new three_1.Line(lineGeo, material);
line2.position.x = length;
let line3 = new three_1.Line(lineGeo2, material);
let text = new Text_1.DbText(parseFloat(length.toFixed(2)).toString(), textHeight);
var line3 = new three_1.Line(lineGeo2, material);
var text = new Text_1.DbText(parseFloat(length.toFixed(2)).toString(), textHeight);
if (mirror) {
let roMat = new three_1.Matrix4().makeRotationZ(Math.PI);
var roMat = new three_1.Matrix4().makeRotationZ(Math.PI);
text.applyMatrix(roMat);
text.applyMatrix(GeUtils_1.MoveMatrix(new three_1.Vector3(length * 0.5, footLength - textHeight * 0.1)));
}
else {
text.applyMatrix(GeUtils_1.MoveMatrix(new three_1.Vector3(length * 0.5, footLength * 1.1)));
}
this.add(text);
this.add(line1, line2, line3);
_this.add(text);
_this.add(line1, line2, line3);
return _this;
}
}
return Dimension;
}(three_1.Group));
exports.Dimension = Dimension;
//# sourceMappingURL=Dimension.js.map