mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
feature : zoom level : code review
+ Switched from BITWISE OR 0 (x | 0) to Math.floor for readability
This commit is contained in:
parent
3af64d3f45
commit
e68ae7f31d
@ -207,8 +207,8 @@
|
||||
y = y + this.offset.y * cellSize;
|
||||
|
||||
return {
|
||||
x : (x / cellSize) | 0,
|
||||
y : (y / cellSize) | 0
|
||||
x : Math.floor(x / cellSize),
|
||||
y : Math.floor(y / cellSize)
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -46,13 +46,13 @@
|
||||
// Draw the zoomed-up pixels to a different canvas context
|
||||
for (var x = 0; x < source.width; x++) {
|
||||
// Calculate X Range
|
||||
xRange = (((x + 1) * zoom) | 0) - xOffset;
|
||||
xRange = Math.floor((x + 1) * zoom) - xOffset;
|
||||
|
||||
for (var y = 0; y < source.height; y++) {
|
||||
// Calculate Y Range
|
||||
if (!yRanges[y + ""]) {
|
||||
// Cache Y Range
|
||||
yRanges[y + ""] = (((y + 1) * zoom) | 0) - yOffset;
|
||||
yRanges[y + ""] = Math.floor((y + 1) * zoom) - yOffset;
|
||||
}
|
||||
yRange = yRanges[y + ""];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user