2012-08-31 12:45:07 +04: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-02 02:44:55 +04:00
|
|
|
ns.Eraser.prototype.applyToolAt = function(col, row, frame, color, canvas, dpi) {
|
|
|
|
|
|
|
|
// Change model:
|
2012-08-31 12:45:07 +04:00
|
|
|
frame[col][row] = Constants.TRANSPARENT_COLOR;
|
2012-09-03 03:34:11 +04:00
|
|
|
|
2012-09-02 02:44:55 +04:00
|
|
|
// Draw on canvas:
|
|
|
|
// TODO: Remove that when we have the centralized redraw loop
|
2012-08-31 12:45:07 +04:00
|
|
|
this.drawPixelInCanvas(col, row, canvas, Constants.TRANSPARENT_COLOR, dpi);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @override
|
|
|
|
*/
|
2012-09-02 02:44:55 +04:00
|
|
|
ns.Eraser.prototype.moveToolAt = function(col, row, frame, color, canvas, dpi) {
|
|
|
|
this.applyToolAt(col, row, frame, color, canvas, dpi);
|
2012-08-31 12:45:07 +04:00
|
|
|
};
|
|
|
|
})();
|