修复引用node_modules资源问题

v2 1.0.1
xf 6 years ago
parent 0f41ff6562
commit 70e20e5a58

2
dist/Text.js vendored

@ -6,7 +6,7 @@ const GeUtils_1 = require("./GeUtils");
class FontLoaderUtil {
static Load() {
if (!this.defFont) {
const f = require("../node_modules/three/examples/fonts/helvetiker_regular.typeface.json");
const f = require("../resources/fonts/helvetiker_regular.typeface.json");
let loader = new three_1.FontLoader();
this.defFont = loader.parse(f);
}

2
dist/Text.js.map vendored

@ -1 +1 @@
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.ts"],"names":[],"mappings":";;AAAA,iCAAuE;AACvE,iDAA+C;AAC/C,uCAAuC;AAGvC;IAGI,MAAM,CAAC,IAAI;QAEP,IAAG,CAAC,IAAI,CAAC,OAAO,EAChB;YACI,MAAM,CAAC,GAAG,OAAO,CAAC,uEAAuE,CAAC,CAAC;YAC3F,IAAI,MAAM,GAAG,IAAI,kBAAU,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ;AAED,YAAoB,SAAQ,YAAI;IAE5B;;;;;;OAMG;IACH,YAAY,GAAU,EAAC,SAAgB,CAAC;QAGpC,IAAI,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;QAEjC,IAAI,MAAM,GAAkB,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAC,GAAG,CAAC,CAAC;QACjE,IAAI,QAAQ,GAAG,IAAI,qBAAa,CAAC,MAAM,CAAC,CAAC;QAEzC,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QAE9B,KAAK,CAAC,QAAQ,EAAC,4BAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjD,IAAI,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,eAAO,EAAE,CAAC,CAAC;QAC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C;CACF;AArBD,wBAqBC"}

@ -1,13 +1,13 @@
{
"name": "cadview",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc"
},
"author": "",
"author": "cx",
"license": "ISC",
"devDependencies": {
"@types/node": "^10.1.2",

File diff suppressed because one or more lines are too long

@ -2,44 +2,37 @@ import { Font, FontLoader, Mesh, ShapeGeometry, Vector3 } from "three";
import { ColorMaterial } from "./ColorPalette";
import { MoveMatrix } from "./GeUtils";
class FontLoaderUtil
{
private static defFont:Font;
static Load():Font
{
if(!this.defFont)
{
const f = require("../node_modules/three/examples/fonts/helvetiker_regular.typeface.json");
let loader = new FontLoader();
this.defFont = loader.parse(f);
}
return this.defFont;
class FontLoaderUtil {
private static defFont: Font;
static Load(): Font {
if (!this.defFont) {
const f = require("../resources/fonts/helvetiker_regular.typeface.json");
let loader = new FontLoader();
this.defFont = loader.parse(f);
}
return this.defFont;
}
}
export class DbText extends Mesh
{
/**
*
* ,8()0
* @param {string} str
* @param {number} height
* @memberof DbText
*/
constructor(str:string,height:number = 5)
{
let font = FontLoaderUtil.Load();
export class DbText extends Mesh {
/**
*
* ,8()0
* @param {string} str
* @param {number} height
* @memberof DbText
*/
constructor(str: string, height: number = 5) {
let font = FontLoaderUtil.Load();
let shapes: THREE.Shape[] = font.generateShapes(str, height,0.1);
let geometry = new ShapeGeometry(shapes);
let shapes: THREE.Shape[] = font.generateShapes(str, height, 0.1);
let geometry = new ShapeGeometry(shapes);
geometry.computeBoundingBox();
geometry.computeBoundingBox();
super(geometry,ColorMaterial.GetLineMaterial(5));
super(geometry, ColorMaterial.GetLineMaterial(5));
let center = geometry.boundingBox.getCenter(new Vector3());
this.applyMatrix(MoveMatrix(new Vector3(-center.x,0,0)));
}
let center = geometry.boundingBox.getCenter(new Vector3());
this.applyMatrix(MoveMatrix(new Vector3(-center.x, 0, 0)));
}
}

Loading…
Cancel
Save