From 629959e62515884b2022529326f14bb35762bce8 Mon Sep 17 00:00:00 2001 From: Vince Date: Tue, 28 Aug 2012 23:30:55 +0200 Subject: [PATCH] Code cleaning: removeFrame & canvas DPI issue Making the drawing canvas really scalable Cleaning the removeFrame code --- js/piskel.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/piskel.js b/js/piskel.js index c74870d..b033649 100644 --- a/js/piskel.js +++ b/js/piskel.js @@ -13,7 +13,7 @@ // Scaling factors for a given frameSheet rendering: // Main drawing area: - drawingCanvasDpi = 10, + drawingCanvasDpi = 20, // Canvas previous in the slideshow: previewTileCanvasDpi = 4, // Ainmated canvas preview: @@ -208,9 +208,7 @@ canvasPreviewDeleteAction.className = "tile-action" canvasPreviewDeleteAction.innerHTML = "del" canvasPreviewDeleteAction.addEventListener('click', function(evt) { - frameSheet.removeFrameByIndex(tileNumber); - animIndex = 0; - piskel.createPreviews(); + piskel.removeFrame(tileNumber); }); previewTileRoot.appendChild(canvasPreviewDeleteAction); } @@ -287,8 +285,8 @@ }, drawAt : function (x, y, color) { - var pixelWidthIndex = (x - x%drawingCanvasDpi) / 10; - var pixelHeightIndex = (y - y%drawingCanvasDpi) / 10; + var pixelWidthIndex = (x - x%drawingCanvasDpi) / drawingCanvasDpi; + var pixelHeightIndex = (y - y%drawingCanvasDpi) / drawingCanvasDpi; // Update model: var currentFrame = frameSheet.getFrameByIndex(this.getActiveFrameIndex());