Comments (12)
懒得提pr了,自己改吧
from datav-vue.
这并不是bug,这块的设计逻辑是:用户打开或关闭工具面板后不主动调整当前画布的大小,因为有可能是用户自己手动调整的画布大小。目前只有三种方式触发自动调整:
- 首次打开
- 改变画布尺寸
- 快捷键
from datav-vue.
这并不是bug,这块的设计逻辑是:用户打开或关闭工具面板后不主动调整当前画布的大小,因为有可能是用户自己手动调整的画布大小。目前只有三种方式触发自动调整:
- 首次打开
- 改变画布尺寸
- 快捷键
那为什么监听window.onresize?
你说的三种情况本来就不会触发window.onresize。
我说的是触发window.onresize时,因为没有offsetX,offsetY。所以页面就没有auto set scale。
或者你这里监听window.onresize本来就是多余的?
from datav-vue.
😓 少写了一种。。如果是在多个不同分辨率显示器之间切换,就会用到了。
不过确实有另一个bug:
// 只被赋值了一次,应该把 if 去掉
if (!window.onresize) {
window.onresize = resize
}
from datav-vue.
@Action
public async autoCanvasScale(payload: { offsetX: number; offsetY: number; }) {
const resize = debounce(() => {
const width = document.documentElement.clientWidth - payload.offsetX
const height = document.documentElement.clientHeight - 42 - payload.offsetY
const a = (width - 120) / this.pageConfig.width
const b = (height - 140) / this.pageConfig.height
const scale = parseFloat((a > b ? b : a).toFixed(6)) * 100
this.setCanvasScale({ scale, ...payload })
}, 200)
if (!window.onresize) {
window.onresize = resize
}
resize()
}
resize方法第二次进入时,没有更新(这里写错了)payload
所以你这两行代码计算就出现错误了
const width = document.documentElement.clientWidth - payload.offsetX
const height = document.documentElement.clientHeight - 42 - payload.offsetY
这种错误很明显吧
from datav-vue.
这里会形成闭包
from datav-vue.
auto_Trim.mp4
直接看视频吧
拖拽devtools窗口触发的resize和直接触发autoCanvasScale的offsetX值不一致
换句话说,在更改了左侧或者顶部面板显示和隐藏后。任何触发resize的方法输入的payload的值都没有更新。都是错的
from datav-vue.
@gongym12138 我前面有解释的:
😓 少写了一种。。如果是在多个不同分辨率显示器之间切换,就会用到了。
不过确实有另一个bug:// 只被赋值了一次,应该把 if 去掉 if (!window.onresize) { window.onresize = resize }
from datav-vue.
@gongym12138
绕糊涂了,前面说的三种情况是触发 autoCanvasScale
并刷新 window.onresize
的,
切换显示器 才是 触发 window.onresize
from datav-vue.
按照你的设计里,触发window.onresize的效果应该和触发自适应(autoCanvasScale)的效果一致?
from datav-vue.
@gongym12138
绕糊涂了,前面说的三种情况是触发autoCanvasScale
并刷新window.onresize
的,
切换显示器 才是 触发window.onresize
你不如自己试一下,最简单的。
- 初始状态,关闭左侧组件列表面板
- 设置系统分辨率为1920*1080
- 打开左侧组件列表面板
- 调整系统分辨率为1366*768(此处符合你说的在多个不同分辨率显示器之间切换)
- 看是否自动调整,以及自动调整是否正确
from datav-vue.
我已经试过了,符合我的预期。
你给的例子只会触发 window.onresize
,不会触发 autoCanvasScale
。
from datav-vue.
Related Issues (20)
- 如果和后端对接,需要的接口能否列下,自己可以补充后端 HOT 2
- 迭代器功能说明
- 大佬,什么时候再更新代码啊?等死我了 HOT 2
- 撤销重做功能 HOT 3
- 太牛了,什么时候能把数据源和数据集的功能加上呢,大佬? HOT 4
- 未来迭代计划 HOT 4
- 过滤器保存功能有问题 HOT 4
- 两个组件叠在一起,点击不准 HOT 2
- 柱状图等图表组件增加值标签配置
- 老大更新的速度明显加快了,加油,期待尽快把移动端设计功能开发哦 HOT 1
- 轮播列表 不显示序号列,列宽呈现出问题
- 滚动列表组件能否加上边框的配置呢
- 生产环境如何去掉mock.js,使用自己后端的api地址
- 请问组件间的交互有计划吗? HOT 6
- 我使用大佬你的代码当框架可以吗,会涉及侵权吗 HOT 1
- 项目是否还继续维护呢 HOT 5
- 刚和公司扯皮完裁员的事,这个月先找工作了
- 都TM被裁了,更个锤子。。 HOT 3
- websocket实时更新 HOT 8
- 感谢作者 很好用
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datav-vue.