From 4c068f4a625846f5adf9b11165d8dab8e62f8521 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Tue, 7 Jun 2022 17:44:33 +0800 Subject: [PATCH] no message --- resources/assets/js/App.vue | 8 ++++---- .../assets/js/components/DragBallComponent.vue | 16 ++++++++-------- .../MDEditor/assets/js/codemirror/index.js | 4 ++-- .../js/pages/manage/components/TaskDetail.vue | 14 ++++++++------ resources/assets/js/store/state.js | 8 ++++---- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/resources/assets/js/App.vue b/resources/assets/js/App.vue index bc441dcc0..1bdcba851 100755 --- a/resources/assets/js/App.vue +++ b/resources/assets/js/App.vue @@ -151,10 +151,10 @@ export default { }, windowSizeListener() { - this.$store.state.windowWidth = window.outerWidth - this.$store.state.windowHeight = window.outerHeight - this.$store.state.windowLarge = window.outerWidth > 768 - this.$store.state.windowSmall = window.outerWidth <= 768 + this.$store.state.windowWidth = $A(window).width() + this.$store.state.windowHeight = $A(window).height() + this.$store.state.windowLarge = this.$store.state.windowWidth > 768 + this.$store.state.windowSmall = this.$store.state.windowWidth <= 768 }, windowScrollListener() { diff --git a/resources/assets/js/components/DragBallComponent.vue b/resources/assets/js/components/DragBallComponent.vue index 796fc5c61..fe4aab72f 100644 --- a/resources/assets/js/components/DragBallComponent.vue +++ b/resources/assets/js/components/DragBallComponent.vue @@ -182,13 +182,13 @@ export default { let top = e.clientY - this.record.y; if (left < 0) { left = 0 - } else if (left > (window.outerWidth - this.floatDrag.offsetWidth)) { - left = window.outerWidth - this.floatDrag.offsetWidth + } else if (left > (window.innerWidth - this.floatDrag.offsetWidth)) { + left = window.innerWidth - this.floatDrag.offsetWidth } if (top < 0) { top = 0 - } else if (top > (window.outerHeight - this.floatDrag.offsetHeight)) { - top = window.outerHeight - this.floatDrag.offsetHeight + } else if (top > (window.innerHeight - this.floatDrag.offsetHeight)) { + top = window.innerHeight - this.floatDrag.offsetHeight } this.left = left; this.top = top; @@ -219,13 +219,13 @@ export default { let top = touch.clientY - this.floatDrag.offsetHeight / 2; if (left < 0) { left = 0 - } else if (left > (window.outerWidth - this.floatDrag.offsetWidth)) { - left = window.outerWidth - this.floatDrag.offsetWidth + } else if (left > (window.innerWidth - this.floatDrag.offsetWidth)) { + left = window.innerWidth - this.floatDrag.offsetWidth } if (top < 0) { top = 0 - } else if (top > (window.outerHeight - this.floatDrag.offsetHeight)) { - top = window.outerHeight - this.floatDrag.offsetHeight + } else if (top > (window.innerHeight - this.floatDrag.offsetHeight)) { + top = window.innerHeight - this.floatDrag.offsetHeight } this.left = left; this.top = top; diff --git a/resources/assets/js/components/MDEditor/assets/js/codemirror/index.js b/resources/assets/js/components/MDEditor/assets/js/codemirror/index.js index 65a5d08a3..0d5ec3ce4 100644 --- a/resources/assets/js/components/MDEditor/assets/js/codemirror/index.js +++ b/resources/assets/js/components/MDEditor/assets/js/codemirror/index.js @@ -4317,7 +4317,7 @@ function maybeScrollWindow(cm, rect) { var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; if (rect.top + box.top < 0) { doScroll = true; - } else if (rect.bottom + box.top > (window.outerHeight || document.documentElement.clientHeight)) { + } else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; } if (doScroll != null && !phantom) { @@ -11172,7 +11172,7 @@ function findPosH(doc, pos, dir, unit, visually) { function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y; if (unit == "page") { - var pageSize = Math.min(cm.display.wrapper.clientHeight, window.outerHeight || document.documentElement.clientHeight); + var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index a2d0cede7..f34e6c1d3 100644 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -622,24 +622,26 @@ export default { dialogStyle() { const {windowHeight, hasOpenDialog} = this; - let height = Math.min(1100, windowHeight) + const height = Math.min(1100, windowHeight) if (!height) { return {}; } if (!hasOpenDialog) { return {}; } + const factor = height > 900 ? 200 : 70; return { - minHeight: (height - (height > 900 ? 200 : 150) - 48) + 'px' + minHeight: (height - factor - 48) + 'px' } }, taskDetailStyle() { const {modalMode, windowHeight, hasOpenDialog} = this; - let height = Math.min(1100, windowHeight) + const height = Math.min(1100, windowHeight) if (modalMode && hasOpenDialog) { + const factor = height > 900 ? 200 : 70; return { - maxHeight: (height - (height > 900 ? 200 : 150) - 30) + 'px' + maxHeight: (height - factor - 30) + 'px' } } return {} @@ -1242,8 +1244,8 @@ export default { resizeDialog() { return new Promise(resolve => { this.$Electron.sendSyncMessage('windowSize', { - width: Math.max(1100, window.outerWidth), - height: Math.max(720, window.outerHeight), + width: Math.max(1100, this.windowWidth), + height: Math.max(720, this.windowHeight), minWidth: 800, minHeight: 600, autoZoom: true, diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index 2e7c1a5c8..5ef1a883c 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -1,12 +1,12 @@ const stateData = { // 浏览器尺寸信息 - windowWidth: window.outerWidth, - windowHeight: window.outerHeight, + windowWidth: $A(window).width(), + windowHeight: $A(window).height(), windowScrollY: 0, // 浏览器窗口类型 - windowLarge: window.outerWidth > 768, // 大窗口 - windowSmall: window.outerWidth <= 768, // 小窗口 + windowLarge: $A(window).width() > 768, // 大窗口 + windowSmall: $A(window).width() <= 768, // 小窗口 // 播放中的音频地址 audioPlaying: null,