@inweb/viewer-visualize 26.12.4 → 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.
- package/dist/viewer-visualize.js +32 -29
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +32 -29
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Draggers/OdaFlyDragger.d.ts +3 -2
- package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +1 -1
- package/package.json +5 -5
- package/src/Viewer/Draggers/OdaFlyDragger.ts +36 -33
- package/src/Viewer/Draggers/OdaWalkDragger.ts +3 -3
|
@@ -1008,7 +1008,7 @@ class OdaWalkDragger extends OdBaseDragger {
|
|
|
1008
1008
|
this.deltaAngle = Math.PI / 3600;
|
|
1009
1009
|
this.autoSelect = true;
|
|
1010
1010
|
this.isJoyStickMoving = false;
|
|
1011
|
-
this.addJoyStickDragger();
|
|
1011
|
+
this.addJoyStickDragger(subject.canvas.parentElement);
|
|
1012
1012
|
}
|
|
1013
1013
|
initialize() {
|
|
1014
1014
|
super.initialize();
|
|
@@ -1213,13 +1213,13 @@ class OdaWalkDragger extends OdBaseDragger {
|
|
|
1213
1213
|
const volume = [xmax - xmin, ymax - ymin, zmax - zmin];
|
|
1214
1214
|
return Math.max(...volume);
|
|
1215
1215
|
}
|
|
1216
|
-
addJoyStickDragger() {
|
|
1216
|
+
addJoyStickDragger(parentElement) {
|
|
1217
1217
|
this.joyStickOverlayElement = document.createElement("div");
|
|
1218
1218
|
this.joyStickOverlayElement.id = "joyStickDiv";
|
|
1219
1219
|
this.joyStickOverlayElement.style.background = "rgba(0,0,0,0)";
|
|
1220
1220
|
this.joyStickOverlayElement.style.position = "fixed";
|
|
1221
1221
|
this.joyStickOverlayElement.style.zIndex = "0";
|
|
1222
|
-
|
|
1222
|
+
parentElement.appendChild(this.joyStickOverlayElement);
|
|
1223
1223
|
this.joyStickDragger = new OdJoyStickDragger(this, this.joyStickOverlayElement, (stickData) => {
|
|
1224
1224
|
if (Math.sqrt(stickData.x * stickData.x + stickData.y * stickData.y) > 20) {
|
|
1225
1225
|
this.lastJoyStickCoord = { x: stickData.x, y: stickData.y };
|
|
@@ -1284,31 +1284,11 @@ class OdaFlyDragger extends OdBaseDragger {
|
|
|
1284
1284
|
this.lastFrameJoyStickTS = 0;
|
|
1285
1285
|
this.animationId = undefined;
|
|
1286
1286
|
this.processMovement = this.processMovement.bind(this);
|
|
1287
|
-
this.
|
|
1287
|
+
this.processJoyStickMovement = this.processJoyStickMovement.bind(this);
|
|
1288
1288
|
this.deltaAngle = Math.PI / 3600;
|
|
1289
1289
|
this.autoSelect = true;
|
|
1290
|
-
this.
|
|
1291
|
-
this.
|
|
1292
|
-
this.joyStickOverlayElement.id = "joyStickDiv";
|
|
1293
|
-
this.joyStickOverlayElement.style.background = "rgba(0,0,0,0)";
|
|
1294
|
-
this.joyStickOverlayElement.style.position = "fixed";
|
|
1295
|
-
this.joyStickOverlayElement.style.zIndex = "0";
|
|
1296
|
-
document.body.appendChild(this.joyStickOverlayElement);
|
|
1297
|
-
this.joyStickDragger = new OdJoyStickDragger(this, this.joyStickOverlayElement, (stickData) => {
|
|
1298
|
-
if (Math.sqrt(stickData.x * stickData.x + stickData.y * stickData.y) > 20) {
|
|
1299
|
-
this.lastJoyStickCoord = { x: stickData.x, y: stickData.y };
|
|
1300
|
-
if (!this.animationId && !this.moving) {
|
|
1301
|
-
this.moving = true;
|
|
1302
|
-
this.processJoyMovement(0);
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
else {
|
|
1306
|
-
this.moving = false;
|
|
1307
|
-
window.cancelAnimationFrame(this.animationId);
|
|
1308
|
-
this.animationId = undefined;
|
|
1309
|
-
this.lastFrameJoyStickTS = 0;
|
|
1310
|
-
}
|
|
1311
|
-
}, this.m_module.canvas);
|
|
1290
|
+
this.isJoyStickMoving = false;
|
|
1291
|
+
this.addJoyStickDragger(subject.canvas.parentElement);
|
|
1312
1292
|
}
|
|
1313
1293
|
initialize() {
|
|
1314
1294
|
super.initialize();
|
|
@@ -1491,10 +1471,33 @@ class OdaFlyDragger extends OdBaseDragger {
|
|
|
1491
1471
|
const volume = [xmax - xmin, ymax - ymin, zmax - zmin];
|
|
1492
1472
|
return Math.max(...volume);
|
|
1493
1473
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1474
|
+
addJoyStickDragger(parentElement) {
|
|
1475
|
+
this.joyStickOverlayElement = document.createElement("div");
|
|
1476
|
+
this.joyStickOverlayElement.id = "joyStickDiv";
|
|
1477
|
+
this.joyStickOverlayElement.style.background = "rgba(0,0,0,0)";
|
|
1478
|
+
this.joyStickOverlayElement.style.position = "fixed";
|
|
1479
|
+
this.joyStickOverlayElement.style.zIndex = "0";
|
|
1480
|
+
parentElement.appendChild(this.joyStickOverlayElement);
|
|
1481
|
+
this.joyStickDragger = new OdJoyStickDragger(this, this.joyStickOverlayElement, (stickData) => {
|
|
1482
|
+
if (Math.sqrt(stickData.x * stickData.x + stickData.y * stickData.y) > 20) {
|
|
1483
|
+
this.lastJoyStickCoord = { x: stickData.x, y: stickData.y };
|
|
1484
|
+
if (!this.animationId && !this.isJoyStickMoving) {
|
|
1485
|
+
this.isJoyStickMoving = true;
|
|
1486
|
+
this.processJoyStickMovement(0);
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
else {
|
|
1490
|
+
this.isJoyStickMoving = false;
|
|
1491
|
+
window.cancelAnimationFrame(this.animationId);
|
|
1492
|
+
this.animationId = undefined;
|
|
1493
|
+
this.lastFrameJoyStickTS = 0;
|
|
1494
|
+
}
|
|
1495
|
+
}, this.m_module.canvas);
|
|
1496
|
+
}
|
|
1497
|
+
processJoyStickMovement(timestamp) {
|
|
1498
|
+
if (!this.isJoyStickMoving)
|
|
1496
1499
|
return;
|
|
1497
|
-
this.animationId = requestAnimationFrame(this.
|
|
1500
|
+
this.animationId = requestAnimationFrame(this.processJoyStickMovement);
|
|
1498
1501
|
if (this.lastFrameJoyStickTS !== 0) {
|
|
1499
1502
|
const deltaTS = timestamp - this.lastFrameJoyStickTS;
|
|
1500
1503
|
if (deltaTS > 0) {
|