2012-08-31 08:45:07 +00:00
|
|
|
/*
|
|
|
|
* @provide pskl.drawingtools.Eraser
|
|
|
|
*
|
|
|
|
* @require Constants
|
|
|
|
* @require pskl.utils
|
|
|
|
*/
|
|
|
|
(function() {
|
|
|
|
var ns = $.namespace("pskl.drawingtools");
|
|
|
|
|
|
|
|
ns.Eraser = function() {
|
|
|
|
this.toolId = "tool-eraser";
|
|
|
|
};
|
|
|
|
|
|
|
|
pskl.utils.inherit(ns.Eraser, ns.BaseTool);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
*/
|
2012-09-01 22:44:55 +00:00
|
|
|
ns.Eraser.prototype.applyToolAt = function(col, row, frame, color, canvas, dpi) {
|
|
|
|
|
|
|
|
// Change model:
|
2012-08-31 08:45:07 +00:00
|
|
|
frame[col][row] = Constants.TRANSPARENT_COLOR;
|
2012-09-02 23:34:11 +00:00
|
|
|
|
2012-09-01 22:44:55 +00:00
|
|
|
// Draw on canvas:
|
|
|
|
// TODO: Remove that when we have the centralized redraw loop
|
2012-08-31 08:45:07 +00:00
|
|
|
this.drawPixelInCanvas(col, row, canvas, Constants.TRANSPARENT_COLOR, dpi);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
*/
|
2012-09-01 22:44:55 +00:00
|
|
|
ns.Eraser.prototype.moveToolAt = function(col, row, frame, color, canvas, dpi) {
|
|
|
|
this.applyToolAt(col, row, frame, color, canvas, dpi);
|
2012-08-31 08:45:07 +00:00
|
|
|
};
|
|
|
|
})();
|