@xeokit/xeokit-sdk 2.6.0-beta-13 → 2.6.0-beta-15

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.
@@ -156,7 +156,7 @@ class MousePanRotateDollyHandler {
156
156
  }
157
157
  });
158
158
 
159
- document.addEventListener("mousemove", this._documentMouseMoveHandler = () => {
159
+ document.addEventListener("mousemove", this._documentMouseMoveHandler = (e) => {
160
160
 
161
161
  if (!(configs.active && configs.pointerEnabled)) {
162
162
  return;
@@ -177,10 +177,10 @@ class MousePanRotateDollyHandler {
177
177
 
178
178
  const panning = keyDown[scene.input.KEY_SHIFT] || configs.planView || (!configs.panRightClick && mouseDownMiddle) || (configs.panRightClick && mouseDownRight);
179
179
 
180
- if (panning) {
180
+ const xDelta = document.pointerLockElement ? e.movementX : (x - lastX);
181
+ const yDelta = document.pointerLockElement ? e.movementY : (y - lastY);
181
182
 
182
- const xPanDelta = (x - lastX);
183
- const yPanDelta = (y - lastY);
183
+ if (panning) {
184
184
 
185
185
  const camera = scene.camera;
186
186
 
@@ -191,13 +191,13 @@ class MousePanRotateDollyHandler {
191
191
  const depth = Math.abs(mouseDownPicked ? math.lenVec3(math.subVec3(pickedWorldPos, scene.camera.eye, [])) : scene.camera.eyeLookDist);
192
192
  const targetDistance = depth * Math.tan((camera.perspective.fov / 2) * Math.PI / 180.0);
193
193
 
194
- updates.panDeltaX += (1.5 * xPanDelta * targetDistance / canvasHeight);
195
- updates.panDeltaY += (1.5 * yPanDelta * targetDistance / canvasHeight);
194
+ updates.panDeltaX += (1.5 * xDelta * targetDistance / canvasHeight);
195
+ updates.panDeltaY += (1.5 * yDelta * targetDistance / canvasHeight);
196
196
 
197
197
  } else {
198
198
 
199
- updates.panDeltaX += 0.5 * camera.ortho.scale * (xPanDelta / canvasHeight);
200
- updates.panDeltaY += 0.5 * camera.ortho.scale * (yPanDelta / canvasHeight);
199
+ updates.panDeltaX += 0.5 * camera.ortho.scale * (xDelta / canvasHeight);
200
+ updates.panDeltaY += 0.5 * camera.ortho.scale * (yDelta / canvasHeight);
201
201
  }
202
202
 
203
203
  } else if (mouseDownLeft && !mouseDownMiddle && !mouseDownRight) {
@@ -205,12 +205,12 @@ class MousePanRotateDollyHandler {
205
205
  if (!configs.planView) { // No rotating in plan-view mode
206
206
 
207
207
  if (configs.firstPerson) {
208
- updates.rotateDeltaY -= ((x - lastX) / canvasWidth) * configs.dragRotationRate / 2;
209
- updates.rotateDeltaX += ((y - lastY) / canvasHeight) * (configs.dragRotationRate / 4);
208
+ updates.rotateDeltaY -= (xDelta / canvasWidth) * configs.dragRotationRate / 2;
209
+ updates.rotateDeltaX += (yDelta / canvasHeight) * (configs.dragRotationRate / 4);
210
210
 
211
211
  } else {
212
- updates.rotateDeltaY -= ((x - lastX) / canvasWidth) * (configs.dragRotationRate * 1.5);
213
- updates.rotateDeltaX += ((y - lastY) / canvasHeight) * (configs.dragRotationRate * 1.5);
212
+ updates.rotateDeltaY -= (xDelta / canvasWidth) * (configs.dragRotationRate * 1.5);
213
+ updates.rotateDeltaX += (yDelta / canvasHeight) * (configs.dragRotationRate * 1.5);
214
214
  }
215
215
  }
216
216
  }
@@ -2669,7 +2669,7 @@ export class SceneModel extends Component {
2669
2669
  return;
2670
2670
  }
2671
2671
  let parentTransform;
2672
- if (this.parentTransformId) {
2672
+ if (cfg.parentTransformId) {
2673
2673
  parentTransform = this._transforms[cfg.parentTransformId];
2674
2674
  if (!parentTransform) {
2675
2675
  this.error("[createTransform] SceneModel.createTransform() config missing: id");