@inweb/viewer-visualize 26.12.3 → 26.12.5

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.
@@ -20,7 +20,7 @@ export declare class OdaFlyDragger extends OdBaseDragger {
20
20
  protected dragPosition: Point2d;
21
21
  protected lastJoyStickCoord: Point2d;
22
22
  protected lastFrameJoyStickTS: number;
23
- protected moving: boolean;
23
+ protected isJoyStickMoving: boolean;
24
24
  protected joyStickOverlayElement: HTMLDivElement;
25
25
  protected joyStickDragger: OdJoyStickDragger;
26
26
  constructor(subject: Viewer);
@@ -34,6 +34,7 @@ export declare class OdaFlyDragger extends OdBaseDragger {
34
34
  turnLeft(angle: any): void;
35
35
  setupCamera(view: any): void;
36
36
  getMaxDimension(view: any): number;
37
- processJoyMovement(timestamp: number): void;
37
+ addJoyStickDragger(parentElement: HTMLElement): void;
38
+ processJoyStickMovement(timestamp: number): void;
38
39
  moveTotal(currentDelta: number, forward: number, right: number): void;
39
40
  }
@@ -35,7 +35,7 @@ export declare class OdaWalkDragger extends OdBaseDragger {
35
35
  turnLeft(angle: number): void;
36
36
  setupCamera(view: any): void;
37
37
  getMaxDimension(view: any): number;
38
- private addJoyStickDragger;
38
+ addJoyStickDragger(parentElement: HTMLElement): void;
39
39
  processJoyStickMovement(timestamp: number): void;
40
40
  moveTotal(currentDelta: number, forward: number, right: number): void;
41
41
  proceedChangeCamera(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "26.12.3",
3
+ "version": "26.12.5",
4
4
  "description": "JavaScript library for rendering CAD and BIM files in a browser using VisualizeJS",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~26.12.3",
33
- "@inweb/eventemitter2": "~26.12.3",
34
- "@inweb/markup": "~26.12.3",
35
- "@inweb/viewer-core": "~26.12.3"
32
+ "@inweb/client": "~26.12.5",
33
+ "@inweb/eventemitter2": "~26.12.5",
34
+ "@inweb/markup": "~26.12.5",
35
+ "@inweb/viewer-core": "~26.12.5"
36
36
  },
37
37
  "visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js"
38
38
  }
@@ -49,7 +49,7 @@ export class OdaFlyDragger extends OdBaseDragger {
49
49
  protected dragPosition: Point2d;
50
50
  protected lastJoyStickCoord: Point2d;
51
51
  protected lastFrameJoyStickTS: number;
52
- protected moving: boolean;
52
+ protected isJoyStickMoving: boolean;
53
53
  protected joyStickOverlayElement: HTMLDivElement;
54
54
  protected joyStickDragger: OdJoyStickDragger;
55
55
 
@@ -68,39 +68,13 @@ export class OdaFlyDragger extends OdBaseDragger {
68
68
  this.lastFrameJoyStickTS = 0;
69
69
  this.animationId = undefined;
70
70
  this.processMovement = this.processMovement.bind(this);
71
- this.processJoyMovement = this.processJoyMovement.bind(this);
71
+ this.processJoyStickMovement = this.processJoyStickMovement.bind(this);
72
72
 
73
73
  this.deltaAngle = Math.PI / 3600;
74
74
  this.autoSelect = true;
75
75
 
76
- this.moving = false;
77
-
78
- this.joyStickOverlayElement = document.createElement("div");
79
- this.joyStickOverlayElement.id = "joyStickDiv";
80
- this.joyStickOverlayElement.style.background = "rgba(0,0,0,0)";
81
- this.joyStickOverlayElement.style.position = "fixed";
82
- this.joyStickOverlayElement.style.zIndex = "0";
83
- document.body.appendChild(this.joyStickOverlayElement);
84
-
85
- this.joyStickDragger = new OdJoyStickDragger(
86
- this,
87
- this.joyStickOverlayElement,
88
- (stickData) => {
89
- if (Math.sqrt(stickData.x * stickData.x + stickData.y * stickData.y) > 20) {
90
- this.lastJoyStickCoord = { x: stickData.x, y: stickData.y };
91
- if (!this.animationId && !this.moving) {
92
- this.moving = true;
93
- this.processJoyMovement(0);
94
- }
95
- } else {
96
- this.moving = false;
97
- window.cancelAnimationFrame(this.animationId);
98
- this.animationId = undefined;
99
- this.lastFrameJoyStickTS = 0;
100
- }
101
- },
102
- this.m_module.canvas
103
- );
76
+ this.isJoyStickMoving = false;
77
+ this.addJoyStickDragger(subject.canvas.parentElement);
104
78
  }
105
79
 
106
80
  override initialize() {
@@ -330,9 +304,38 @@ export class OdaFlyDragger extends OdBaseDragger {
330
304
  return Math.max(...volume);
331
305
  }
332
306
 
333
- processJoyMovement(timestamp: number) {
334
- if (!this.moving) return;
335
- this.animationId = requestAnimationFrame(this.processJoyMovement);
307
+ addJoyStickDragger(parentElement: HTMLElement) {
308
+ this.joyStickOverlayElement = document.createElement("div");
309
+ this.joyStickOverlayElement.id = "joyStickDiv";
310
+ this.joyStickOverlayElement.style.background = "rgba(0,0,0,0)";
311
+ this.joyStickOverlayElement.style.position = "fixed";
312
+ this.joyStickOverlayElement.style.zIndex = "0";
313
+ parentElement.appendChild(this.joyStickOverlayElement);
314
+
315
+ this.joyStickDragger = new OdJoyStickDragger(
316
+ this,
317
+ this.joyStickOverlayElement,
318
+ (stickData) => {
319
+ if (Math.sqrt(stickData.x * stickData.x + stickData.y * stickData.y) > 20) {
320
+ this.lastJoyStickCoord = { x: stickData.x, y: stickData.y };
321
+ if (!this.animationId && !this.isJoyStickMoving) {
322
+ this.isJoyStickMoving = true;
323
+ this.processJoyStickMovement(0);
324
+ }
325
+ } else {
326
+ this.isJoyStickMoving = false;
327
+ window.cancelAnimationFrame(this.animationId);
328
+ this.animationId = undefined;
329
+ this.lastFrameJoyStickTS = 0;
330
+ }
331
+ },
332
+ this.m_module.canvas
333
+ );
334
+ }
335
+
336
+ processJoyStickMovement(timestamp: number) {
337
+ if (!this.isJoyStickMoving) return;
338
+ this.animationId = requestAnimationFrame(this.processJoyStickMovement);
336
339
 
337
340
  if (this.lastFrameJoyStickTS !== 0) {
338
341
  const deltaTS = timestamp - this.lastFrameJoyStickTS;
@@ -73,7 +73,7 @@ export class OdaWalkDragger extends OdBaseDragger {
73
73
  this.autoSelect = true;
74
74
 
75
75
  this.isJoyStickMoving = false;
76
- this.addJoyStickDragger();
76
+ this.addJoyStickDragger(subject.canvas.parentElement);
77
77
  }
78
78
 
79
79
  override initialize() {
@@ -329,13 +329,13 @@ export class OdaWalkDragger extends OdBaseDragger {
329
329
  return Math.max(...volume);
330
330
  }
331
331
 
332
- private addJoyStickDragger() {
332
+ addJoyStickDragger(parentElement: HTMLElement) {
333
333
  this.joyStickOverlayElement = document.createElement("div");
334
334
  this.joyStickOverlayElement.id = "joyStickDiv";
335
335
  this.joyStickOverlayElement.style.background = "rgba(0,0,0,0)";
336
336
  this.joyStickOverlayElement.style.position = "fixed";
337
337
  this.joyStickOverlayElement.style.zIndex = "0";
338
- document.body.appendChild(this.joyStickOverlayElement);
338
+ parentElement.appendChild(this.joyStickOverlayElement);
339
339
 
340
340
  this.joyStickDragger = new OdJoyStickDragger(
341
341
  this,