From 372685035e96cc156d5450e045998e0225b546c7 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 20 Jan 2022 11:33:41 +0800 Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E6=8B=96=E5=8A=A8=E7=BB=84=E4=BB=B6=E6=8E=A5?= =?UTF-8?q?=E8=BF=91=E4=B8=8A=E4=B8=8B=E8=BE=B9=E7=95=8C=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=87=AA=E5=8A=A8=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/DeDrag/index.vue | 23 ++++++++++--- .../canvas/components/Editor/index.vue | 4 +++ frontend/src/components/canvas/store/layer.js | 2 -- frontend/src/store/index.js | 6 +++- frontend/src/views/panel/edit/index.vue | 33 +++++++++++++++++-- 5 files changed, 59 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 8832a2c813..742bf26cd8 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -370,7 +370,9 @@ export default { // 鼠标移入事件 mouseOn: false, // 是否移动 (如果没有移动 不需要记录snapshot) - hasMove: false + hasMove: false, + // 上次的鼠标指针纵向位置,用来判断指针是上移还是下移 + latestMoveY: 0 } }, computed: { @@ -543,7 +545,8 @@ export default { 'canvasStyleData', 'linkageSettingStatus', 'mobileLayoutStatus', - 'componentGap' + 'componentGap', + 'scrollAutoMove' ]) }, watch: { @@ -646,12 +649,14 @@ export default { dragging(val) { if (this.enabled) { this.curComponent.optStatus.dragging = val + this.$store.commit('setScrollAutoMove', 0) } }, // private 监控dragging resizing resizing(val) { if (this.enabled) { this.curComponent.optStatus.resizing = val + this.$store.commit('setScrollAutoMove', 0) } } }, @@ -724,6 +729,8 @@ export default { // 此处阻止冒泡 但是外层需要获取pageX pageY this.element.auxiliaryMatrix && this.$emit('elementMouseDown', e) this.$store.commit('setCurComponent', { component: this.element, index: this.index }) + // 移动端组件点击自动置顶 + this.mobileLayoutStatus && this.$store.commit('topComponent') eventsFor = events.mouse this.elementDown(e) }, @@ -763,6 +770,8 @@ export default { this.mouseClickPosition.bottom = this.bottom this.mouseClickPosition.width = this.width this.mouseClickPosition.height = this.height + // 鼠标按下 重置上次鼠标指针位置 + this.latestMoveY = this.mouseClickPosition.mouseY if (this.parent) { this.bounds = this.calcDragLimits() } @@ -997,7 +1006,13 @@ export default { // 水平移动 const tmpDeltaX = axis && axis !== 'y' ? mouseClickPosition.mouseX - (e.touches ? e.touches[0].pageX : e.pageX) : 0 // 垂直移动 - const tmpDeltaY = axis && axis !== 'x' ? mouseClickPosition.mouseY - (e.touches ? e.touches[0].pageY : e.pageY) : 0 + const mY = e.touches ? e.touches[0].pageY : e.pageY + const tmpDeltaY = axis && axis !== 'x' ? mouseClickPosition.mouseY - mY : 0 + // mY 鼠标指针移动的点 mY - this.latestMoveY 是计算向下移动还是向上移动 + const offsetY = mY - this.latestMoveY + // console.log('mY:' + mY + ';latestMoveY=' + this.latestMoveY + ';offsetY=' + offsetY) + this.$emit('canvasDragging', mY, offsetY) + this.latestMoveY = mY const [deltaX, deltaY] = snapToGrid(grid, tmpDeltaX, tmpDeltaY, this.scaleRatio) const left = restrictToBounds(mouseClickPosition.left - deltaX, bounds.minLeft, bounds.maxLeft) const top = restrictToBounds(mouseClickPosition.top - deltaY, bounds.minTop, bounds.maxTop) @@ -1007,7 +1022,7 @@ export default { const right = restrictToBounds(mouseClickPosition.right + deltaX, bounds.minRight, bounds.maxRight) const bottom = restrictToBounds(mouseClickPosition.bottom + deltaY, bounds.minBottom, bounds.maxBottom) this.left = left - this.top = top + this.top = top + this.scrollAutoMove this.right = right this.bottom = bottom await this.snapCheck() diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index 46ebd36679..b5ff7bcd48 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -55,6 +55,7 @@ @amRemoveItem="removeItem(item._dragId)" @amAddItem="addItemBox(item)" @linkJumpSet="linkJumpSet(item)" + @canvasDragging="canvasDragging" > - + @@ -265,6 +265,7 @@ export default { }, data() { return { + autoMoveOffSet: 15, mobileEditorShow: true, hasStar: false, drawerSize: '300px', @@ -397,7 +398,8 @@ export default { 'mobileLayoutStatus', 'pcMatrixCount', 'mobileMatrixCount', - 'mobileLayoutStyle' + 'mobileLayoutStyle', + 'scrollAutoMove' ]) }, @@ -881,6 +883,33 @@ export default { }, sureStatusChange(status) { this.enableSureButton = status + }, + canvasDragging(mY, offsetY) { + if (this.curComponent && this.curComponent.optStatus.dragging) { + // 触发滚动的区域偏移量 + const touchOffset = 100 + const canvasInfoMobile = document.getElementById('canvasInfoMobile') + // 获取子盒子(高度肯定比父盒子大) + // const editorMobile = document.getElementById('editorMobile') + // 画布区顶部到浏览器顶部距离 + const canvasTop = canvasInfoMobile.offsetTop + 75 + // 画布区有高度 + const canvasHeight = canvasInfoMobile.offsetHeight + // 画布区域底部距离浏览器顶部距离 + const canvasBottom = canvasTop + canvasHeight + if (mY > (canvasBottom - touchOffset) && offsetY > 0) { + // 触发底部滚动 + this.scrollMove(this.autoMoveOffSet) + } else if (mY < (canvasTop + touchOffset) && offsetY < 0) { + // 触发顶部滚动 + this.scrollMove(-this.autoMoveOffSet) + } + } + }, + scrollMove(offset) { + const canvasInfoMobile = document.getElementById('canvasInfoMobile') + canvasInfoMobile.scrollTop = canvasInfoMobile.scrollTop + offset + this.$store.commit('setScrollAutoMove', this.scrollAutoMove + offset) } } } From 68cc99d57840f8d4f31a4cb451da9fdffc8e78b7 Mon Sep 17 00:00:00 2001 From: Eric_Lee Date: Thu, 20 Jan 2022 12:28:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/locale/en.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mobile/src/locale/en.json b/mobile/src/locale/en.json index 626104e0b9..37b77ab53f 100644 --- a/mobile/src/locale/en.json +++ b/mobile/src/locale/en.json @@ -9,7 +9,7 @@ "navigate.language": "Language", "navigate.about": "About", "navigate.login": "Login", - "searchPlaceholder": "Please Code Panel Name", + "searchPlaceholder": "Please Input Panel Name", "commons": { "cancel": "Cancel", @@ -24,11 +24,11 @@ "login": { "title": "User Login", "account": "Account:", - "accountPlaceholder": "Please Code Account", + "accountPlaceholder": "Please Input Account", "password": "Password:", - "passwordPlaceholder": "Please Code Password:", + "passwordPlaceholder": "Please Input Password:", "loginbtn": "Login", - "pwdFmtError": "Password Must More Than 6 Character", + "pwdFmtError": "Password Must More Than 6 Characters", "uOrpwdError": "Invalid Account Or Password" }, "home": { @@ -61,4 +61,4 @@ } -} \ No newline at end of file +} From 32e666dc551d47a7de8cf528b11e73eb20f8c80e Mon Sep 17 00:00:00 2001 From: "Jiangjie.Bai" <32935519+BaiJiangJie@users.noreply.github.com> Date: Thu, 20 Jan 2022 12:36:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E8=8B=B1=E6=96=87=E7=BF=BB=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/locale/en.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/src/locale/en.json b/mobile/src/locale/en.json index 37b77ab53f..97dd8882f9 100644 --- a/mobile/src/locale/en.json +++ b/mobile/src/locale/en.json @@ -1,7 +1,7 @@ { "app.name": "DataEase", "navigate.menuHome": "Home", - "navigate.menuDir": "Dir", + "navigate.menuDir": "Folder", "navigate.menuMe": "Me", "navigate.search": "Search", @@ -38,9 +38,9 @@ }, "dir": { "searchHistory": "Search History", - "clearConfirm": "Sure Clean All History ?", + "clearConfirm": "Are You Sure To Clean All History ?", "noHistory": "There Are No Any History", - "contentPrefix": "The Content You Code Are ", + "contentPrefix": "The Content Is ", "contentSuffix": "Will Be Marked As History When You Confirm" }, "me": { From c801e22b24f5d45dcb905ae6051864c7c02d9b3b Mon Sep 17 00:00:00 2001 From: xinwen Date: Thu, 20 Jan 2022 12:46:21 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E8=8B=B1=E6=96=87=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/locale/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/src/locale/en.json b/mobile/src/locale/en.json index 97dd8882f9..36f663af86 100644 --- a/mobile/src/locale/en.json +++ b/mobile/src/locale/en.json @@ -5,7 +5,7 @@ "navigate.menuMe": "Me", "navigate.search": "Search", - "navigate.personInfo": "Person Info", + "navigate.personInfo": "My Profile", "navigate.language": "Language", "navigate.about": "About", "navigate.login": "Login", @@ -44,7 +44,7 @@ "contentSuffix": "Will Be Marked As History When You Confirm" }, "me": { - "moreInfo": "More Info", + "moreInfo": "More", "logout": "Logout", "systemInfo": "System Info",