From 35736949d8e56157f9582273fc51393b2217213c Mon Sep 17 00:00:00 2001 From: Vince Date: Mon, 3 Sep 2012 01:34:11 +0200 Subject: [PATCH] Shit merge --- js/Constants.js | 7 ++++--- js/Events.js | 2 +- js/drawingtools/Eraser.js | 7 ++++++- js/drawingtools/PaintBucket.js | 8 +++++++- js/drawingtools/Rectangle.js | 5 ++++- js/drawingtools/SimplePen.js | 5 +++++ js/drawingtools/Stroke.js | 3 +++ js/piskel.js | 3 +-- 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/js/Constants.js b/js/Constants.js index 05c51425..f7c397dd 100644 --- a/js/Constants.js +++ b/js/Constants.js @@ -1,5 +1,6 @@ var Constants = { - DEFAULT_PEN_COLOR : "#000000", - TRANSPARENT_COLOR : "TRANSPARENT", - PISKEL_SERVICE_URL : "http://2.piskel-app.appspot.com" + + DEFAULT_PEN_COLOR : '#000000', + TRANSPARENT_COLOR : "TRANSPARENT", + PISKEL_SERVICE_URL: 'http://2.piskel-app.appspot.com' }; \ No newline at end of file diff --git a/js/Events.js b/js/Events.js index cfd9aa07..abcee5dc 100644 --- a/js/Events.js +++ b/js/Events.js @@ -20,7 +20,7 @@ Events = { * TODO: Remove or rework when redraw system is refactored. */ REFRESH: "REFRESH", + SHOW_NOTIFICATION: "SHOW_NOTIFICATION", HIDE_NOTIFICATION: "HIDE_NOTIFICATION" - }; \ No newline at end of file diff --git a/js/drawingtools/Eraser.js b/js/drawingtools/Eraser.js index cd2cdd79..7cda1fc4 100644 --- a/js/drawingtools/Eraser.js +++ b/js/drawingtools/Eraser.js @@ -20,7 +20,7 @@ // Change model: frame[col][row] = Constants.TRANSPARENT_COLOR; - + // Draw on canvas: // TODO: Remove that when we have the centralized redraw loop this.drawPixelInCanvas(col, row, canvas, Constants.TRANSPARENT_COLOR, dpi); @@ -33,4 +33,9 @@ this.applyToolAt(col, row, frame, color, canvas, dpi); }; + ns.Eraser.prototype.releaseToolAt = function(col, row, frame, color, canvas, dpi) { + // TODO: Create a afterRelease event hook or put that deep in the model + $.publish(Events.FRAMESHEET_UPDATED); + }; + })(); \ No newline at end of file diff --git a/js/drawingtools/PaintBucket.js b/js/drawingtools/PaintBucket.js index ed016798..f953cb43 100644 --- a/js/drawingtools/PaintBucket.js +++ b/js/drawingtools/PaintBucket.js @@ -21,12 +21,18 @@ var targetColor = pskl.utils.normalizeColor(frame[col][row]); //this.recursiveFloodFill_(frame, col, row, targetColor, color); this.queueLinearFloodFill_(frame, col, row, targetColor, color); - + $.publish(Events.FRAMESHEET_UPDATED); + // Draw in canvas: // TODO: Remove that when we have the centralized redraw loop this.drawFrameInCanvas(frame, canvas, dpi); }; + ns.PaintBucket.prototype.releaseToolAt = function(col, row, frame, color, canvas, dpi) { + // TODO: Create a afterRelease event hook or put that deep in the model + $.publish(Events.FRAMESHEET_UPDATED); + }; + /** * Flood-fill (node, target-color, replacement-color): * 1. Set Q to the empty queue. diff --git a/js/drawingtools/Rectangle.js b/js/drawingtools/Rectangle.js index d139ee04..c955aac1 100644 --- a/js/drawingtools/Rectangle.js +++ b/js/drawingtools/Rectangle.js @@ -81,9 +81,12 @@ // TODO: Remove that when we have the centralized redraw loop this.drawPixelInCanvas(strokePoints[i].col, strokePoints[i].row, canvas, color, dpi); } - + // For now, we are done with the stroke tool and don't need an overlay anymore: this.removeCanvasOverlays(); + + // TODO: Create a afterRelease event hook or put that deep in the model + $.publish(Events.FRAMESHEET_UPDATED); }; /** diff --git a/js/drawingtools/SimplePen.js b/js/drawingtools/SimplePen.js index a7d4f45c..8dbeb222 100644 --- a/js/drawingtools/SimplePen.js +++ b/js/drawingtools/SimplePen.js @@ -52,4 +52,9 @@ this.previousCol = col; this.previousRow = row; }; + + ns.SimplePen.prototype.releaseToolAt = function(col, row, frame, color, canvas, dpi) { + // TODO: Create a afterRelease event hook or out that deep in the model + $.publish(Events.FRAMESHEET_UPDATED); + }; })(); diff --git a/js/drawingtools/Stroke.js b/js/drawingtools/Stroke.js index 6702a2c8..89d5ae21 100644 --- a/js/drawingtools/Stroke.js +++ b/js/drawingtools/Stroke.js @@ -97,6 +97,9 @@ // For now, we are done with the stroke tool and don't need an overlay anymore: this.removeCanvasOverlays(); + + // TODO: Create a afterRelease event hook or out that deep in the model + $.publish(Events.FRAMESHEET_UPDATED); }; })(); diff --git a/js/piskel.js b/js/piskel.js index aad3d4ab..38995d74 100644 --- a/js/piskel.js +++ b/js/piskel.js @@ -95,8 +95,7 @@ $.namespace("pskl"); // TODO: Move this into their service or behavior files: this.initDrawingArea(); - this.initPreviewSlideshow(); - this.initAnimationPreview(); + this.initPreviewSlideshow(); this.startAnimation(); pskl.ToolSelector.init();