Object's rleft value is shown to four decimal places


#1

This code,

objectinfoarray({rectanglesizestr(objectinfo("rectangle"))}, {objectinfo("selected")}, cr())

for four selected objects in a form in graphics mode, produces this result:

45%20pm

The three or four decimal places seems a bit OTT. Is it intentional?


#2

It seems to be always the same decimal value. This could be the result of the manual positioning of the first object.
Check the x-Position of each object and remove the decimals.


#3

In Cocoa (OS X), graphical coordinates are floating point numbers.

If it bothers you to have non-integer coordinates, you can use this function to round a rectangle’s coordinates to integer values.


#4

It does because it makes sorting a two-dimensional array messier. Rounding the values is good.


#5

I think “bothers you” was the wrong phrase to use. I added the integralrectangle( and integralpoint( functions because sometimes a an integer is needed or greatly preferred. I’m glad it came in handy here.