piskel/src/js/drawingtools/Rectangle.js

26 lines
671 B
JavaScript
Raw Normal View History

/**
2012-09-02 15:19:20 +04:00
* @provide pskl.drawingtools.Rectangle
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
2012-09-02 15:19:20 +04:00
ns.Rectangle = function() {
ns.ShapeTool.call(this);
this.toolId = "tool-rectangle";
this.helpText = "Rectangle tool";
};
2012-09-02 15:19:20 +04:00
pskl.utils.inherit(ns.Rectangle, ns.ShapeTool);
2012-09-02 15:19:20 +04:00
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, color);
}
};
2012-09-02 15:19:20 +04:00
})();