Merge branch 'master' of gitee.com:BearCAD/WebThreeJs

# Conflicts:
#	__test__/Geometry/orbit.test.ts
#	src/DatabaseServices/EntityData.ts
#	wallaby.conf.js
pull/7/head
ChenX 7 years ago
commit 8818b5e4d2

@ -30,4 +30,4 @@ test("not late", () =>
expect(d.getSize().z).toBe(1000); expect(d.getSize().z).toBe(1000);
console.log(typeof d.getSize()); console.log(typeof d.getSize());
}) })

@ -0,0 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`测试求向量 1`] = `
Vector3 {
"x": 0,
"y": -1,
"z": 0,
}
`;
exports[`测试求向量 2`] = `
Vector3 {
"x": 0,
"y": -1,
"z": 0,
}
`;
exports[`测试求向量 3`] = `
Vector3 {
"x": 0,
"y": 1,
"z": 0,
}
`;
exports[`测试求向量 4`] = `
Vector3 {
"x": 0.7071067811865475,
"y": 0,
"z": 0.7071067811865475,
}
`;

@ -1,7 +1,8 @@
import { Orbit } from '../../src/Geometry/Orbit'; import { Orbit } from '../../src/Geometry/Orbit';
import * as THREE from 'three'; import * as THREE from 'three';
import { GeUtils } from '../../src/Geometry/GeUtils'; import { GeUtils } from '../../src/Geometry/GeUtils';
test("测试平行", () => import { Vector3 } from 'three';
test("", () =>
{ {
//构造一个控制类. //构造一个控制类.
let orb = new Orbit(); let orb = new Orbit();
@ -76,4 +77,34 @@ test("测试平行", () =>
Orbit.ComputUpDirection(new THREE.Vector3(1, 0, 0), up); Orbit.ComputUpDirection(new THREE.Vector3(1, 0, 0), up);
let newD = orb.UpdateDirection();
console.log(newD);
expect(GeUtils.equal(newD, new THREE.Vector3(0, 0, -1))).toBe(true);
}) })
test("测试求向量", () =>
{
let dir = new THREE.Vector3(0, 0, 1);
let up = Orbit.ComputUpDirection(dir);
console.log(up);
expect(up).toMatchSnapshot();
Orbit.ComputUpDirection(dir, up);
console.log(up);
expect(up).toMatchSnapshot();
dir.z = -1;
Orbit.ComputUpDirection(dir, up);
console.log('up: ', up);
expect(up).toMatchSnapshot();
dir.x = 1;
Orbit.ComputUpDirection(dir, up);
console.log('up: ', up);
expect(up).toMatchSnapshot();
})

@ -28,9 +28,7 @@ export const EntityData = mst.types.model(
return { return {
setSize(x, y, z) setSize(x, y, z)
{ {
self.size[0] = x; self.size.replace([x, y, z]);
self.size[1] = y;
self.size[2] = z;
}, },
setErase(isErase: boolean) setErase(isErase: boolean)
{ {

@ -1,4 +1,5 @@
import * as THREE from "three"; import * as THREE from "three";
/** /**
* , * ,
* x90,. * x90,.

@ -1,18 +1,28 @@
module.exports = function () { module.exports = function (wallaby) {
return {
return { files: [
files: [
'tsconfig.json', // <-- 'tsconfig.json', // <--
'src/**/*.ts', 'src/**/*.ts*',
'src/**/*.js'], 'src/**/*.tsx*',
'src/**/*.js*',
tests: ['__test__/**/*.ts'], ],
tests: ['__test__/**/*.test.ts*'],
compilers: {
'**/*.ts?(x)': wallaby.compilers.typeScript({
module: 'commonjs',
jsx: 'React'
})
},
env: { env: {
type: 'node', type: 'node',
runner: 'node' runner: 'node'
}, },
testFramework: 'jest', testFramework: 'jest',
debug: true
};
}; };
};
Loading…
Cancel
Save