-
-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ugly scaling on mobile #103
Comments
Also this should apply to 98, and I'm not sure how it might apply to jspaint when it's in an iframe; it might compound, which wouldn't be good. |
var updateZoomScale = function(){
var desiredDPR = Math.floor(devicePixelRatio);
document.body.style.zoom = desiredDPR / devicePixelRatio;
};
updateZoomScale();
var lastDPR = devicePixelRatio;
addEventListener("resize", function(){
updateZoomScale();
if(lastDPR !== devicePixelRatio){
console.log("ur zoomin'");
// TODO: show a message to users here to let them know the zoom is being counteracted to make it even numbers of pixels to avoid jaggedness, but only within.. buckets? slices? intervals? and they can zoom in or out further for it to change
}
lastDPR = devicePixelRatio;
}); This isn't enough. On 98 it breaks at least:
On jspaint it breaks at least:
|
Compromise for #103 Note that this uncovers weird buggy browser behavior where canvas HiDPI state is remembered per undo state, and can fluctuate based on mouse presses (often makes it go antialiased) and undoing (often makes it go aliased), and it can even go partially antialiased, in redraw regions as you paint. Also it definitely needs additional handling for the canvas itself, which can have a magnification factor.
I've implemented a compromise approach, where it chooses between disabling antialiasing or not based on whether it's an integer scaling size (or large enough that it doesn't matter that the pixels are uneven in size). It's not that good of a compromise because Chrome at least has this bug where it'll do horrible flickering between antialiased and aliased. It's worth looking into making the canvas (and selections) scale w/ the magnification code I already have (apply an additional scalar anywhere |
On mobile, it looks like this for me currently:
Yuck.
Pixels aren't square; some are tall, some are wide.
Look at the icon for the rectangle tool, it's not even straight on the top and bottom!
I could do:
but I'm not sure what the implications of this might be; it might make buttons really small. It might confuse some code using
getBoundingClientRect()
, etc.Also for screens that have a higher scale than 1.5, like 2 or more, it should almost certainly round down to the nearest integer.
The text was updated successfully, but these errors were encountered: