Browse Source

旋转功能完善

master
xuhuajiao 2 months ago
parent
commit
1c2bc2e661
  1. 10
      public/webThird/index.js
  2. 6
      public/webWater/index.js

10
public/webThird/index.js

@ -20,6 +20,7 @@ var drag = null
// var showdd = 50 // var showdd = 50
var isRotating = true var isRotating = true
var clickParentRotate = false
var camera var camera
BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() { BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() {
if (document.getElementById('customLoadingScreenDiv')) { if (document.getElementById('customLoadingScreenDiv')) {
@ -105,9 +106,9 @@ function prepareGroupButton2(transformNodex, color, qu) {
// // alert(error) // // alert(error)
// } // }
// } // }
isRotating = false isRotating = false
camera.useAutoRotationBehavior = isRotating camera.useAutoRotationBehavior = isRotating
// }
} }
) )
) )
@ -133,8 +134,12 @@ function prepareGroupButton2(transformNodex, color, qu) {
// } // }
// } // }
// clickbegin = false // clickbegin = false
if (clickParentRotate) {
isRotating = true isRotating = true
camera.useAutoRotationBehavior = isRotating camera.useAutoRotationBehavior = isRotating
}
// } // }
} }
) )
@ -253,8 +258,10 @@ BABYLON.DefaultLoadingScreen.prototype.hideLoadingUI = function() {
} }
} }
// clickbegin = false // clickbegin = false
if (clickParentRotate) {
isRotating = true isRotating = true
camera.useAutoRotationBehavior = isRotating camera.useAutoRotationBehavior = isRotating
}
// } // }
} }
) )
@ -575,6 +582,7 @@ window.addEventListener(
function toggleAutoRotation(isAutoRotating) { function toggleAutoRotation(isAutoRotating) {
var camera = scene.activeCamera var camera = scene.activeCamera
clickParentRotate = !isAutoRotating
if (!isAutoRotating) { if (!isAutoRotating) {
// 启用自动旋转 // 启用自动旋转
camera.useAutoRotationBehavior = true camera.useAutoRotationBehavior = true

6
public/webWater/index.js

@ -20,6 +20,7 @@ var drag = null
// var showdd = 50 // var showdd = 50
var isRotating = true var isRotating = true
var clickParentRotate = false
var camera var camera
BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() { BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() {
@ -141,8 +142,10 @@ function prepareGroupButton2(transformNodex, color, qu) {
// } // }
// } // }
// clickbegin = false // clickbegin = false
if (clickParentRotate) {
isRotating = true isRotating = true
camera.useAutoRotationBehavior = isRotating camera.useAutoRotationBehavior = isRotating
}
// } // }
} }
) )
@ -262,8 +265,10 @@ BABYLON.DefaultLoadingScreen.prototype.hideLoadingUI = function() {
} }
} }
// clickbegin = false // clickbegin = false
if (clickParentRotate) {
isRotating = true isRotating = true
camera.useAutoRotationBehavior = isRotating camera.useAutoRotationBehavior = isRotating
}
// } // }
} }
) )
@ -594,6 +599,7 @@ window.addEventListener(
function toggleAutoRotation(isAutoRotating) { function toggleAutoRotation(isAutoRotating) {
var camera = scene.activeCamera var camera = scene.activeCamera
clickParentRotate = !isAutoRotating
if (!isAutoRotating) { if (!isAutoRotating) {
// 启用自动旋转 // 启用自动旋转
camera.useAutoRotationBehavior = true camera.useAutoRotationBehavior = true

Loading…
Cancel
Save