diff --git a/src/components/ControlPanelDialog.vue b/src/components/ControlPanelDialog.vue index 850a5c4..77e563e 100644 --- a/src/components/ControlPanelDialog.vue +++ b/src/components/ControlPanelDialog.vue @@ -40,6 +40,23 @@ //ctrl multiple = true; } + //对齐 + if (evt.keyCode == 87 && multiple_select.length > 1) { + //上 + alignTop(); + } + if (evt.keyCode == 83 && multiple_select.length > 1) { + //下 + alignBottom(); + } + if (evt.keyCode == 65 && multiple_select.length > 1) { + //左 + alignLeft(); + } + if (evt.keyCode == 68 && multiple_select.length > 1) { + //右 + alignRight(); + } } " @keyup=" @@ -332,8 +349,8 @@ {{ item.uuid }} x:{{ item.centerx }} y:{{ item.centery }} - - W:{{ filter_px(item.w) }}H:{{ filter_px(item.h) }} + @@ -368,9 +385,9 @@ val.toString().length > 0) || $t('Please type something'), (val) => - parseInt(val) >= 0 || + parseInt(val) >= 1 || $t('the number must be greater than 0'), - (val) => + (val) => parseInt(val) <= 3840 || $t('the number must be less than 3840'), ]" @@ -409,9 +426,9 @@ val.toString().length > 0) || $t('Please type something'), (val) => - parseInt(val) >= 0 || + parseInt(val) >= 1 || $t('the number must be greater than 0'), - (val) => + (val) => parseInt(val) <= 2160 || $t('the number must be less than 2160'), ]" @@ -477,10 +494,14 @@ > {{ test_monitor_list[(item - 1) * 4 + (j - 1)].uuid }} W:{{ - filter_px(test_monitor_list[(item - 1) * 4 + (j - 1)].cmw) + filter_px( + test_monitor_list[(item - 1) * 4 + (j - 1)].cmw + ) }} H:{{ - filter_px(test_monitor_list[(item - 1) * 4 + (j - 1)].cmh) + filter_px( + test_monitor_list[(item - 1) * 4 + (j - 1)].cmh + ) }} @@ -513,10 +534,14 @@ > {{ test_monitor_list[(item - 1) * 4 + (j - 1)].uuid }} W:{{ - filter_px(test_monitor_list[(item - 1) * 4 + (j - 1)].cmw) + filter_px( + test_monitor_list[(item - 1) * 4 + (j - 1)].cmw + ) }} H:{{ - filter_px(test_monitor_list[(item - 1) * 4 + (j - 1)].cmh) + filter_px( + test_monitor_list[(item - 1) * 4 + (j - 1)].cmh + ) }} @@ -632,8 +657,8 @@ class test_monitor { angle = 0; id = 0; resize = 0.0; - resizew=0.0; - resizeh=0.0 + resizew = 0.0; + resizeh = 0.0; isHide = false; isShow = false; reset() { @@ -654,8 +679,8 @@ class test_monitor { this.isHide = false; //列表隐藏 this.isShow = false; //墙显示 this.resize = 0.0; - this.resizew=0.0; - this.resizeh=0.0; + this.resizew = 0.0; + this.resizeh = 0.0; this.InitialW = 0; this.InitialW = 0; this.startw = 0.0; @@ -797,6 +822,7 @@ export default defineComponent({ ); num--; } + getpx() } } const cloud_monitor_list = new MagicWallConfig(); @@ -825,48 +851,32 @@ export default defineComponent({ } }); } - if(client){ - const setMagic = await client.setMagicWallConfig(cloud_monitor_list); - if(!setMagic?.success){ - $q.notify({ - color: "negative", - icon: "warning", - message: - $t.t("update magic wall") + - $t.t("fail") + - "!", - position: "top", - timeout: 2500, - }); - } + if (client) { + // const setMagic = await client.setMagicWallConfig(cloud_monitor_list); + // if(!setMagic?.success){ + // $q.notify({ + // color: "negative", + // icon: "warning", + // message: + // $t.t("update magic wall") + + // $t.t("fail") + + // "!", + // position: "top", + // timeout: 2500, + // }); + // } } }; const getpx = () => { const wall_dom = wall.value; - if(wall_dom){ - lcm.value = (wall_dom.offsetWidth*0.5/1214); - // console.log(lcm.value) + if (wall_dom) { + lcm.value = (wall_dom.offsetWidth * 0.5) / 1214; test_monitor_list.value.forEach((ele) => { - ele.cmw = ele.w /lcm.value; - ele.cmh = ele.h /lcm.value; - }); + ele.cmw = Math.round(ele.w / lcm.value); + ele.cmh = Math.round(ele.h / lcm.value); + }); } - }; - const getsize=(item:test_monitor)=>{ - const wall_dom = wall.value; - if(wall_dom){ - // item.w=item.w/3840*wall_dom.offsetWidth; - // item.h=item.h/2160*wall_dom.offsetHeight; - } - } - const setsize=(item:test_monitor)=>{ - const wall_dom = wall.value; - if(wall_dom){ - // item.w=item.w/wall_dom.offsetWidth*3840; - // item.h=item.h/wall_dom.offsetHeight*2160; - } - } const radians = () => { const item = test_monitor_wall.value[current_index.value]; return /*a*/ (item.angle * Math.PI) / 180; @@ -1164,7 +1174,7 @@ export default defineComponent({ EventBus.getInstance().on(EventNamesDefine.WindowResize, () => { const wall_dom = wall.value; if (wall_dom) { - getpx() + getpx(); let size_h = offsetHeight.value / wall_dom.offsetHeight; let size_w = offsetWidth.value / wall_dom.offsetWidth; test_monitor_wall.value.forEach((element) => { @@ -1185,8 +1195,6 @@ export default defineComponent({ }); return { getpx, - getsize, - setsize, lcm, model, options, @@ -1423,11 +1431,10 @@ export default defineComponent({ const wall_dom = wall.value; item.isShow = true; if (wall_dom) { - getsize(item) item.InitialH = item.h; item.InitialW = item.w; item.resizew = item.w / wall_dom.offsetWidth; - item.resizeh=item.h / wall_dom.offsetHeight; + item.resizeh = item.h / wall_dom.offsetHeight; item.h = item.InitialH * percenter.value; item.w = item.InitialW * percenter.value; if (item.currentx > wall_dom?.offsetWidth - item.w) { @@ -1460,6 +1467,7 @@ export default defineComponent({ } } }, + onDragEnter(e: DragEvent, index: string) { e.stopPropagation(); let target: HTMLElement | null = e.target as HTMLElement; @@ -1486,9 +1494,8 @@ export default defineComponent({ }, closeWindow(item: test_monitor, index: number) { current_index.value = -1; - setsize(item) - item.cmw = item.w /lcm.value; - item.cmh = item.h / lcm.value; + item.cmw = Math.round(item.w / lcm.value); + item.cmh = Math.round(item.h / lcm.value); test_monitor_list.value[item.id] = JSON.parse( JSON.stringify(test_monitor_wall.value[index]) ); @@ -1500,9 +1507,8 @@ export default defineComponent({ closeOtherWindows(item: test_monitor, index: number) { current_index.value = index; test_monitor_wall.value.forEach((ele) => { - setsize(ele) - ele.cmh = ele.h /lcm.value; - ele.cmw = ele.w /lcm.value; + ele.cmh = Math.round(ele.h / lcm.value); + ele.cmw = Math.round(ele.w / lcm.value); test_monitor_list.value[ele.id] = JSON.parse(JSON.stringify(ele)); }); test_monitor_list.value.forEach((element) => { @@ -1518,9 +1524,8 @@ export default defineComponent({ closeAllWindows() { current_index.value = -1; test_monitor_wall.value.forEach((ele) => { - setsize(ele) - ele.cmh = ele.h /lcm.value; - ele.cmw = ele.w /lcm.value; + ele.cmh = Math.round(ele.h / lcm.value); + ele.cmw = Math.round(ele.w / lcm.value); test_monitor_list.value[ele.id] = JSON.parse(JSON.stringify(ele)); }); test_monitor_list.value.forEach((element) => { @@ -1551,7 +1556,7 @@ export default defineComponent({ return tep.starth * 0.4 + "px"; }, show_box_line_height(height: number) { - return height * 0.3 + "px"; + return height * 0.5 + "px"; }, center_x() { const wall_dom = wall.value; @@ -1736,12 +1741,53 @@ export default defineComponent({ changewidth() { let item = test_monitor_list.value[monitor_list_current_index.value]; item.w = Number(item.cmw) * lcm.value; - // console.log(item.w) }, changeHeight() { let item = test_monitor_list.value[monitor_list_current_index.value]; item.h = item.cmh * lcm.value; }, + alignTop() { + let item=test_monitor_wall.value[multiple_select.value[0]]; + multiple_select.value.forEach((element) => { + if (element != -1) { + let tep_item = test_monitor_wall.value[element]; + tep_item.currenty = item.currenty; + } + }); + + realtime_upload(); + }, + alignBottom() { + let item=test_monitor_wall.value[multiple_select.value[0]]; + multiple_select.value.forEach((element) => { + if (element != -1) { + let tep_item = test_monitor_wall.value[element]; + tep_item.currenty = item.currenty+item.h-tep_item.h; + } + }); + realtime_upload(); + }, + alignRight() { + let item=test_monitor_wall.value[multiple_select.value[0]]; + multiple_select.value.forEach((element) => { + if (element != -1) { + let tep_item = test_monitor_wall.value[element]; + tep_item.currentx = item.currentx+item.w-tep_item.w; + } + }); + + realtime_upload(); + }, + alignLeft() { + let item=test_monitor_wall.value[multiple_select.value[0]]; + multiple_select.value.forEach((element) => { + if (element != -1) { + let tep_item = test_monitor_wall.value[element]; + tep_item.currentx = item.currentx; + } + }); + realtime_upload(); + }, }; }, }); diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index f1e9110..ada3458 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -403,6 +403,7 @@ export default { "Please Input Vaild Host. Example: 192.168.1.1 or 192.168.1.1:8080", "equipment data": "Equipment Data", "set magic wall":"Set Magic wall", + "update magic wall":"Update Magic Wall", "magic wall":"Magic Wall", "angle":"Angle", "topology diagram":"Topology Diagram", diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index f038641..e2a6a65 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -669,6 +669,7 @@ export default { "edit user or password": "修改用户名和密码", "old password error": "旧密码不匹配", "set magic wall":"设置魔墙", + "update magic wall":"更新魔墙", "magic wall":"魔墙", "angle":"角度", "topology diagram":"拓扑图",