浏览代码

Update scripts

customisations
alemart 8 个月前
父节点
当前提交
35edcc919a
共有 2 个文件被更改,包括 19 次插入9 次删除
  1. 17
    7
      dist/encantar.js
  2. 2
    2
      dist/encantar.min.js

+ 17
- 7
dist/encantar.js 查看文件

@@ -5,7 +5,7 @@
5 5
  * https://github.com/alemart/encantar-js
6 6
  *
7 7
  * @license LGPL-3.0-or-later
8
- * Date: 2024-12-17T18:08:41.979Z
8
+ * Date: 2024-12-18T22:52:50.448Z
9 9
  */
10 10
 (function webpackUniversalModuleDefinition(root, factory) {
11 11
 	if(typeof exports === 'object' && typeof module === 'object')
@@ -25621,7 +25621,8 @@ class ImageTrackerTrackingState extends ImageTrackerState {
25621 25621
             // the trackable object
25622 25622
             const trackable = {
25623 25623
                 pose: pose,
25624
-                referenceImage: referenceImage
25624
+                referenceImage: referenceImage,
25625
+                tracker: this._imageTracker
25625 25626
             };
25626 25627
             // the result generated by the image tracker
25627 25628
             const result = {
@@ -26567,16 +26568,25 @@ class PointerTracker {
26567 26568
             // determine the velocity
26568 26569
             const velocity = deltaPosition._clone()._scale(inverseDeltaTime);
26569 26570
             // determine the elapsed time since the tracking began
26570
-            const elapsedTime = previous ? previous.elapsedTime + deltaTime : 0;
26571
+            const duration = previous ? previous.duration + deltaTime : 0;
26571 26572
             // determine how much this pointer has moved since its tracking began
26572
-            const totalDistance = previous ? previous.totalDistance + deltaPosition.length() : 0;
26573
+            const movementLength = previous ? previous.movementLength + deltaPosition.length() : 0;
26574
+            // determine the duration of the movement
26575
+            const movementDuration = !previous ? 0 : previous.movementDuration + (movementLength > previous.movementLength ? deltaTime : 0);
26573 26576
             // determine whether or not this is the primary pointer for this type
26574 26577
             const isPrimary = event.isPrimary;
26575 26578
             // determine the type of the originating device
26576 26579
             const kind = event.pointerType;
26577 26580
             // we create new trackable instances on each frame;
26578 26581
             // these will be exported and consumed by the user
26579
-            this._newPointers.set(id, { id, phase, position, deltaPosition, initialPosition, velocity, elapsedTime, totalDistance, isPrimary, kind });
26582
+            this._newPointers.set(id, {
26583
+                id, phase,
26584
+                position, deltaPosition, initialPosition,
26585
+                velocity, duration,
26586
+                movementDuration, movementLength,
26587
+                isPrimary, kind,
26588
+                tracker: this
26589
+            });
26580 26590
         }
26581 26591
         // update trackables
26582 26592
         this._newPointers.forEach((trackable, id) => this._activePointers.set(id, trackable));
@@ -26645,10 +26655,10 @@ class PointerTracker {
26645 26655
     _advanceAllStationaryTrackables(deltaTime) {
26646 26656
         this._activePointers.forEach((trackable, id) => {
26647 26657
             if (trackable.phase == 'stationary') {
26648
-                trackable.elapsedTime += deltaTime;
26658
+                trackable.duration += deltaTime;
26649 26659
                 /*
26650 26660
                 this._activePointers.set(id, Object.assign({}, trackable, {
26651
-                    elapsedTime: trackable.elapsedTime + deltaTime
26661
+                    duration: trackable.duration + deltaTime
26652 26662
                 }));
26653 26663
                 */
26654 26664
             }

+ 2
- 2
dist/encantar.min.js
文件差异内容过多而无法显示
查看文件


正在加载...
取消
保存