fabric都是通过监控滚轮事件,mouse:wheel,通过确定中心点,放大缩小,核心代码如下
this.zoomPoint = new fabric.Point(e.pointer.x, e.pointer.y); // 中心点
this.fabricObj.zoomToPoint(this
Fabric.js 中的缩放重置方法
博客探讨了在使用Fabric.js库进行图形操作时,如何正确实现放大缩小后的重置功能。通过监控mouse:wheel事件并确定中心点进行缩放,但简单的反向操作并不能达到理想的重置效果。文章指出了正确的重置初始位置的方法。
fabric都是通过监控滚轮事件,mouse:wheel,通过确定中心点,放大缩小,核心代码如下
this.zoomPoint = new fabric.Point(e.pointer.x, e.pointer.y); // 中心点
this.fabricObj.zoomToPoint(this
2909
776

被折叠的 条评论
为什么被折叠?