mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Merge pull request #21 from juliandescottes/misc-eraserinherit
Eraser now inherits from SimplePen. Added a superclass property attached...
This commit is contained in:
commit
d8129d1fd3
@ -11,25 +11,12 @@
|
||||
this.toolId = "tool-eraser";
|
||||
};
|
||||
|
||||
pskl.utils.inherit(ns.Eraser, ns.BaseTool);
|
||||
pskl.utils.inherit(ns.Eraser, ns.SimplePen);
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.Eraser.prototype.applyToolAt = function(col, row, frame, color, canvas, dpi) {
|
||||
|
||||
// Change model:
|
||||
frame[col][row] = Constants.TRANSPARENT_COLOR;
|
||||
|
||||
// Draw on canvas:
|
||||
// TODO: Remove that when we have the centralized redraw loop
|
||||
this.drawPixelInCanvas(col, row, canvas, Constants.TRANSPARENT_COLOR, dpi);
|
||||
};
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.Eraser.prototype.moveToolAt = function(col, row, frame, color, canvas, dpi) {
|
||||
this.applyToolAt(col, row, frame, color, canvas, dpi);
|
||||
this.superclass.applyToolAt.call(this, col, row, frame, Constants.TRANSPARENT_COLOR, canvas, dpi);
|
||||
};
|
||||
})();
|
@ -37,6 +37,8 @@ jQuery.namespace = function() {
|
||||
ns.inherit = function(extendedObject, inheritFrom) {
|
||||
extendedObject.prototype = Object.create(inheritFrom.prototype);
|
||||
extendedObject.prototype.constructor = extendedObject;
|
||||
extendedObject.prototype.superclass = inheritFrom.prototype;
|
||||
|
||||
//pskl.ToolBehavior.Eraser.prototype = Object.create(pskl.ToolBehavior.BaseTool.prototype);
|
||||
//prototypeskl.ToolBehavior.Eraser.prototype.constructor = pskl.ToolBehavior.Eraser;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user