我使用“piggyback”来捕捉对象:此处提到的悬停事件:https ://github.com/kangax/fabric.js/wiki/Working-with-events
假设标准设置和这些事件:
canvas.on('object:over', function(e) {
// some manipulation with e.target here, will execute on hover as expected
canvas.renderAll.bind(canvas);
});
canvas.on('after:render', function() {
// code here wont execute on hover but only after other action which evokes render, such as click and drag of object
})
是否有其他方法可以在对象的鼠标悬停时强制重新渲染画布?
如果您想知道我的目标是什么,我想在鼠标悬停时突出显示对象,类似于以下内容:http: //www.html5canvastutorials.com/demos/labs/html5-canvas-world-map-svg-path- with-kineticjs/index.php
非常感谢您的帮助!