1

I am using sketch.js library to draw something on canvas. Basically what I need is that the default brush size seems big to me. I want to change the default brush size. Please help in this. I have looked in this link http://intridea.github.io/sketch.js/ but description on this link works after clicking on anchor tab. I want to change the size by default. Any help is appreciated.

Ashish
  • 468
  • 2
  • 8
  • 24

2 Answers2

0

somewhere in the sketch.js file there is this piece of code where you can change the default size.

Sketch = (function() {
function Sketch(el, opts) {
  this.el = el;
  this.canvas = $(el);
  this.context = el.getContext('2d');
  this.options = $.extend({
    toolLinks: true,
    defaultTool: 'marker',
    defaultColor: '#000000',
    defaultSize: 5 //<<< here you can change the default size
  }, opts);
Kevin Kloet
  • 1,086
  • 1
  • 11
  • 21
0

If you want to change brush size at user hand then you can use below code:

Sizes :
    <a href="#canvas" data-size="1"><img src="img/pencil_icon.png" alt="Pencil"/></a>
    <a href="#canvas" data-size="3"><img src="img/pen_icon.png" alt="Pen"/></a>
    <a href="#canvas" data-size="5"><img src="img/stick_icon.png" alt="Stick"/></a>
    <a href="#canvas" data-size="9"><img src="img/smallbrush_icon.png" alt="Small brush"/></a>
    <a href="#canvas" data-size="15"><img src="img/mediumbrush_icon.png" alt="Medium brush"/></a>
    <a href="#canvas" data-size="30"><img src="img/bigbrush_icon.png" alt="Big brush"/></a>
    <a href="#canvas" data-size="60"><img src="img/bucket_icon.png" alt="Huge bucket"/></a>

Where canvas is id of your canvas

Rizban Ahmad
  • 139
  • 1
  • 13