Merge pull request #698 from dataease/pr@dev@refactor_panel-edit-bar

refactor:仪表板编辑时,文字组件、矩形组件、过滤组件样式设置面板强制在画布区域内
This commit is contained in:
王嘉豪 2021-08-25 17:12:54 +08:00 committed by GitHub
commit 88995675f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 8 deletions

View File

@ -109,6 +109,13 @@ export default {
styleInfo() {
return this.$store.state.curComponent.style
},
canvasWidth() {
let scaleWidth = 1
if (this.canvasStyleData.selfAdaption) {
scaleWidth = this.curCanvasScale.scaleWidth / 100
}
return this.canvasStyleData.width * scaleWidth
},
...mapState([
'curComponent',
'curCanvasScale',
@ -124,10 +131,19 @@ export default {
this.$refs.backgroundColorPicker.handleTrigger()
},
getPositionX(x) {
let ps = 0
if (this.canvasStyleData.selfAdaption) {
return (x * this.curCanvasScale.scaleWidth / 100) + 60
ps = (x * this.curCanvasScale.scaleWidth / 100) + 60
} else {
return x + 60
ps = x + 60
}
// toolbar
const xGap = ps + 295 - this.canvasWidth
// console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap)
if (xGap > 0) {
return ps - xGap
} else {
return ps
}
},
getPositionY(y) {

View File

@ -161,6 +161,13 @@ export default {
styleInfo() {
return this.$store.state.curComponent.style
},
canvasWidth() {
let scaleWidth = 1
if (this.canvasStyleData.selfAdaption) {
scaleWidth = this.curCanvasScale.scaleWidth / 100
}
return this.canvasStyleData.width * scaleWidth
},
...mapState([
'curComponent',
'curCanvasScale',
@ -176,10 +183,19 @@ export default {
this.$refs.backgroundColorPicker.handleTrigger()
},
getPositionX(x) {
let ps = 0
if (this.canvasStyleData.selfAdaption) {
return (x * this.curCanvasScale.scaleWidth / 100) + 60
ps = (x * this.curCanvasScale.scaleWidth / 100) + 60
} else {
return x + 60
ps = x + 60
}
// toolbar
const xGap = ps + 345 - this.canvasWidth
// console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap)
if (xGap > 0) {
return ps - xGap
} else {
return ps
}
},
getPositionY(y) {

View File

@ -124,6 +124,13 @@ export default {
styleInfo() {
return this.$store.state.curComponent.style
},
canvasWidth() {
let scaleWidth = 1
if (this.canvasStyleData.selfAdaption) {
scaleWidth = this.curCanvasScale.scaleWidth / 100
}
return this.canvasStyleData.width * scaleWidth
},
...mapState([
'curComponent',
'curCanvasScale',
@ -139,10 +146,19 @@ export default {
this.$refs.backgroundColorPicker.handleTrigger()
},
getPositionX(x) {
let ps = 0
if (this.canvasStyleData.selfAdaption) {
return (x * this.curCanvasScale.scaleWidth / 100) + 60
ps = (x * this.curCanvasScale.scaleWidth / 100) + 60
} else {
return x + 60
ps = x + 60
}
// toolbar
const xGap = ps + 395 - this.canvasWidth
// console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap)
if (xGap > 0) {
return ps - xGap
} else {
return ps
}
},
getPositionY(y) {

View File

@ -214,8 +214,8 @@ import toast from '@/components/canvas/utils/toast'
import { commonStyle, commonAttr } from '@/components/canvas/custom-component/component-list'
import generateID from '@/components/canvas/utils/generateID'
import RectangleAttr from '@/components/canvas/components/RectangleAttr'
import TextAttr from '@/views/Tinymce/TextAttr'
import FilterTextAttr from '@/views/Tinymce/FilterTextAttr'
import TextAttr from '@/components/canvas/components/TextAttr'
import FilterTextAttr from '@/components/canvas/components/FilterTextAttr'
export default {
name: 'PanelEdit',