forked from github/dataease
refactor:优化外部组件预定位阴影区,防止阴影区拖拽是超出边界
This commit is contained in:
parent
3ca7a5e029
commit
08dcd230c6
@ -37,6 +37,13 @@ export default {
|
||||
top = Math.round(top / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight
|
||||
height = Math.round(height / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight
|
||||
}
|
||||
|
||||
// 防止阴影区超出边界
|
||||
const xGap = left + width - this.canvasWidth
|
||||
// console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap)
|
||||
if (xGap > 0) {
|
||||
left = left - xGap
|
||||
}
|
||||
const style = {
|
||||
transform: `translate(${left}px, ${top}px) rotate(0deg)`,
|
||||
width: width + 'px',
|
||||
@ -55,6 +62,10 @@ export default {
|
||||
dragComponentInfo() {
|
||||
return this.$store.state.dragComponentInfo
|
||||
},
|
||||
canvasWidth() {
|
||||
const scaleWidth = this.curCanvasScale.scaleWidth / 100
|
||||
return this.canvasStyleData.width * scaleWidth
|
||||
},
|
||||
...mapState([
|
||||
'curComponent',
|
||||
'editor',
|
||||
|
Loading…
Reference in New Issue
Block a user