本文介绍了我们在Fabric.js中是否有画布修改的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Fabric.js中,我们将对象修改的事件,如对象:修改。我们对整个画布有类似的事件。
In Fabric.js we have Object modified events like object:modified. Do we have similar event for the entire canvas.
其实我正在尝试实现撤消和重做功能。如果有事情发生,我将画布保存为JSON,并将其再次加载以进行撤消功能。
Actually I am trying to implement undo and redo features. I am saving the canvas as JSON if something happens on it and loading it again for undo feature.
我们在Fabric.js中有哪些更好的解决方案? / p>
Do we have any better solution for this features in Fabric.js?
推荐答案
这个更好的解释在这个。使用这种方式:
This is better explained in this link. Use it this way:
canvas.on('object:moving', function(e) { // or 'object:added'
var activeObject = e.target;
console.log(activeObject.get('left'), activeObject.get('top'));
});
这篇关于我们在Fabric.js中是否有画布修改的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!