math on widths doesn't add up

hh hh at hyperhh.de
Fri Jun 14 15:55:55 EDT 2019


Nothing is wrong:
If you have a row then left is the integer left of first pixel
and right is the integer right of last pixel.

So left and right are the integers that limit the object, NOT pixel numbers.

As to your example:
pixel 1 ranges from 0 to 1, ... pixel 12 ranges from 11 to 12.
The left is 0, the right is 12, the width is 12=right-left.

> Richard H. wrote:
> Playing around with a couple of things needing alignment, I’ve noticed that the math on widths and edges isn’t quite right.
> For example, I have a boundary rect of width 12, with a left of 0 and a right of 12.
> One of these is wrong . . . a width of 12 would go from 0 to 11; 0 to 12 is 13 pixels wide . . .
> It seems that “right” actually means, “the pixel to the right of” . . .





More information about the Use-livecode mailing list