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();
});
会是什么问题?