mirror of
https://gitee.com/dromara/go-view.git
synced 2025-06-29 16:29:14 +08:00
fixed 65dc9db from https://gitee.com/novice0/go-view/pulls/214
fix: 解决标尺组件相关问题 解决标尺宽高计算容易让人引起误解的问题;解决首次进来标尺刻度不对的问题,解决缩放后标尺刻度不对的问题
This commit is contained in:
parent
6c54c168a6
commit
c2050ae955
@ -159,11 +159,11 @@ const dragCanvas = (e: any) => {
|
||||
const canvasBox = () => {
|
||||
const layoutDom = document.getElementById('go-chart-edit-layout')
|
||||
if (layoutDom) {
|
||||
// 此处减去滚动条的宽度和高度
|
||||
const scrollW = 20
|
||||
// 应该减去的是标尺的厚度,虽然都是20,但是这样更容易让人理解
|
||||
// 如果后面改了标尺厚度这里也不用改
|
||||
return {
|
||||
height: layoutDom.clientHeight - scrollW,
|
||||
width: layoutDom.clientWidth - scrollW
|
||||
height: layoutDom.clientHeight - thick,
|
||||
width: layoutDom.clientWidth - thick
|
||||
}
|
||||
}
|
||||
return {
|
||||
@ -188,7 +188,12 @@ const canvasPosCenter = () => {
|
||||
$app.value.scrollLeft = containerWidth / 2 - width / 2
|
||||
$app.value.scrollTop = containerHeight / 2 - height / 2
|
||||
}
|
||||
|
||||
watch(scale, () => {
|
||||
// 解决首次进来标尺位置不对的问题
|
||||
// 解决每次缩放后标尺位置不对的问题
|
||||
// 直接监听缩放比例的变化,每次重绘标尺组件
|
||||
reDraw()
|
||||
}, { immediate: true })
|
||||
// 处理主题变化
|
||||
watch(
|
||||
() => designStore.getDarkTheme,
|
||||
|
Loading…
x
Reference in New Issue
Block a user