Skip to content

Always draw crosshair on half-pixels to prevent aliasing #924

Merged
merged 0 commits into from Jan 10, 2013

2 participants

@danxshap

Round the coordinates to the nearest whole number and then conditionally add 0.5 pixels if the line width is odd. This makes it so the crosshair is never drawn in between screen pixels and so it will always look crisp/clear.

@dnschnur
Flot member

This is basically the same as #17, which I should have merged a while ago, but this implementation is a little nicer and more robust. Since this is pretty straightforward I'm going to merge this for 0.8, then later pull in the rest of the other one, which involves sub-pixel fixes for the selection plugin.

Thanks for submitting this!

@dnschnur dnschnur was assigned Jan 10, 2013
@dnschnur
Flot member

On second thought, the other implementation is nicer in that it applies the offsets only when drawing, rather than actually changing the crosshair position. That makes more sense to me. If you'd like to update your implementation, I'll merge that; otherwise I'll take another look at this later this evening, and probably end up taking some of both.

@danxshap danxshap merged commit 3c0bcef into flot:master Jan 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.