Kaynağa Gözat

移动缩放动作连通接口

liuwei 4 yıl önce
ebeveyn
işleme
ae582ffb52

+ 20 - 11
src/renderer/components/BigShow.vue

@@ -25,7 +25,7 @@
                     @dragstop="(position) => dragStop(position,itemV,bigScreenObj,curOpeBigscreenId)"
                     @resizestop="(size) => resizeSignal(size,itemV,bigScreenObj,curOpeBigscreenId)"
             >
-                <div ref="signal">
+                <div ref="signal" :id="itemV.ID">
                     {{itemV.deviceID}}
                     <!--<VideoPlayer
                             ref="videoPlayer"
@@ -137,10 +137,10 @@
                         heightScale:item.heightScale,
                         orginRect:{}
                     }))
-                    /*console.log({
+                    console.log({
                         bigScreenId:Id,
                         streamWindows
-                    })*/
+                    })
                     await reqRefreshView({
                         bigScreenId:Id,
                         streamWindows
@@ -150,20 +150,29 @@
 
             // 拖动结束
             dragStop(positon,item,obj,Id) {
-                /*item.left = positon.left
+                // 深度克隆对象
+                const newObj = JSON.parse(JSON.stringify(obj))
+                item.left = positon.left
                 item.top = positon.top
-                const arr = obj[Id].signalArr.filter(s => s.Id !== item.Id)
-                obj[Id].signalArr = [...arr,item]
-                this.refreshBigScreen(obj,Id)*/
+                const arr = newObj[Id].signalArr.filter(s => s.Id !== item.Id)
+                newObj[Id].signalArr = [...arr,item]
+                this.refreshBigScreen(newObj,Id)
             },
 
             // 缩放结束
             resizeSignal(size,item,obj,Id) {
-                /*item.width = size.width
+                const bigScale = this.$store.state.bigScale
+                // 深度克隆对象
+                const newObj = JSON.parse(JSON.stringify(obj))
+                item.width = size.width
                 item.height = size.height
-                const arr = obj[Id].signalArr.filter(s => s.Id !== item.Id)
-                obj[Id].signalArr = [...arr,item]
-                this.refreshBigScreen(obj,Id)*/
+                item.left = size.left
+                item.top = size.top
+                item.widthScale = item.width/(newObj[Id].width*bigScale)
+                item.heightScale = item.height/(newObj[Id].height*bigScale)
+                const arr = newObj[Id].signalArr.filter(s => s.Id !== item.Id)
+                newObj[Id].signalArr = [...arr,item]
+                this.refreshBigScreen(newObj,Id)
             },
 
             // 关闭信号源

+ 0 - 1
src/renderer/components/Button.vue

@@ -14,7 +14,6 @@
                     fontSize:item.FontSize*bigScale + 'px',
                     backgroundSize:'100% 100%',
                     backgroundRepeat:'no-repeat',
-                    backgroundImage:item.BackIcon ? 'url('+require(`../../../static/Data/${item.BackIcon}`)+')' : null,
                     backgroundColor:item.BackIcon ? null : `#${item.BrackgroupStr.slice(3)}`,
                     color:`#${item.ForegroundStr.slice(3)}`,
                     textAlign:'center',

+ 0 - 17
src/utils/tools.js

@@ -178,21 +178,4 @@ export function elePosition(width,height,count,top,left,splitNum) {
     }
 }
 
-// 深度克隆对象
-export function newobj(obj) {
-    var str, newobj = obj.constructor === Array ? [] : {};//constructor 属性返回对创建此对象的数组函数的引用。创建相同类型的空数据
-    if (typeof obj !== 'object') {
-        return;
-    } else {
-        for (var i in obj) {
-            if (typeof obj[i] === 'object'){//判断对象的这条属性是否为对象
-                newobj[i] = newObj(obj[i]);//若是对象进行嵌套调用
-            }else{
-                newobj[i] = obj[i];
-            }
-        }
-    }
-    return newobj;//返回深度克隆后的对象
-}
-