mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
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
10
js/piskel.js
10
js/piskel.js
@ -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());
|
||||||
|
Loading…
Reference in New Issue
Block a user