mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Previews are fixed. Removed drawing methods from piskel .js
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
ns.Eraser.prototype.applyToolAt = function(col, row, frame) {
|
||||
this.superclass.applyToolAt.call(this, col, row, frame, Constants.TRANSPARENT_COLOR);
|
||||
ns.Eraser.prototype.applyToolAt = function(col, row, color, drawer) {
|
||||
this.superclass.applyToolAt.call(this, col, row, Constants.TRANSPARENT_COLOR, drawer);
|
||||
};
|
||||
})();
|
@ -73,7 +73,7 @@
|
||||
var nextCol = currentItem.col + dx[i]
|
||||
var nextRow = currentItem.row + dy[i]
|
||||
try {
|
||||
if (frame.isInFrame(nextCol, nextRow) && frame.getPixel(nextCol, nextRow) == targetColor) {
|
||||
if (frame.containsPixel(nextCol, nextRow) && frame.getPixel(nextCol, nextRow) == targetColor) {
|
||||
queue.push({"col": nextCol, "row": nextRow });
|
||||
}
|
||||
} catch(e) {
|
||||
|
@ -52,7 +52,7 @@
|
||||
*/
|
||||
ns.Rectangle.prototype.releaseToolAt = function(col, row, color, drawer) {
|
||||
// If the stroke tool is released outside of the canvas, we cancel the stroke:
|
||||
if(drawer.frame.isInFrame(col, row)) {
|
||||
if(drawer.frame.containsPixel(col, row)) {
|
||||
var strokePoints = this.getRectanglePixels_(this.startCol, col, this.startRow, row);
|
||||
for(var i = 0; i< strokePoints.length; i++) {
|
||||
// Change model:
|
||||
|
@ -19,13 +19,15 @@
|
||||
* @override
|
||||
*/
|
||||
ns.SimplePen.prototype.applyToolAt = function(col, row, color, drawer) {
|
||||
this.previousCol = col;
|
||||
this.previousRow = row;
|
||||
drawer.frame.setPixel(col, row, color);
|
||||
if (drawer.frame.containsPixel(col, row)) {
|
||||
this.previousCol = col;
|
||||
this.previousRow = row;
|
||||
drawer.frame.setPixel(col, row, color);
|
||||
|
||||
// Draw on canvas:
|
||||
// TODO: Remove that when we have the centralized redraw loop
|
||||
drawer.renderFramePixel(col, row);
|
||||
// Draw on canvas:
|
||||
// TODO: Remove that when we have the centralized redraw loop
|
||||
drawer.renderFramePixel(col, row);
|
||||
}
|
||||
};
|
||||
|
||||
ns.SimplePen.prototype.moveToolAt = function(col, row, color, drawer) {
|
||||
|
@ -69,7 +69,7 @@
|
||||
ns.Stroke.prototype.releaseToolAt = function(col, row, color, drawer) {
|
||||
// If the stroke tool is released outside of the canvas, we cancel the stroke:
|
||||
// TODO: Mutualize this check in common method
|
||||
if(drawer.frame.isInFrame(col, row)) {
|
||||
if(drawer.frame.containsPixel(col, row)) {
|
||||
// The user released the tool to draw a line. We will compute the pixel coordinate, impact
|
||||
// the model and draw them in the drawing canvas (not the fake overlay anymore)
|
||||
var strokePoints = this.getLinePixels_(this.startCol, col, this.startRow, row);
|
||||
|
Reference in New Issue
Block a user