From 31d2f90bfeb5851dbef448ae30eac5782892452b Mon Sep 17 00:00:00 2001 From: Vince Date: Sun, 16 Sep 2012 15:35:30 +0200 Subject: [PATCH 1/6] highlight target tool pixel - intial commit --- js/Constants.js | 2 ++ js/drawingtools/BaseTool.js | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/js/Constants.js b/js/Constants.js index 1f676f0e..c9440a27 100644 --- a/js/Constants.js +++ b/js/Constants.js @@ -8,6 +8,8 @@ var Constants = { * strokes and rectangles: */ SELECTION_TRANSPARENT_COLOR: 'rgba(255, 255, 255, 0.6)', + + TOOL_TARGET_HIGHLIGHT_COLOR: 'rgba(255, 255, 255, 0.2)', /* * Default entry point for piskel web service: diff --git a/js/drawingtools/BaseTool.js b/js/drawingtools/BaseTool.js index d2fd9477..ec12092d 100644 --- a/js/drawingtools/BaseTool.js +++ b/js/drawingtools/BaseTool.js @@ -12,7 +12,24 @@ ns.BaseTool.prototype.moveToolAt = function(col, row, color, frame, overlay) {}; - ns.BaseTool.prototype.moveUnactiveToolAt = function(col, row, color, frame, overlay) {}; + ns.BaseTool.prototype.moveUnactiveToolAt = function(col, row, color, frame, overlay) { + if (overlay.containsPixel(col, row)) { + if (this.previouslyHighlightedPixelCol && + this.previouslyHighlightedPixelRow && + (this.previouslyHighlightedPixelRow != row || + this.previouslyHighlightedPixelCol != col)) { + + // Clean the previously highlighted pixel: + overlay.clear(); + } + + // Show the current pixel targeted by the tool: + overlay.setPixel(col, row, Constants.TOOL_TARGET_HIGHLIGHT_COLOR); + + this.previouslyHighlightedPixelCol = col; + this.previouslyHighlightedPixelRow = row; + } + }; ns.BaseTool.prototype.releaseToolAt = function(col, row, color, frame, overlay) {}; From 6369fb4656408feb362f045dae81236cafd8ee89 Mon Sep 17 00:00:00 2001 From: Vince Date: Sun, 16 Sep 2012 15:47:39 +0200 Subject: [PATCH 2/6] adding comments --- js/Constants.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/Constants.js b/js/Constants.js index c9440a27..1290e5e9 100644 --- a/js/Constants.js +++ b/js/Constants.js @@ -9,6 +9,10 @@ var Constants = { */ SELECTION_TRANSPARENT_COLOR: 'rgba(255, 255, 255, 0.6)', + /* + * When a tool is hovering the drawing canvas, we highlight the eventual + * pixel target with this color: + */ TOOL_TARGET_HIGHLIGHT_COLOR: 'rgba(255, 255, 255, 0.2)', /* From 0cb121ea967e702d479955fd3770cd84814a45ba Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Sun, 16 Sep 2012 17:04:40 +0300 Subject: [PATCH 3/6] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d5966f02..bdff2500 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ The goal is to create an easy-to-use/in-the-cloud/web-based 2d animation editor. Try it at : http://juliandescottes.github.com/piskel/ +16 Sep 2012 +------------------------------------ +Just a quick update to post a new screenshot. @grosbouddha is delivering features so fast, it's hard to keep up ! + +![Screenshot 4](https://dl.dropbox.com/u/17803671/screen_piskel_4.png "Screenshot 4") + 15 Sep 2012 ------------------------------------ 2 weeks already since the last README.md update, and so many changes ! There has been a continuous stream of features added to piskel by @grosboudda, @captainbrosset (thanks guys) and myself. From 324c2b464e2a8c9f28a9e92bca949e6fdf14cb5c Mon Sep 17 00:00:00 2001 From: Vince Date: Sun, 16 Sep 2012 16:16:09 +0200 Subject: [PATCH 4/6] Fix broken palette when swithcing tiles --- js/Events.js | 2 ++ js/controller/PaletteController.js | 2 +- js/model/FrameSheet.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/js/Events.js b/js/Events.js index 7afb8486..add57b82 100644 --- a/js/Events.js +++ b/js/Events.js @@ -29,6 +29,8 @@ Events = { GRID_DISPLAY_STATE_CHANGED: "GRID_DISPLAY_STATE_CHANGED", + FRAMESHEET_RELOADED: "FRAMESHEET_RELOADED", + /** * The framesheet was reseted and is now probably drastically different. * Number of frames, content of frames, color used for the palette may have changed. diff --git a/js/controller/PaletteController.js b/js/controller/PaletteController.js index 816f25d5..13302b02 100644 --- a/js/controller/PaletteController.js +++ b/js/controller/PaletteController.js @@ -88,7 +88,7 @@ // Initialize palette: this.createPalette_(this.framesheet.getUsedColors()); - $.subscribe(Events.FRAMESHEET_RESET, $.proxy(function(evt) { + $.subscribe(Events.FRAMESHEET_RELOADED, $.proxy(function(evt) { this.createPalette_(this.framesheet.getUsedColors()); }, this)); diff --git a/js/model/FrameSheet.js b/js/model/FrameSheet.js index 721c63b0..691870a1 100644 --- a/js/model/FrameSheet.js +++ b/js/model/FrameSheet.js @@ -68,6 +68,7 @@ var frameCfg = frameConfigurations[i]; this.addFrame(new ns.Frame(frameCfg)); } + $.publish(Events.FRAMESHEET_RELOADED); $.publish(Events.FRAMESHEET_RESET); } catch (e) { throw "Could not load serialized framesheet : " + e.message From e519eb1feb40ebd271d7d7966e45f95819e927b8 Mon Sep 17 00:00:00 2001 From: Vince Date: Sun, 16 Sep 2012 16:42:21 +0200 Subject: [PATCH 5/6] =?UTF-8?q?renaming=20+=20bug=20fixing=20(0=20consider?= =?UTF-8?q?ed=20as=20false=20=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/drawingtools/BaseTool.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/drawingtools/BaseTool.js b/js/drawingtools/BaseTool.js index ec12092d..b0c1dba5 100644 --- a/js/drawingtools/BaseTool.js +++ b/js/drawingtools/BaseTool.js @@ -14,10 +14,10 @@ ns.BaseTool.prototype.moveUnactiveToolAt = function(col, row, color, frame, overlay) { if (overlay.containsPixel(col, row)) { - if (this.previouslyHighlightedPixelCol && - this.previouslyHighlightedPixelRow && - (this.previouslyHighlightedPixelRow != row || - this.previouslyHighlightedPixelCol != col)) { + if (!isNaN(this.highlightedPixelCol) && + !isNaN(this.highlightedPixelRow) && + (this.highlightedPixelRow != row || + this.highlightedPixelCol != col)) { // Clean the previously highlighted pixel: overlay.clear(); @@ -26,8 +26,8 @@ // Show the current pixel targeted by the tool: overlay.setPixel(col, row, Constants.TOOL_TARGET_HIGHLIGHT_COLOR); - this.previouslyHighlightedPixelCol = col; - this.previouslyHighlightedPixelRow = row; + this.highlightedPixelCol = col; + this.highlightedPixelRow = row; } }; From a4036e0f65ed07cb04d61620ce20573272ca52c7 Mon Sep 17 00:00:00 2001 From: Vince Date: Sun, 16 Sep 2012 17:25:51 +0200 Subject: [PATCH 6/6] fix for real palette bug --- js/Events.js | 2 -- js/controller/PaletteController.js | 39 ++++++++++++++++++++---------- js/model/FrameSheet.js | 1 - 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/js/Events.js b/js/Events.js index add57b82..1f6a897a 100644 --- a/js/Events.js +++ b/js/Events.js @@ -28,8 +28,6 @@ Events = { REDRAW_PREVIEWFILM: "REDRAW_PREVIEWFILM", GRID_DISPLAY_STATE_CHANGED: "GRID_DISPLAY_STATE_CHANGED", - - FRAMESHEET_RELOADED: "FRAMESHEET_RELOADED", /** * The framesheet was reseted and is now probably drastically different. diff --git a/js/controller/PaletteController.js b/js/controller/PaletteController.js index 13302b02..bca36b94 100644 --- a/js/controller/PaletteController.js +++ b/js/controller/PaletteController.js @@ -14,15 +14,22 @@ $.publish(Events.COLOR_SELECTED, [inputPicker.val(), evt.data.isPrimary]); }; - /** + /** * @private */ - ns.PaletteController.prototype.createPalette_ = function (colors) { + ns.PaletteController.prototype.createPaletteMarkup_ = function (colors) { // Always adding transparent color this.paletteRoot.html(''); - for(var color in colors) { + + for(var i=0, l=this.paletteColors.length; i