|
@@ -121,7 +121,7 @@ export const enter = (dom, isLocal) => {
|
|
var camera = viewport.camera
|
|
var camera = viewport.camera
|
|
var dom = viewer.renderArea
|
|
var dom = viewer.renderArea
|
|
if(tagLimitDis != void 0){
|
|
if(tagLimitDis != void 0){
|
|
- if(camera.position.distanceTo(worldPos) > tagLimitDis)return false
|
|
|
|
|
|
+ if(camera.position.distanceToSquared(worldPos) > Math.pow(tagLimitDis,2))return false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -451,13 +451,26 @@ export const enter = (dom, isLocal) => {
|
|
model.addEventListener('changeSelect',(e)=>{
|
|
model.addEventListener('changeSelect',(e)=>{
|
|
bus.emit('changeSelect',e.selected)
|
|
bus.emit('changeSelect',e.selected)
|
|
})
|
|
})
|
|
|
|
+
|
|
|
|
+ let lastState={ }
|
|
model.addEventListener('transformChanged',(e)=>{
|
|
model.addEventListener('transformChanged',(e)=>{
|
|
- bus.emit('transformChanged', {
|
|
|
|
- position : model.position.clone(),
|
|
|
|
- scale: model.scale.x * 100,
|
|
|
|
- rotation: model.rotation.clone(),
|
|
|
|
- bottom: model.btmHeight
|
|
|
|
- })
|
|
|
|
|
|
+ //console.log('transformChanged',model.position,model.scale.x, model.rotation,model.btmHeight)
|
|
|
|
+ let msg = {}
|
|
|
|
+ if(!lastState.position || !model.position.equals(lastState.position)){
|
|
|
|
+ lastState.position = msg.position = model.position.clone()
|
|
|
|
+ }
|
|
|
|
+ if(!lastState.rotation || !model.rotation.equals(lastState.rotation)){
|
|
|
|
+ lastState.rotation = msg.rotation = model.rotation.clone()
|
|
|
|
+ }
|
|
|
|
+ if(lastState.scale == void 0 || model.scale.x * 100 != lastState.scale){
|
|
|
|
+ lastState.scale = msg.scale = model.scale.x * 100
|
|
|
|
+ }
|
|
|
|
+ if(lastState.bottom == void 0 || model.btmHeight != lastState.bottom){
|
|
|
|
+ lastState.bottom = msg.bottom = model.btmHeight
|
|
|
|
+ }
|
|
|
|
+ msg = Potree.Common.CloneObject(msg)
|
|
|
|
+ console.log(msg)
|
|
|
|
+ bus.emit('transformChanged', msg )
|
|
})
|
|
})
|
|
spliceFromArr(model,true)
|
|
spliceFromArr(model,true)
|
|
bus.emit('loadDone')
|
|
bus.emit('loadDone')
|
|
@@ -523,6 +536,7 @@ export const enter = (dom, isLocal) => {
|
|
|
|
|
|
},
|
|
},
|
|
changeBottom(z){
|
|
changeBottom(z){
|
|
|
|
+ console.log('changeBottom',z)
|
|
model && MergeEditor.setModelBtmHeight(model,z)
|
|
model && MergeEditor.setModelBtmHeight(model,z)
|
|
model.dispatchEvent('transformChanged') //改了position */
|
|
model.dispatchEvent('transformChanged') //改了position */
|
|
},
|
|
},
|
|
@@ -531,6 +545,7 @@ export const enter = (dom, isLocal) => {
|
|
//if(MergeEditor.selected == model){
|
|
//if(MergeEditor.selected == model){
|
|
//console.log('pos',pos.x, pos.y, pos.z)
|
|
//console.log('pos',pos.x, pos.y, pos.z)
|
|
//}
|
|
//}
|
|
|
|
+ console.log('changePosition',pos.x, pos.y, pos.z)
|
|
model && model.position.copy(pos)
|
|
model && model.position.copy(pos)
|
|
model.dispatchEvent({type:'position_changed'})
|
|
model.dispatchEvent({type:'position_changed'})
|
|
},
|
|
},
|
|
@@ -538,7 +553,7 @@ export const enter = (dom, isLocal) => {
|
|
//if(MergeEditor.selected == model){
|
|
//if(MergeEditor.selected == model){
|
|
//console.log('rot', rot.x, rot.y, rot.z)
|
|
//console.log('rot', rot.x, rot.y, rot.z)
|
|
//}
|
|
//}
|
|
-
|
|
|
|
|
|
+ console.log('changeRotation',rot.x, rot.y, rot.z)
|
|
model && model.rotation.setFromVector3(rot)
|
|
model && model.rotation.setFromVector3(rot)
|
|
model.dispatchEvent({type:'rotation_changed'})
|
|
model.dispatchEvent({type:'rotation_changed'})
|
|
},
|
|
},
|