|
@@ -106,7 +106,7 @@ Viewer.prototype.hasChanged = function () {//判断画面是否改变了,改
|
|
|
|
|
|
if (!this.previousState) {
|
|
|
copy()
|
|
|
- return { cameraChanged: !0, changed: !0 };
|
|
|
+ return { cameraChanged: !0, changeSlightly: !1 };
|
|
|
}
|
|
|
var cameraChanged =
|
|
|
!this.camera.projectionMatrix.equals(this.previousState.projectionMatrix) ||
|
|
@@ -114,11 +114,15 @@ Viewer.prototype.hasChanged = function () {//判断画面是否改变了,改
|
|
|
!this.camera.quaternion.equals(this.previousState.quaternion)
|
|
|
|
|
|
|
|
|
- var changed = cameraChanged //|| !this.mouse.equals(this.previousState.mouse)
|
|
|
-
|
|
|
+ //var changed = cameraChanged //|| !this.mouse.equals(this.previousState.mouse)
|
|
|
+ let changeSlightly
|
|
|
+ if(cameraChanged){
|
|
|
+ changeSlightly = math.closeTo(this.camera.position,this.previousState.position, 1e-3) &&
|
|
|
+ math.closeTo(this.camera.quaternion,this.previousState.quaternion, 1e-4)
|
|
|
+ }
|
|
|
copy()
|
|
|
|
|
|
- return { cameraChanged, changed };
|
|
|
+ return { cameraChanged, changeSlightly };
|
|
|
}
|
|
|
|
|
|
Viewer.prototype.setSize = function () {
|
|
@@ -163,7 +167,7 @@ Viewer.prototype.animate = function () {
|
|
|
|
|
|
let changed = this.hasChanged()
|
|
|
if (changed.cameraChanged) {
|
|
|
- this.dispatchEvent({ type: 'view.changed' })
|
|
|
+ this.dispatchEvent({ type: 'view.changed', changeSlightly:changed.changeSlightly })
|
|
|
|
|
|
let label_ = this.labels.filter(e => e.elem[0].style.display == 'block')
|
|
|
label_.sort((a, b) => b.pos2d.z - a.pos2d.z)
|
|
@@ -398,7 +402,7 @@ Viewer.prototype.removeLabel = function (label) {
|
|
|
label.dispose()
|
|
|
let index = this.labels.indexOf(label)
|
|
|
index > -1 && this.labels.splice(index)
|
|
|
- label.li.remove()
|
|
|
+ label.li && label.li.remove()
|
|
|
}
|
|
|
|
|
|
|