|
@@ -1073,13 +1073,19 @@ Hotpoint.prototype.init = function() {
|
|
|
|
|
|
s = Math.max(0.001, s)
|
|
|
|
|
|
+ let sid = player.mode == 'panorama' ? player.currentPano.id : "outside";
|
|
|
+
|
|
|
+
|
|
|
player.model.hotGroup.children.forEach(hot=>{
|
|
|
if(hot.texType == 'shine'){
|
|
|
- hot.info.scale.multiplyScalar(s)
|
|
|
- hot.scale.multiplyScalar(s)
|
|
|
+ hot.info.scale.multiplyScalar(s)
|
|
|
+ let s1 = hot.info.transformAtPanos[sid] ?.scale //跳过独立调整的
|
|
|
+ s1 || hot.scale.multiplyScalar(s)
|
|
|
}
|
|
|
})
|
|
|
- DATA.hotIconScale *= s
|
|
|
+
|
|
|
+
|
|
|
+ DATA.hotIconScale *= s //没用,兼容旧版代码
|
|
|
|
|
|
})
|
|
|
|
|
@@ -1099,7 +1105,7 @@ Hotpoint.prototype.init = function() {
|
|
|
if(checked) {
|
|
|
that.editSpot.update(player)
|
|
|
}else{
|
|
|
- that.editSpot.rotation.copy(that.editSpot.info.rotation)
|
|
|
+ that.editSpot.quaternion.copy(that.editSpot.info.quaternion)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -1278,9 +1284,10 @@ Hotpoint.prototype.init = function() {
|
|
|
if(!checked){
|
|
|
delete this.editSpot.info.transformAtPanos[getTransformSid()]
|
|
|
this.editSpot.position.copy(this.editSpot.info.position)
|
|
|
- //this.editSpot.quaternion.copy(this.editSpot.quaternion)
|
|
|
+ this.editSpot.quaternion.copy(this.editSpot.info.quaternion)
|
|
|
+ this.editSpot.scale.copy(this.editSpot.info.scale)
|
|
|
}else{
|
|
|
- this.getTransformAtPano('position')
|
|
|
+ this.getTransformAtPano(['position'])
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1293,7 +1300,7 @@ Hotpoint.prototype.init = function() {
|
|
|
this.editSpot.position.copy(this.editSpot.info.position)
|
|
|
//this.editSpot.quaternion.copy(this.editSpot.quaternion)
|
|
|
}else{
|
|
|
- this.getTransformAtPano('position')
|
|
|
+ this.getTransformAtPano(['position'])
|
|
|
}
|
|
|
}) */
|
|
|
|
|
@@ -1810,7 +1817,7 @@ Hotpoint.prototype.getTempInfos = function(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-Hotpoint.prototype.getTransformAtPano = function(type){
|
|
|
+Hotpoint.prototype.getTransformAtPano = function(types){
|
|
|
/* var name = getTransformSid()
|
|
|
var info = {
|
|
|
pos : this.editSpot.mesh.position.clone()
|
|
@@ -1825,30 +1832,36 @@ Hotpoint.prototype.getTransformAtPano = function(type){
|
|
|
|
|
|
|
|
|
var name = getTransformSid()
|
|
|
- this.editSpot.info.transformAtPanos[name] = {
|
|
|
- pos : this.editSpot.position.clone()
|
|
|
+ let info = {
|
|
|
+ pos : this.editSpot.position.clone(),
|
|
|
+ scale : this.editSpot.scale.clone()
|
|
|
}
|
|
|
+ hot.isSprite || (info.qua = this.editSpot.quaternion.clone())
|
|
|
+
|
|
|
+ this.editSpot.info.transformAtPanos[name] = info
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-Hotpoint.prototype.updateTransform = function(type){
|
|
|
+Hotpoint.prototype.updateTransform = function(types=['position','quaternion','scale']){
|
|
|
var on = this.panoTransformCheckBox.checked() //$('#setPosForPano input').is(':checked')
|
|
|
//var name = getTransformSid()
|
|
|
- if(on && type == 'position'){
|
|
|
- this.getTransformAtPano(type)
|
|
|
+ if(on ){
|
|
|
+ this.getTransformAtPano(types)
|
|
|
}else{
|
|
|
- if(type == 'position'){
|
|
|
+ if(types.includes('position')){
|
|
|
this.editSpot.info.position.copy(this.editSpot.position)
|
|
|
- }else if(type == 'quaternion'){
|
|
|
+ }else if(types.includes('quaternion')){
|
|
|
if(!this.editSpot.isSprite){ //如果恒朝向相机就不保存quaternion
|
|
|
- this.editSpot.info.rotation.copy(this.editSpot.rotation)
|
|
|
+ this.editSpot.info.quaternion.copy(this.editSpot.quaternion)
|
|
|
}
|
|
|
- }else if(type == 'scale'){
|
|
|
+ }else if(types.includes('scale')){
|
|
|
this.editSpot.info.scale.copy(this.editSpot.scale)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- type == 'position' && this.updateDis()
|
|
|
+ types.includes('position') && this.updateDis()
|
|
|
}
|
|
|
|
|
|
Hotpoint.prototype.updatePano = function(){
|
|
@@ -2640,7 +2653,7 @@ Hotpoint.prototype.initListSelect = function(){//热点样式图列表
|
|
|
{//adjustModelAuto
|
|
|
let bound = new THREE.Box3
|
|
|
object.traverse( function ( child ) {
|
|
|
- if(child.geometry){
|
|
|
+ if(child.geometry){//会不会有child自带了一层matrix呢?如果有要乘以matrix。
|
|
|
child.geometry.computeBoundingBox();
|
|
|
bound.union(child.geometry.boundingBox)
|
|
|
}
|
|
@@ -2738,9 +2751,9 @@ Hotpoint.prototype.switchModel = function(o={}){
|
|
|
o.spot.info.objName = o.add.name
|
|
|
o.spot.info.modelBound = o.add.modelBound;
|
|
|
o.spot.addModel(model)
|
|
|
- var s = 1;//暂时
|
|
|
- o.spot.scale.set(s,s,s)//恢复成等大比例,方便用户看清原始比例
|
|
|
- o.spot.info.scale.set(s,s,s)
|
|
|
+ /* var s = 1;//暂时
|
|
|
+ o.spot.scale.set(s,s,s)//恢复成等大比例,方便用户看清原始比例. 但是换obj后要重新设置大小所以取消
|
|
|
+ o.spot.info.scale.set(s,s,s) */
|
|
|
//this.updateTransform('scale')
|
|
|
if(o.spot == this.editSpot){
|
|
|
transformControls.enableScaleZ()
|
|
@@ -3655,14 +3668,14 @@ Hotpoint.prototype.ifNeedResetVisi = function(hot){//修改过贴图或位置或
|
|
|
var need = !ifSame({
|
|
|
hasBox: hot.tempInfo.hasBox,
|
|
|
position: hot.tempInfo.position,
|
|
|
- rotation: hot.tempInfo.rotation,
|
|
|
+ quaternion: hot.tempInfo.quaternion,
|
|
|
scale: hot.tempInfo.scale,
|
|
|
transformAtPanos: hot.tempInfo.transformAtPanos,
|
|
|
modelBound:hot.tempInfo.modelBound
|
|
|
}, {
|
|
|
hasBox: hot.info.hasBox,
|
|
|
position: hot.info.position,
|
|
|
- rotation: hot.info.rotation,
|
|
|
+ quaternion: hot.info.quaternion,
|
|
|
scale: hot.info.scale,
|
|
|
transformAtPanos: hot.info.transformAtPanos,
|
|
|
modelBound:hot.info.modelBound
|
|
@@ -3693,17 +3706,20 @@ Hotpoint.prototype.getSavingInfo = function(){//保存全部
|
|
|
|
|
|
hotData.position = toPrecision(hot.info.position.toArray(), 3)
|
|
|
hotData.scale = toPrecision(hot.info.scale.toArray(), 3)
|
|
|
- hotData.rotation = toPrecision(hot.info.rotation.toArray().slice(0,3), 4)
|
|
|
+ hotData.rotation = toPrecision(new THREE.Euler().setFromQuaternion(hot.info.quaternion).toArray().slice(0,3), 4)
|
|
|
hotData.order = index
|
|
|
|
|
|
hotData.transformAtPanos = {}
|
|
|
for(let i in hot.info.transformAtPanos){
|
|
|
hotData.transformAtPanos[i] = {
|
|
|
- pos : toPrecision(hot.info.transformAtPanos[i].pos.toArray(), 3),
|
|
|
+ pos : toPrecision(hot.info.transformAtPanos[i].pos.toArray(), 4),
|
|
|
+ }
|
|
|
+ if(hot.info.transformAtPanos[i].qua){
|
|
|
+ hotData.transformAtPanos[i].qua = toPrecision(hot.info.transformAtPanos[i].qua.toArray(), 5)
|
|
|
+ }
|
|
|
+ if(hot.info.transformAtPanos[i].scale){
|
|
|
+ hotData.transformAtPanos[i].scale = toPrecision(hot.info.transformAtPanos[i].scale.toArray(), 4)
|
|
|
}
|
|
|
- /* if(hot.transformAtPanos[i].qua){
|
|
|
- hotData.transformAtPanos[i].qua = toPrecision(hot.transformAtPanos[i].qua.toArray(), 5)
|
|
|
- } */
|
|
|
}
|
|
|
hotData.version = 'multi'
|
|
|
|
|
@@ -5227,6 +5243,44 @@ var initTransformCtl = function(THREE) {
|
|
|
transformControls.space = 'local'//为了在当前方向上平移
|
|
|
transformControls.setSize(1.5)
|
|
|
player.model.add(transformControls)
|
|
|
+
|
|
|
+
|
|
|
+ transformControls.addEventListener('positionChanged',()=>{
|
|
|
+ editTool.hotpoint.updateTransform('position');
|
|
|
+ })
|
|
|
+ transformControls.addEventListener('quaternionChanged',()=>{
|
|
|
+ editTool.hotpoint.updateTransform('quaternion');
|
|
|
+ })
|
|
|
+ transformControls.addEventListener('scaleChanged',()=>{
|
|
|
+ editTool.hotpoint.updateTransform('scale');
|
|
|
+ })
|
|
|
+
|
|
|
+ let history = new HistoryRecord({
|
|
|
+ applyData: (data)=>{
|
|
|
+ if(data.object.parent && data.object == editTool.hotpoint.editSpot ){
|
|
|
+ //data = Potree.Common.CloneObject(data) //避免使用后更改数据又被使用
|
|
|
+ data.matrix.decompose( data.object.position, data.object.quaternion, data.object.scale );
|
|
|
+ editTool.hotpoint.updateTransform()
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getData:(object)=>{
|
|
|
+ return {
|
|
|
+ object,
|
|
|
+ matrix: object.matrixWorld.clone(),
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ transformControls.addEventListener('mouseDown', ()=>{ //dragstart
|
|
|
+ history.beforeChange(transformControls.object)
|
|
|
+ })
|
|
|
+ transformControls.addEventListener('mouseUp',()=>{
|
|
|
+ history.afterChange(transformControls.object)
|
|
|
+ })
|
|
|
+ transformControls.history = history
|
|
|
+
|
|
|
|
|
|
/* $(".MenuOptions[name='transform'] li").on("click", (e)=>{
|
|
|
transformControls.transCtlChangeMode($(e.target).attr("index"))
|
|
@@ -5261,7 +5315,7 @@ var initTransformCtl = function(THREE) {
|
|
|
}
|
|
|
transformControls.scaleShowZ = false
|
|
|
}
|
|
|
-
|
|
|
+ editTool.transformControls = transformControls
|
|
|
}
|
|
|
|
|
|
|
|
@@ -6165,6 +6219,8 @@ var VisiSet = {
|
|
|
player.model.hots[i].material_.depthTest = false;
|
|
|
|
|
|
player.model.hots[i].position.copy(player.model.hots[i].info.position);//覆盖transformAtPanos
|
|
|
+ player.model.hots[i].scale.copy(player.model.hots[i].info.scale);//覆盖transformAtPanos
|
|
|
+
|
|
|
player.model.hots[i].update(player)
|
|
|
}
|
|
|
this.setDisplay(true)
|
|
@@ -6249,7 +6305,7 @@ var VisiSet = {
|
|
|
} */
|
|
|
for (let i in player.model.hots) {
|
|
|
player.model.hots[i].info.isSprite = player.model.hots[i]._isSprite;
|
|
|
- player.model.hots[i].info.isSprite || player.model.hots[i].rotation.copy(player.model.hots[i].info.rotation)
|
|
|
+ player.model.hots[i].info.isSprite || player.model.hots[i].quaternion.copy(player.model.hots[i].info.quaternion)
|
|
|
player.model.hots[i].material_.depthTest = true;
|
|
|
}
|
|
|
},
|