-
Notifications
You must be signed in to change notification settings - Fork 6
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
Possible one pixel off in debug rects #4
Comments
You mean this line: https://github.com/saynomoo/mig4android/blob/master/mig4android/src/main/java/com/saynomoo/mig4android/MigLayout.java#L151 ? If I change that, the miglayout cell right line is one pixel too left and the bottom line is one pixel too up. This is at least how it works with samsung galaxy nexus and the emulator. Did you mean the debug rects of the components inside the layout? Those rectangles are drawn with the method drawChildCell. Can you provide a layout which would easily demonstrate the problem you are experiencing? |
It was probably the wrong line. The problem is this. If you have layout that is using the whole screen, then the right and bottom line is not visible since they are drawn one pixel outside the screen. The right and bottom line should actually be on the last pixel of the layout, now they are painted to the right and bottom of the layout. For instance, in the Swing version this is the code: public final void paintDebugCell(int x, int y, int width, int height)
} |
Actually, you can see this in your examples as well. The right edge is missing on my two Samsung devices. |
Since I changed the minSdkVersion to 4, the off by one errors started to show. Since it's now "required" anyway to use minSdkVersion 4, I changed the debug rects accoringly. Fixed in commit ccb8347 |
I think that maybe
private void drawLayoutCell(Canvas canvas)
{
canvas.drawRect(0.0F, 1.0F, getWidth(), getHeight(), cellPaint);
}
should be
private void drawLayoutCell(Canvas canvas)
{
canvas.drawRect(0.0F, 1.0F, getWidth() - 1, getHeight() - 1, cellPaint);
}
At least Swing draws the right and bottom edge of a rectangle to the right/bottom of the last pixel and one want the right and bottom edge to be inside the layout I think. If for instance you have a layout the covers the full screen the original method will at least draws the right/bottom edge outside the screen (verified on my Galaxy S2).
Cheers,
Mikael
The text was updated successfully, but these errors were encountered: