UNPKG

601 BJavaScriptView Raw
1var Class = require('../core/class');
2var Mode = require('../modes/current');
3
4module.exports = function(drawFunction){
5
6 return Class(Mode.Shape, {
7
8 shape_initialize: Mode.Shape.prototype.initialize,
9 shape_draw: Mode.Shape.prototype.draw,
10
11 initialize: function(arg){
12 this.shape_initialize();
13 this.path = new Mode.Path();
14 if (arg != null) this.draw.apply(this, arguments);
15 },
16
17 draw: function(){
18 this.path.reset();
19 this._draw_function.apply(this, arguments);
20 this.shape_draw(this.path, this.width, this.height);
21 return this;
22 },
23
24 _draw_function: drawFunction
25
26 });
27
28};
\No newline at end of file