简体   繁体   English

Fabric.js在启动时停止在Chrome中响应

[英]Fabric.js stop responding in chrome at start

I have created a photo editor using fabric.js, but when I launch my web page at localhost and add a photo to the canvas, the resizing and movements of the photo don't respond at all. 我已经使用fabric.js创建了一个照片编辑器,但是当我在本地主机上启动网页并将照片添加到画布上时,照片的大小调整和移动完全不响应。 But when I click "Inspect element" and close it, everything starts working normally. 但是,当我单击“检查元素”并关闭它时,一切开始正常工作。 I don't understand what's the problem here? 我不明白这是什么问题? Every timec I have to open "Inspect element" once to make canvas respond. 每次我都必须打开一次“检查元素”以使画布响应。

A little help would be greatly appreciated! 一点帮助将不胜感激!

I have came across the same problem. 我遇到了同样的问题。 My work around is: 我的解决方法是:

  • After adding the element to the canvas, render the canvas by doing: canvas.renderAll(); 在将元素添加到画布之后,通过执行以下操作来渲染画布:canvas.renderAll();
  • Then calculate the offset by doing: canvas.calcOffset(); 然后通过执行以下操作来计算偏移量:canvas.calcOffset();

It works for me. 这个对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM