Merge branch 'master' into select-block
This commit is contained in:
56
dist/Text.js
vendored
Normal file
56
dist/Text.js
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
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 extendStatics(d, b);
|
||||
};
|
||||
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 });
|
||||
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) {
|
||||
var f = require("../resources/fonts/helvetiker_regular.typeface.json");
|
||||
var loader = new three_1.FontLoader();
|
||||
this.defFont = loader.parse(f);
|
||||
}
|
||||
return this.defFont;
|
||||
};
|
||||
return FontLoaderUtil;
|
||||
}());
|
||||
var DbText = /** @class */ (function (_super) {
|
||||
__extends(DbText, _super);
|
||||
/**
|
||||
*
|
||||
* 构造一个文本对象,8位点(中心点下面)在0点
|
||||
* @param {string} str 数字字符串
|
||||
* @param {number} height 文本高度
|
||||
* @memberof DbText
|
||||
*/
|
||||
function DbText(str, height) {
|
||||
if (height === void 0) { height = 5; }
|
||||
var _this = this;
|
||||
var font = FontLoaderUtil.Load();
|
||||
var shapes = font.generateShapes(str, height);
|
||||
var geometry = new three_1.ShapeGeometry(shapes);
|
||||
geometry.computeBoundingBox();
|
||||
_this = _super.call(this, geometry, ColorPalette_1.ColorMaterial.GetBasicMaterial(5)) || this;
|
||||
var center = geometry.boundingBox.getCenter(new three_1.Vector3());
|
||||
_this.applyMatrix4(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
|
||||
Reference in New Issue
Block a user