caleb531 / jcanvas

A jQuery plugin that makes the HTML5 canvas easy to work with.
https://projects.calebevans.me/jcanvas/
MIT License
626 stars 192 forks source link

Replacement for a deprecated method: $.jCanvas() #349

Closed ing4prg closed 5 years ago

ing4prg commented 5 years ago

In a previous version I have used this syntax to predefine a style for multiple drawings:

$.jCanvas(); $.jCanvas({ strokeStyle:color, strokeWidth:1, rounded:true });

Is there another syntax to replace this deprecated method? When draw multiple lines, it is easier to have some styles predefined.

Thanks!

caleb531 commented 5 years ago

@ing4prg My only recommendation would be to use $.extend:

var defaults = {
  strokeWidth: 1,
  rounded: true
};
$('#my-canvas').drawLine($.extend({
  strokeStyle: 'red'
}, defaults));