freak4pc/UIView-Positioning

Method centerToParent not working properly due PIXEL_INTEGRAL

Closed this issue · 2 comments

I deleted PIXEL_INTEGRAL from centerToParent and then became the center of the button.

the PIXEL_INTEGRAL macro is missing brackets... so

basically it is:
#define PIXEL_INTEGRAL(pointValue) (roundf(pointValue * scale) / scale)

so PIXEL_INTEGRAL(4-3) is expanded to (roundf(4 - 3 * scale) / scale) and 3*scale is calculated before 4-3

Upcoming Swift version should fix this. Might fix the Objective-C version as well :)