@3dsource/angular-unreal-module 0.0.193 → 0.0.194

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/LICENSE CHANGED
File without changes
@@ -5988,6 +5988,8 @@ i0.ɵɵngDeclareClassMetadata({
5988
5988
  args: [{ providedIn: "root" }]
5989
5989
  }]
5990
5990
  });
5991
+ const TOUCH_GESTURE_SETTLE_MS = 150;
5992
+ const distanceBetween = (touches) => Math.hypot(touches[1].clientX - touches[0].clientX, touches[1].clientY - touches[0].clientY);
5991
5993
  var AnalyticsService = class AnalyticsService extends SubService {
5992
5994
  #stopMouse$ = new Subject();
5993
5995
  constructor() {
@@ -6001,7 +6003,7 @@ var AnalyticsService = class AnalyticsService extends SubService {
6001
6003
  const stop$ = merge(this.#stopMouse$, this.destroy$);
6002
6004
  const element = document.getElementById("streamingVideo");
6003
6005
  if (!element) return;
6004
- const mousewheel$ = fromEvent(element, "wheel").pipe(takeUntil(stop$), throttleTime(1e3));
6006
+ const mousewheel$ = fromEvent(element, "wheel").pipe(takeUntil(stop$), filter((event) => event.deltaY !== 0), throttleTime(1e3));
6005
6007
  const mousedown$ = fromEvent(element, "mousedown").pipe(takeUntil(stop$));
6006
6008
  const touchStart$ = fromEvent(element, "touchstart").pipe(takeUntil(stop$));
6007
6009
  const touchMove$ = fromEvent(element, "touchmove").pipe(takeUntil(stop$), throttleTime(200));
@@ -6012,21 +6014,21 @@ var AnalyticsService = class AnalyticsService extends SubService {
6012
6014
  action: downEvent.button === 0 ? "spinning" : "panning"
6013
6015
  });
6014
6016
  })).subscribe();
6015
- touchStart$.pipe(tap$1((downEvent) => {
6016
- const totalTouches = downEvent.touches.length;
6017
+ touchStart$.pipe(map((downEvent) => {
6017
6018
  const touch = downEvent.touches[0];
6018
- this.sendEventToMixPanel("touch_interaction", {
6019
+ return {
6019
6020
  viewX: touch.clientX / element.clientWidth,
6020
6021
  viewY: touch.clientY / element.clientHeight,
6021
- action: totalTouches === 1 ? "spinning" : "panning"
6022
- });
6023
- })).subscribe();
6022
+ action: downEvent.touches.length === 1 ? "spinning" : "panning"
6023
+ };
6024
+ }), debounceTime(TOUCH_GESTURE_SETTLE_MS), tap$1((interaction) => this.sendEventToMixPanel("touch_interaction", interaction))).subscribe();
6024
6025
  let initialTouchDistance = 0;
6026
+ touchStart$.pipe(filter((event) => event.touches.length >= 2)).subscribe((event) => {
6027
+ initialTouchDistance = distanceBetween(event.touches);
6028
+ });
6025
6029
  touchMove$.subscribe((event) => {
6026
6030
  if (event.touches.length < 2) return;
6027
- const touch1 = event.touches[0];
6028
- const touch2 = event.touches[1];
6029
- const currentDistance = Math.sqrt(Math.pow(touch2.clientX - touch1.clientX, 2) + Math.pow(touch2.clientY - touch1.clientY, 2));
6031
+ const currentDistance = distanceBetween(event.touches);
6030
6032
  const deltaDistance = currentDistance - initialTouchDistance;
6031
6033
  const isZoomingIn = deltaDistance > 0;
6032
6034
  if (Math.abs(deltaDistance) > 10) {
@@ -6039,7 +6041,7 @@ var AnalyticsService = class AnalyticsService extends SubService {
6039
6041
  });
6040
6042
  mousewheel$.subscribe((event) => {
6041
6043
  this.sendEventToMixPanel("mouse_zoom_interaction", {
6042
- delta: -(event.deltaY / Math.abs(event.deltaY)),
6044
+ delta: -Math.sign(event.deltaY),
6043
6045
  action: event.deltaY < 0 ? "zoomin" : "zoomout"
6044
6046
  });
6045
6047
  });