mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
30 lines
718 B
JavaScript
30 lines
718 B
JavaScript
/**
|
|
* @provide pskl.tools.drawing.Rectangle
|
|
*
|
|
* @require pskl.utils
|
|
*/
|
|
(function() {
|
|
var ns = $.namespace('pskl.tools.drawing');
|
|
|
|
ns.Rectangle = function() {
|
|
ns.ShapeTool.call(this);
|
|
|
|
this.toolId = 'tool-rectangle';
|
|
|
|
this.helpText = 'Rectangle tool';
|
|
};
|
|
|
|
pskl.utils.inherit(ns.Rectangle, ns.ShapeTool);
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
ns.Rectangle.prototype.draw = function (col, row, color, targetFrame) {
|
|
var strokePoints = pskl.PixelUtils.getBoundRectanglePixels(this.startCol, this.startRow, col, row);
|
|
for (var i = 0 ; i < strokePoints.length ; i++) {
|
|
// Change model:
|
|
targetFrame.setPixel(strokePoints[i].col, strokePoints[i].row, this.getToolColor());
|
|
}
|
|
};
|
|
})();
|