fixes odd-number scale factor snap offset

This commit is contained in:
tim h 2022-11-17 22:34:14 -06:00
parent 2553f297d1
commit da593e93ed

View file

@ -275,7 +275,12 @@ function sleep(ms) {
function snap(i) { function snap(i) {
// very cheap test proof of concept but it works surprisingly well // very cheap test proof of concept but it works surprisingly well
var snapOffset = i % basePixelCount; var scaleOffset = 0;
if (scaleFactor % 2 != 0) {
// odd number, snaps to center of cell, oops
scaleOffset = 32;
}
var snapOffset = i % basePixelCount - scaleOffset;
if (snapOffset == 0) { if (snapOffset == 0) {
return snapOffset; return snapOffset;
} }