mirror of https://github.com/luileito/jsketch.git
Simplified shorthand methods
This commit is contained in:
parent
42b1770869
commit
d13c28ee40
25
jsketch.js
25
jsketch.js
|
|
@ -302,15 +302,8 @@
|
||||||
*/
|
*/
|
||||||
rect: function(x, y, width, height) {
|
rect: function(x, y, width, height) {
|
||||||
var args = [].slice.call(arguments);
|
var args = [].slice.call(arguments);
|
||||||
|
this.fillRect.apply(this, args);
|
||||||
this.context.beginPath();
|
this.strokeRect.apply(this, args);
|
||||||
this.context.fillRect.apply(this.context, args);
|
|
||||||
this.context.strokeRect.apply(this.context, args);
|
|
||||||
this.context.closePath();
|
|
||||||
|
|
||||||
this.callStack.push({ method: 'fillRect', args: args });
|
|
||||||
this.callStack.push({ method: 'strokeRect', args: args });
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
@ -362,17 +355,9 @@
|
||||||
* @memberof jSketch
|
* @memberof jSketch
|
||||||
*/
|
*/
|
||||||
circle: function(x, y, radius) {
|
circle: function(x, y, radius) {
|
||||||
var args = [x, y, radius, 0, 2*Math.PI, false];
|
var args = [].slice.call(arguments);
|
||||||
|
this.fillCircle.apply(this, args);
|
||||||
this.context.beginPath();
|
this.strokeCircle.apply(this, args);
|
||||||
this.context.arc.apply(this.context, args);
|
|
||||||
this.context.fill();
|
|
||||||
this.context.stroke();
|
|
||||||
this.context.closePath();
|
|
||||||
|
|
||||||
this.callStack.push({ method: 'fillCircle', args: args });
|
|
||||||
this.callStack.push({ method: 'strokeCircle', args: args });
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue