(1) display.newRect sets x,y position using (top,left), which is (5,60) here. But the default registration point of any display object is the CENTER of the object, so unless you change its registration point, all further access to (x,y) is assumed to be the center of the object, not its top left corner.
(2) Adding a stroke makes an object larger. Specifically, the stroke will center on the object boundaries, but will snap OUTWARDS to the next whole pixel (otherwise odd-pixel stroke widths would be fuzzy). So a 2-pixel stroke will add a row of pixels inside and a row outside, but a 1-pixel stroke will simply add a row to the outside.
If you remove the stroke from the case above, you will see that it goes back to reporting a width and height of (70,70) – I just tested this myself.
However, it seems like the correct result with this 1-pixel stroke should be (72,72) rather than (74,74). Also, I just tested a variety of other stroke widths, and the same thing happens: the result is 2 more than what it seems like it should be. So I’m logging this latter part as a bug. [import]uid: 3007 topic_id: 975 reply_id: 2227[/import]
Could you please also update your documentation (which mentions neither the fact, that a “strokewidth” modifies the size of an object nor the “registration point” of a rectangle)
B.t.w: what is the “registration point”? Is it the “reference point”? Or s.th. else?
Again, an update of the documentation would be useful!
Thanks in advance for your effort!
Kind regards,
Andreas Rozek [import]uid: 4331 topic_id: 975 reply_id: 2228[/import]