ohzi-core 6.1.0 → 6.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "ohzi-core",
3
- "version": "6.1.0",
3
+ "version": "6.2.2",
4
4
  "description": "OHZI Core Library",
5
- "module": "build/index.module.js",
6
5
  "source": "src/index.js",
7
6
  "types": "types/index.d.ts",
8
7
  "files": [
@@ -12,18 +11,14 @@
12
11
  "types",
13
12
  "package.json"
14
13
  ],
15
- "targets": {
16
- "module": {
17
- "includeNodeModules": false
18
- }
19
- },
20
14
  "scripts": {
21
- "test": "echo \"Error: no test specified\" && exit 1",
22
- "create-tag": "cross-var git tag -a \"v$npm_package_version\" -m \"Release Version $npm_package_version\" && cross-var git push origin \"v$npm_package_version\"",
23
15
  "build": "rollup -c",
16
+ "preinstall": "yarn config-hooks",
17
+ "config-hooks": "git config core.hooksPath git_hooks",
18
+ "create-tag": "cross-var git tag -a \"v$npm_package_version\" -m \"Release Version $npm_package_version\" && cross-var git push origin \"v$npm_package_version\"",
24
19
  "update-version": "cross-var echo \"v$npm_package_version\" > .version",
25
20
  "fix-syntax": "standardx --fix",
26
- "generate-types": "npx -p typescript tsc src/components/sdf_text/SDFTextBatch.js --declaration --allowJs --emitDeclarationOnly --outDir types"
21
+ "generate-types": "npx -p typescript tsc src/* --declaration --allowJs --emitDeclarationOnly --outDir types"
27
22
  },
28
23
  "repository": {
29
24
  "type": "git",
@@ -38,10 +33,10 @@
38
33
  "bugs": {
39
34
  "url": "https://github.com/ohzinteractive/core/issues"
40
35
  },
41
- "homepage": "https://github.com/ohzinteractive/core#readme",
36
+ "homepage": "https://github.com/ohzinteractive/core",
42
37
  "dependencies": {
43
- "pit-js": "1.7.0",
44
- "three": "^0.134.0"
38
+ "pit-js": "1.8.6",
39
+ "three": "^0.137.0"
45
40
  },
46
41
  "devDependencies": {
47
42
  "cross-var": "^1.1.0",
@@ -44,8 +44,9 @@ export default class ActionSequencer
44
44
 
45
45
  skip()
46
46
  {
47
- this.elapsed_time = this.get_duration();
48
- this.__play_clips(this.elapsed_time, this.elapsed_time + 0.01);
47
+ let duration = this.get_duration();
48
+ this.__play_clips(this.elapsed_time, duration + 0.0001);
49
+ this.elapsed_time = duration;
49
50
  }
50
51
 
51
52
  update(delta_time)
@@ -141,8 +142,8 @@ export default class ActionSequencer
141
142
  {
142
143
  for (let i = 0; i < this.action_events.length; i++)
143
144
  {
144
- if (this.action_events[i].trigger_time >= from &&
145
- this.action_events[i].trigger_time < to)
145
+ if (this.action_events[i].trigger_time > from - Number.EPSILON &&
146
+ this.action_events[i].trigger_time < to + Number.EPSILON)
146
147
  {
147
148
  // console.log("Play event: " + this.action_events[i].action.constructor.name + " at "+ this.action_events[i].trigger_time);
148
149
  this.action_events[i].action.trigger();
@@ -179,14 +180,12 @@ export default class ActionSequencer
179
180
  for (let i = 0; i < keyframes.length; i++)
180
181
  {
181
182
  let keyframe = keyframes[i];
182
- let difference = Math.min(
183
- Math.abs(keyframe.from - time),
184
- Math.abs(keyframe.to - time)
185
- );
183
+ let middle_time = (keyframe.to - keyframe.from) / 2 + keyframe.from;
184
+ let distance_to_middle_time = Math.abs(time - middle_time);
186
185
 
187
- if (difference < min_time)
186
+ if (distance_to_middle_time < min_time)
188
187
  {
189
- min_time = difference;
188
+ min_time = distance_to_middle_time;
190
189
  closest = keyframe;
191
190
  }
192
191
  }
@@ -13,6 +13,8 @@ export default class GLTFDRACOLoader extends AbstractLoader
13
13
 
14
14
  this.draco_loader.setDecoderPath(window.draco_decoder_path);
15
15
  this.draco_loader.setDecoderConfig({ type: 'js' });
16
+ this.draco_loader.setWorkerLimit(1);
17
+
16
18
  this.loader.setDRACOLoader(this.draco_loader);
17
19
  }
18
20
 
package/types/Debug.d.ts CHANGED
@@ -3,6 +3,7 @@ import { AxisHelper } from "ohzi-core/types/components/AxisHelper";
3
3
  import { Arrow } from "ohzi-core/types/primitives/Arrow";
4
4
  import { Cube } from "ohzi-core/types/primitives/Cube";
5
5
  import { Sphere } from "ohzi-core/types/primitives/Sphere";
6
+ import { Vector3 } from "three";
6
7
 
7
8
  export class Debug {
8
9
  static init(): void;
@@ -26,7 +27,7 @@ export class Debug {
26
27
  static draw_oriented_cube(from: any, to: any, height?: number, color?: string, depth?: number): Cube;
27
28
  static draw_plane(width: any, height: any, color: any): any;
28
29
  static draw_empty_cube(pos: any, size: any, color: any): any;
29
- static draw_sphere(pos: any, size: any, color: any): Sphere;
30
+ static draw_sphere(pos: Vector3, size: number, color: string): Sphere;
30
31
  static draw_point_array(input_points: any, open?: boolean, color?: number): any;
31
32
  static draw_sphere_helper(sphere: any, color: any): any;
32
33
  static draw_math_sphere(sphere: any): void;