2013-09-28 23:10:12 +04:00
|
|
|
/**
|
2012-09-02 15:19:20 +04:00
|
|
|
* @provide pskl.drawingtools.Rectangle
|
|
|
|
*
|
|
|
|
* @require pskl.utils
|
|
|
|
*/
|
|
|
|
(function() {
|
2013-08-10 14:11:16 +04:00
|
|
|
var ns = $.namespace("pskl.drawingtools");
|
2012-09-02 15:19:20 +04:00
|
|
|
|
2013-08-10 14:11:16 +04:00
|
|
|
ns.Rectangle = function() {
|
2014-04-03 00:21:32 +04:00
|
|
|
ns.ShapeTool.call(this);
|
|
|
|
|
2013-08-10 14:11:16 +04:00
|
|
|
this.toolId = "tool-rectangle";
|
|
|
|
this.helpText = "Rectangle tool";
|
|
|
|
};
|
2012-09-02 15:19:20 +04:00
|
|
|
|
2014-04-03 00:21:32 +04:00
|
|
|
pskl.utils.inherit(ns.Rectangle, ns.ShapeTool);
|
2012-09-02 15:19:20 +04:00
|
|
|
|
2014-04-03 00:21:32 +04:00
|
|
|
ns.Rectangle.prototype.draw_ = function (col, row, color, targetFrame) {
|
2013-08-10 14:11:16 +04:00
|
|
|
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
|
|
|
})();
|