Reputation: 3913
chech fiddle http://jsfiddle.net/hxjZa/2/ . i have written code to set stroke and strokewidth of canvas element . they works fine but after setting stroke width value when i move my pointer to resize Element , it is not responding and automaicaly get change to small. even if i try to change then size by dragging it doesn't respond well .
jquery ::
$('#glow_colour').spectrum({
color : "#f00",
change : function(color) {
console.log(' color change' + color.toHexString());
var temp=color.toHexString();
var obj = canvas.getActiveObject();
if (!obj)
return;
obj.set({ stroke: temp });
obj.set({strokeWidth:strokewidth});
canvas.renderAll();
}
});
$("#txt_g_strength").change(function()
{
console.log('strength called');
//alert("stength called");
var obj = canvas.getActiveObject();
var strokewidth=$(this).val();
if (!obj)
return;
obj.set({ strokeWidth: strokewidth});
canvas.renderAll();
});
above is code to set stroke color and width .
Upvotes: 0
Views: 118