function Canvas(element) { Module.call(this); this.parameters = [Rect,Color,Bang]; this.element = element; this.active = function(cmd) { if(cmd.bang()){ this.clear(); } if(cmd.rect()){ this.resize(cmd.rect()); ronin.overlay.resize(cmd.rect()); } if(cmd.color()){ this.context().beginPath(); this.context().rect(0, 0, this.element.width, this.element.height); this.context().fillStyle = cmd.color().hex; this.context().fill(); } } this.passive = function(cmd) { if(cmd.rect()){ ronin.overlay.show_guide(null,cmd.rect()); } } // this.resize = function(rect) { this.element.setAttribute('width',rect.width+"px"); this.element.setAttribute('height',rect.height+"px"); } this.context = function() { return this.element.getContext('2d'); } this.clear = function() { this.context().clearRect(0, 0, this.element.width, this.element.height); } }