Code cleaning: removeFrame & canvas DPI issue

Making the drawing canvas really scalable
Cleaning the removeFrame code
This commit is contained in:
Vince 2012-08-28 23:30:55 +02:00
parent 6616ec2870
commit 629959e625

View File

@ -13,7 +13,7 @@
// Scaling factors for a given frameSheet rendering: // Scaling factors for a given frameSheet rendering:
// Main drawing area: // Main drawing area:
drawingCanvasDpi = 10, drawingCanvasDpi = 20,
// Canvas previous in the slideshow: // Canvas previous in the slideshow:
previewTileCanvasDpi = 4, previewTileCanvasDpi = 4,
// Ainmated canvas preview: // Ainmated canvas preview:
@ -208,9 +208,7 @@
canvasPreviewDeleteAction.className = "tile-action" canvasPreviewDeleteAction.className = "tile-action"
canvasPreviewDeleteAction.innerHTML = "del" canvasPreviewDeleteAction.innerHTML = "del"
canvasPreviewDeleteAction.addEventListener('click', function(evt) { canvasPreviewDeleteAction.addEventListener('click', function(evt) {
frameSheet.removeFrameByIndex(tileNumber); piskel.removeFrame(tileNumber);
animIndex = 0;
piskel.createPreviews();
}); });
previewTileRoot.appendChild(canvasPreviewDeleteAction); previewTileRoot.appendChild(canvasPreviewDeleteAction);
} }
@ -287,8 +285,8 @@
}, },
drawAt : function (x, y, color) { drawAt : function (x, y, color) {
var pixelWidthIndex = (x - x%drawingCanvasDpi) / 10; var pixelWidthIndex = (x - x%drawingCanvasDpi) / drawingCanvasDpi;
var pixelHeightIndex = (y - y%drawingCanvasDpi) / 10; var pixelHeightIndex = (y - y%drawingCanvasDpi) / drawingCanvasDpi;
// Update model: // Update model:
var currentFrame = frameSheet.getFrameByIndex(this.getActiveFrameIndex()); var currentFrame = frameSheet.getFrameByIndex(this.getActiveFrameIndex());