修复开窗坐标错误的BUG

This commit is contained in:
fangxiang 2021-08-11 10:56:22 +08:00
parent e422439a2e
commit 8464933057
4 changed files with 33 additions and 17 deletions

View File

@ -35,14 +35,24 @@ export default class ClientConnection {
return this._is_login;
}
private _destoryWS() {
this._destoryed = true;
if (this.ws) {
this.ws.onclose = null;
this.ws.onerror = null;
this.ws.onopen = null;
this.ws.onmessage = null;
}
this.ws?.close();
this.ws = null;
}
public reconnectTo(
url: string,
user_name?: string | null,
password?: string | null
) {
if (this._destoryed) {
this.ws?.close();
this.ws = null;
this._destoryWS();
return;
}
this.url = url;
@ -76,8 +86,7 @@ export default class ClientConnection {
login() {
if (this._destoryed) {
this.ws?.close();
this.ws = null;
this._destoryWS();
return;
}
if (this.is_connected) {
@ -102,8 +111,7 @@ export default class ClientConnection {
private _reconnect() {
if (this._destoryed) {
this.ws?.close();
this.ws = null;
this._destoryWS();
return;
}
if (
@ -123,8 +131,7 @@ export default class ClientConnection {
onOpen(ev: Event) {
if (this._destoryed) {
this.ws?.close();
this.ws = null;
this._destoryWS();
return;
}
@ -134,8 +141,7 @@ export default class ClientConnection {
onMessage(ev: MessageEvent) {
if (this._destoryed) {
this.ws?.close();
this.ws = null;
this._destoryWS();
return;
}
try {

View File

@ -122,7 +122,7 @@
</template>
<script lang="ts">
import { defineComponent, computed } from "vue";
import { defineComponent, computed, onMounted, ref, nextTick } from "vue";
import { useStore } from "src/store";
import { SignalSourceTreeItemEntity } from "src/entities/SignalSourceEntity";
import GroupDialog from "src/components/GroupDialog.vue";
@ -147,7 +147,18 @@ export default defineComponent({
set: (val) => $store.commit("setSignalSourceTree", val),
});
const tree: any | null = ref(null);
onMounted(async () => {
while (!tree.value.nodes.length) {
await Common.waitFor(100);
}
tree.value?.setExpanded("", true);
});
return {
est() {},
tree,
tree_nodes,
loga(a: any) {
console.log(a);

View File

@ -403,17 +403,17 @@ export default defineComponent({
let signal_source = signal_sources[0];
if (signal_source) {
let dom: HTMLElement | null = e.target as HTMLElement;
if (dom) {
if (wall.value && dom) {
if (dom.classList.contains("wall_item_flag")) {
console.log(wall.value.offsetTop);
console.log(wall.value.offsetLeft);
GlobalData.getInstance()
.getCurrentClient()
?.openWindow(
new Protocol.OpenWindowRequestEntity(
signal_source.uuid,
(dom.offsetLeft - (wall.value?.offsetLeft ?? 0)) *
wall_width_scaler.value,
(dom.offsetTop - (wall.value?.offsetTop ?? 0)) *
wall_height_scaler.value,
dom.offsetLeft * wall_width_scaler.value,
dom.offsetTop * wall_height_scaler.value,
dom.offsetWidth * wall_width_scaler.value,
dom.offsetHeight * wall_height_scaler.value
)

View File

@ -235,7 +235,6 @@ export default store(function (/* { ssrContext } */) {
state.signal_source_tree.push(root);
buildGroup(root, signal_source_groups, signal_sources);
console.log(state.signal_source_tree);
} else {
console.error(playload);
}