forked from github/dataease
Merge pull request #4411 from dataease/pr@dev@refactor_panel-drag
refactor(仪表板): 优化仪表板矩阵模式下的拖拽可能出现的松开手柄后大小再次变化,位置未置顶问题
This commit is contained in:
commit
a50b039090
@ -126,7 +126,7 @@
|
|||||||
:canvas-id="canvasId"
|
:canvas-id="canvasId"
|
||||||
/>
|
/>
|
||||||
<!-- 右击菜单 -->
|
<!-- 右击菜单 -->
|
||||||
<ContextMenu />
|
<ContextMenu/>
|
||||||
|
|
||||||
<!-- 对齐标线 -->
|
<!-- 对齐标线 -->
|
||||||
<span
|
<span
|
||||||
@ -1055,7 +1055,6 @@ export default {
|
|||||||
lineRef.init(newVal)
|
lineRef.init(newVal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(newVal)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
@ -830,6 +830,22 @@ export default {
|
|||||||
this.beforeDestroyFunction()
|
this.beforeDestroyFunction()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
sizeAdaptor() {
|
||||||
|
this.top = this.y
|
||||||
|
this.left = this.x
|
||||||
|
const [parentWidth, parentHeight] = this.getParentSize()
|
||||||
|
this.parentWidth = parentWidth
|
||||||
|
this.parentHeight = parentHeight
|
||||||
|
const [width, height] = getComputedSize(this.$el)
|
||||||
|
this.aspectFactor = (this.w !== 'auto' ? this.w : width) / (this.h !== 'auto' ? this.h : height)
|
||||||
|
if (this.outsideAspectRatio) {
|
||||||
|
this.aspectFactor = this.outsideAspectRatio
|
||||||
|
}
|
||||||
|
this.width = this.w !== 'auto' ? this.w : width
|
||||||
|
this.height = this.h !== 'auto' ? this.h : height
|
||||||
|
this.right = this.parentWidth - this.width - this.left
|
||||||
|
this.bottom = this.parentHeight - this.height - this.top
|
||||||
|
},
|
||||||
setChartData(chart) {
|
setChartData(chart) {
|
||||||
this.chart = chart
|
this.chart = chart
|
||||||
},
|
},
|
||||||
@ -1482,6 +1498,7 @@ export default {
|
|||||||
this.hasMove && this.$store.commit('recordSnapshot', 'handleUp')
|
this.hasMove && this.$store.commit('recordSnapshot', 'handleUp')
|
||||||
// 记录snapshot后 移动已记录设置为false
|
// 记录snapshot后 移动已记录设置为false
|
||||||
this.hasMove = false
|
this.hasMove = false
|
||||||
|
this.sizeAdaptor()
|
||||||
}, 200)
|
}, 200)
|
||||||
} else {
|
} else {
|
||||||
this.hasMove && this.$store.commit('recordSnapshot', 'handleUp')
|
this.hasMove && this.$store.commit('recordSnapshot', 'handleUp')
|
||||||
@ -1890,18 +1907,7 @@ export default {
|
|||||||
if (!this.enableNativeDrag) {
|
if (!this.enableNativeDrag) {
|
||||||
this.$el.ondragstart = () => false
|
this.$el.ondragstart = () => false
|
||||||
}
|
}
|
||||||
const [parentWidth, parentHeight] = this.getParentSize()
|
this.sizeAdaptor()
|
||||||
this.parentWidth = parentWidth
|
|
||||||
this.parentHeight = parentHeight
|
|
||||||
const [width, height] = getComputedSize(this.$el)
|
|
||||||
this.aspectFactor = (this.w !== 'auto' ? this.w : width) / (this.h !== 'auto' ? this.h : height)
|
|
||||||
if (this.outsideAspectRatio) {
|
|
||||||
this.aspectFactor = this.outsideAspectRatio
|
|
||||||
}
|
|
||||||
this.width = this.w !== 'auto' ? this.w : width
|
|
||||||
this.height = this.h !== 'auto' ? this.h : height
|
|
||||||
this.right = this.parentWidth - this.width - this.left
|
|
||||||
this.bottom = this.parentHeight - this.height - this.top
|
|
||||||
|
|
||||||
// 绑定data-*属性
|
// 绑定data-*属性
|
||||||
this.settingAttribute()
|
this.settingAttribute()
|
||||||
|
Loading…
Reference in New Issue
Block a user