重播步骤:
click
JSFiddle result
。椭圆将显示。click
椭圆对象,将不会输出任何控制台。问题:
setOptions
时椭圆不能自动更新?event
?答案 0 :(得分:1)
设置rx,ry
值后,您需要调用setCoords。
演示
var canvas = new fabric.Canvas('c', {
width: 400,
height: 400
});
var object = new fabric.Ellipse({
rx: 0,
ry: 0,
fill: 'red',
top: 100,
left: 100,
})
object.on('mousedown', function(e) {
console.log(e)
})
canvas.add(object)
setTimeout(() => {
object.set({
rx: 40,
ry: 60
}).setCoords();
canvas.renderAll();
}, 3000);
canvas{
border:1px solid;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.7.0/fabric.js"></script>
<canvas id='c'></canvas>