|
@@ -306,7 +306,7 @@ EditTools.prototype.initSaveAll = function() {
|
|
|
loadlogo: $("#loadlogo").is(':checked'),
|
|
|
special: $("#g_specialScene").is(':checked'),
|
|
|
vision_version: $("#twoData").is(':checked') ? "1.1.562.17209" : false,
|
|
|
-
|
|
|
+ roomLabels: that.editLabel.getSavingInfo(),
|
|
|
/************************************** 方奕卓 场景可配置项 ******************************************/
|
|
|
hotImageScale: $("#hotImgScale").is(':checked'),
|
|
|
// 热点图片可放大
|
|
@@ -352,8 +352,7 @@ EditTools.prototype.initSaveAll = function() {
|
|
|
var data = {
|
|
|
sceneCode: number,
|
|
|
hots: reData(that.hotpoint.getSavingInfo(), '{}'),
|
|
|
- //tourAudio: reData(that.editGuide.tourAudio,'{}'),//for 旧版
|
|
|
- roomLabels: that.editLabel.getSavingInfo(),
|
|
|
+ //tourAudio: reData(that.editGuide.tourAudio,'{}'),//for 旧版
|
|
|
name: number,
|
|
|
guides: reData(guides, '[]'),
|
|
|
info: info,
|
|
@@ -401,6 +400,8 @@ class EditLabel{
|
|
|
}
|
|
|
|
|
|
init(){
|
|
|
+ player.model.roomLabels.forEach(e=>this.addLebelEvent(e))
|
|
|
+
|
|
|
|
|
|
$('.toolRight .roomLabels .addBtn button').on('click',()=>{//准备添加
|
|
|
if(this.editingLabel){
|
|
@@ -425,69 +426,18 @@ class EditLabel{
|
|
|
position.y += 0.5
|
|
|
//var floorIndex = player.model.allFloorsVisible ? null : player.model.currentFloor.floorIndex
|
|
|
var floorIndex = intersect.object.parent.parent.floorIndex
|
|
|
- var label = new RoomLabel({position, title:'' , domElement:$(".widgets-doll-labels")[0], shelterByModel:true , autoUpdate : true, floorIndex/* , modes:[] */
|
|
|
- ,clickFun:()=>{
|
|
|
+ var label = new RoomLabel({position, title:'' , floorIndex/* , modes:[] */
|
|
|
+ /* ,clickFun:()=>{
|
|
|
if(this.editing){
|
|
|
this.setEditLabel(true,label)
|
|
|
}
|
|
|
- }
|
|
|
+ } */
|
|
|
})
|
|
|
player.model.roomLabels.push(label)
|
|
|
this.setAddState(false)
|
|
|
this.setEditLabel(true, label) //开始编辑
|
|
|
+ this.addLebelEvent(label)
|
|
|
|
|
|
-
|
|
|
- //拖拽
|
|
|
- {
|
|
|
- let dragElemShift = {}
|
|
|
- let dragging = false
|
|
|
- const startDrag = (evt) => {
|
|
|
- dragging = true
|
|
|
- $('#player').on("mousemove", drag);
|
|
|
-
|
|
|
- if(player.mode != 'floorplan'){ //换算到elem的底部
|
|
|
- let lebelWidth = label.elem.children(0).width()
|
|
|
- let lebelHeight = label.elem.children(0).height() * (68+24) / 24 ;//
|
|
|
- dragElemShift = {x: -evt.offsetX + lebelWidth/2, y: 100 /* -evt.offsetY + lebelHeight */} //y向不准确,因为原本添加时提高了0.5,而0.5对应的像素需要根据视角,那就算了吧
|
|
|
- }else{
|
|
|
- dragElemShift = {x:0,y:0}
|
|
|
- }
|
|
|
-
|
|
|
- CursorDeal.add('moveLabel')
|
|
|
- };
|
|
|
-
|
|
|
- const endDrag = (evt) => {
|
|
|
- dragging = false
|
|
|
-
|
|
|
- $('#player').off("mousemove", drag);
|
|
|
-
|
|
|
- CursorDeal.remove('moveLabel')
|
|
|
- };
|
|
|
-
|
|
|
- const drag = (evt) => {
|
|
|
- if (dragging) {
|
|
|
-
|
|
|
- evt.preventDefault();
|
|
|
- let mouse = new THREE.Vector3()
|
|
|
- let meshes = player.model.allFloorsVisible ? player.model.colliders : player.model.currentFloor.collider.children
|
|
|
- math.convertScreenPositionToNDC(evt.offsetX+dragElemShift.x, evt.offsetY+dragElemShift.y, mouse);
|
|
|
- var intersect = convertTool.getMouseIntersect(player.camera, meshes, mouse)
|
|
|
- if(intersect){
|
|
|
- let position = intersect.point.clone()
|
|
|
- position.y += 0.5
|
|
|
- label.setPos(position)
|
|
|
- var floorIndex = intersect.object.parent.parent.floorIndex
|
|
|
- label.floorIndex = floorIndex
|
|
|
- }
|
|
|
- //this.dispatchEvent({type:'dragged', position: this.position})
|
|
|
-
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- label.elem.on('mousedown', startDrag);
|
|
|
- $(document).on('mouseup', endDrag);
|
|
|
- $("#player").on('mouseup', endDrag);
|
|
|
- }
|
|
|
|
|
|
|
|
|
this.adding = false
|
|
@@ -531,15 +481,76 @@ class EditLabel{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ addLebelEvent(label){
|
|
|
+ //拖拽
|
|
|
+ let dragElemShift = {}
|
|
|
+ let dragging = false
|
|
|
+ const startDrag = (evt) => {
|
|
|
+ dragging = true
|
|
|
+ $('#player').on("mousemove", drag);
|
|
|
+
|
|
|
+ if(player.mode != 'floorplan'){ //换算到elem的底部
|
|
|
+ let lebelWidth = label.elem.children(0).width()
|
|
|
+ let lebelHeight = label.elem.children(0).height() * (68+24) / 24 ;//
|
|
|
+ dragElemShift = {x: -evt.offsetX + lebelWidth/2, y: 100 /* -evt.offsetY + lebelHeight */} //y向不准确,因为原本添加时提高了0.5,而0.5对应的像素需要根据视角,那就算了吧
|
|
|
+ }else{
|
|
|
+ dragElemShift = {x:0,y:0}
|
|
|
+ }
|
|
|
+
|
|
|
+ CursorDeal.add('moveLabel')
|
|
|
+ };
|
|
|
+
|
|
|
+ const endDrag = (evt) => {
|
|
|
+ dragging = false
|
|
|
+
|
|
|
+ $('#player').off("mousemove", drag);
|
|
|
+
|
|
|
+ CursorDeal.remove('moveLabel')
|
|
|
+ };
|
|
|
+
|
|
|
+ const drag = (evt) => {
|
|
|
+ if (dragging) {
|
|
|
+
|
|
|
+ evt.preventDefault();
|
|
|
+ let mouse = new THREE.Vector3()
|
|
|
+ let meshes = player.model.allFloorsVisible ? player.model.colliders : player.model.currentFloor.collider.children
|
|
|
+ math.convertScreenPositionToNDC(evt.offsetX+dragElemShift.x, evt.offsetY+dragElemShift.y, mouse);
|
|
|
+ var intersect = convertTool.getMouseIntersect(player.camera, meshes, mouse)
|
|
|
+ if(intersect){
|
|
|
+ let position = intersect.point.clone()
|
|
|
+ position.y += 0.5
|
|
|
+ label.setPos(position)
|
|
|
+ var floorIndex = intersect.object.parent.parent.floorIndex
|
|
|
+ label.floorIndex = floorIndex
|
|
|
+ }
|
|
|
+ //this.dispatchEvent({type:'dragged', position: this.position})
|
|
|
+
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ label.elem.on('mousedown', startDrag);
|
|
|
+ $(document).on('mouseup', endDrag);
|
|
|
+ $("#player").on('mouseup', endDrag);
|
|
|
+
|
|
|
+ //点击编辑:
|
|
|
+ label.elem.on('click',(e)=>{
|
|
|
+ if(this.editing){
|
|
|
+ this.setEditLabel(true,label)
|
|
|
+ }
|
|
|
+ e.stopPropagation()
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
enter(){
|
|
|
this.editing = true
|
|
|
-
|
|
|
+ player.roomLebelClickUnabled = true
|
|
|
|
|
|
}
|
|
|
leave(){
|
|
|
this.editing = false
|
|
|
this.editingLabel && this.setEditLabel(false, this.editingLabel)
|
|
|
-
|
|
|
+ player.roomLebelClickUnabled = false
|
|
|
}
|
|
|
|
|
|
getSavingInfo(){
|