Code cleaning: removeFrame & canvas DPI issue
Making the drawing canvas really scalable Cleaning the removeFrame code
This commit is contained in:
parent
6616ec2870
commit
629959e625
1 changed files with 4 additions and 6 deletions
10
js/piskel.js
10
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());
|
||||
|
|
Loading…
Reference in a new issue