0
我正在使用下面的代碼來更改Selected Shape的選定邊框和邊框顏色,但是一旦我調用該事件對象將變爲較小尺寸並且不會重新調整大小。fabricjs在某些事件不起作用時更改邊框大小和顏色
$('#shape_border_colour').spectrum({
color : "#f00",
change : function(color) {
console.log(' color change' + color.toHexString());
var obj = canvas.getActiveObject();
shape_strokeColor=color.toHexString();
if (!obj)
return;
obj.set('stroke', shape_strokeColor);
obj.set('strokeWidth',shape_strokeWidth);
//stroke : 'white',
//strokeWidth : 5
//obj.set('textBackgroundColor', color.toHexString());
canvas.renderAll();
}
});
$('#shape_border_size').change(function() {
console.log(' size changed to ' + $(this).val());
img_border = $(this).val();
var obj = canvas.getActiveObject();
shape_strokeWidth=$(this).val();
if (!obj)
return;
obj.set('stroke',shape_strokeColor);
obj.set('strokeWidth', shape_strokeWidth);
canvas.renderAll();
});
會是什麼問題?