mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Tool plugin architecture with eraser/pen/paintbucket tools.
This commit is contained in:
41
js/drawingtools/SimplePen.js
Normal file
41
js/drawingtools/SimplePen.js
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* @provide pskl.drawingtools.SimplePen
|
||||
*
|
||||
* @require pskl.utils
|
||||
*/
|
||||
(function() {
|
||||
var ns = $.namespace("pskl.drawingtools");
|
||||
|
||||
ns.SimplePen = function() {
|
||||
this.toolId = "tool-pen"
|
||||
};
|
||||
|
||||
pskl.utils.inherit(ns.SimplePen, ns.BaseTool);
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.SimplePen.prototype.applyToolOnFrameAt = function(col, row, frame, color) {
|
||||
var color = pskl.utils.normalizeColor(color);
|
||||
if (color != frame[col][row]) {
|
||||
frame[col][row] = color;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.SimplePen.prototype.applyToolOnCanvasAt = function(col, row, canvas, frame, color, dpi) {
|
||||
|
||||
this.drawPixelInCanvas(col, row, canvas, color, dpi);
|
||||
};
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.SimplePen.prototype.releaseToolAt = function() {
|
||||
// Do nothing
|
||||
console.log('SimplePen release');
|
||||
};
|
||||
|
||||
})();
|
Reference in New Issue
Block a user