On Sat, May 20, 2017 at 12:23 AM, Andreas Sunardi <a.suna...@gmail.com> wrote:
> Pharo 5.0 > > It seems like a bug to me, but perhaps I misunderstand something. > > 1) Comment in Rectangle class >> origin:corner: method shows 'origin' > should be top left and 'corner' should be bottom right. This method calls > Rectangle >> setPoint:point:. But this method calculates 'origin' to be > bottom left corner and 'corner' to be top right. Now all the edge and > corner methods are wrong. > > r := Rectangle origin: 0@0 corner: 10@10. > r topLeft. => (0@0) "should be 0@10" > r bottomRight. => (10@10) "should be 10@0" > r top. => 0 "should be 10" > r bottom. => 10 " should be 0" > Would this depend on where you consider 0@0 to be on the screen? (em := EllipseMorph new) openInWorld. em bounds "==> (0@0) corner: (50@40)" > 2) Why Polygon >> bounds (which is PathShape >> bounds) returns a > rectangle with a corner 1 point larger than the actual boundary? > > p1 := Polygon vertices: {0@0 . 0@10 . 10@10 . 10@0}. > p1 bounds. => (0@0) corner: (11@11). "should be 0@0 and 10@10" > > This seems to be a fix to Rectangle >> containsPoint: strange behavior. By > strange behavior, I mean: > > r := Rectangle point: 0@0 point: 10@10. > r containsPoint: 0@0. => true > r containsPoint: 10@10. => false "should be true" > { r topLeft . r topRight . r bottomLeft . r bottomRight } allSatisfy [ > :corner | r containsPoint: corner ]. => false "should be true" > I want to fix this in my image, but Rectangle is used all over the place > and I'm worry I'll break a lot of things. I wonder if I just misunderstood > how these are supposed to be used. Can anybody help me understand if this > is intentional or a bug? > Sorry, I don't know about this. cheers -ben