ashbb / purple_shoes

Porting Green Shoes with JRuby and SWT
22 stars 2 forks source link

Added :center option to oval #5

Closed wasnotrice closed 12 years ago

wasnotrice commented 12 years ago

The manual says that the oval method can have a :center option, which will make top and left mark the center of the oval. Red Shoes does this, but purple shoes doesn't. Now it does :)

Here's a sample app that should draw a snowman:

Shoes.app do
  oval(200, 100, 40)
  oval(180, 180, 120, 120)
  oval(radius: 100, left: 240, top: 400, center: true)
 end

Before:

before

After:

after

ashbb commented 12 years ago

Hi Eric,

Oh, implementation of :center style. Cool! Your patch works the following snippet:

Shoes.app do
  nofill
  oval 100, 100, 100, 100, center: true
  oval 100, 100, 100, 100
end

But try out one more snippet. Can you get your expected behavior?

Shoes.app do
  nofill
  o = oval 100, 100, 100, 100, center: true
  o.move 100, 100
  oval 100, 100, 100, 100
end
wasnotrice commented 12 years ago

Hi @ashbb,

Good catch! I am just noticing these things as I work on brown shoes, so I haven't thought about move yet :)

That is interesting. I wouldn't have been able to tell you what behavior I expected just by reading the code, but I see that :center is "sticky" in red shoes. I'll take a look and see if I can get it to work in purple!

ashbb commented 12 years ago

Yeah, we may need to implement transform method first. I've not yet tried to do in Green Shoes, though. :-P

ashbb commented 12 years ago

Oh! Sorry, I didn't catch your pull request. Seems like a good idea. So, after doing some little tests, I'll merge. Thanks!