This commit is contained in:
xf 2018-05-30 11:20:29 +08:00
commit 5fc8d4b0f4
5 changed files with 23 additions and 8 deletions

15
.vscode/settings.json vendored
View File

@ -1,3 +1,16 @@
//
{ {
"editor.formatOnSave": true "typescript.tsdk": "node_modules\\typescript\\lib",
//
"editor.tabSize": 4,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
//
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
"typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
"typescript.referencesCodeLens.enabled": true,
"javascript.format.placeOpenBraceOnNewLineForFunctions": true,
"javascript.format.enable": true,
"files.insertFinalNewline": true,
"editor.detectIndentation": true,
} }

4
dist/createBoard.js vendored
View File

@ -80,10 +80,10 @@ function createBoard(boardData) {
boardMat.setPosition(pBase); boardMat.setPosition(pBase);
matInv.getInverse(boardMat, true); matInv.getInverse(boardMat, true);
} }
if (boardPts) if (boardPts && boardPts.length !== 0)
for (let i = 0; i < boardPts.length; i++) { for (let i = 0; i < boardPts.length; i++) {
let pt = getVec(boardPts[i]); let pt = getVec(boardPts[i]);
if (pt.z !== undefined) if (boardPts[i].z !== undefined)
pt.applyMatrix4(matInv); pt.applyMatrix4(matInv);
pts.push(new THREE.Vector2(pt.x, pt.y)); pts.push(new THREE.Vector2(pt.x, pt.y));
buls.push(boardBuls[i]); buls.push(boardBuls[i]);

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,13 @@
{ {
"name": "cadview", "name": "cadview",
"version": "1.0.2", "version": "1.0.4",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"private": true,
"scripts": { "scripts": {
"build": "tsc" "build": "tsc",
"dev": "tsc -w"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -101,11 +101,11 @@ export function createBoard(boardData: object)
matInv.getInverse(boardMat, true); matInv.getInverse(boardMat, true);
} }
if (boardPts) if (boardPts && boardPts.length !== 0)
for (let i = 0; i < boardPts.length; i++) for (let i = 0; i < boardPts.length; i++)
{ {
let pt = getVec(boardPts[i]); let pt = getVec(boardPts[i]);
if (pt.z !== undefined) if (boardPts[i].z !== undefined)
pt.applyMatrix4(matInv); pt.applyMatrix4(matInv);
pts.push(new THREE.Vector2(pt.x, pt.y)); pts.push(new THREE.Vector2(pt.x, pt.y));
buls.push(boardBuls[i]); buls.push(boardBuls[i]);