Slot width and subclassing

2009-02-25 Thread Andre Nathan
Hi I was trying to figure out how to center an image in my app, and I found the following weird behaviour: Shoes.app do stack do p width # ok, prints 600 end end but! class Foo < Shoes url '/', :index def index stack do p width # prints 0 :( end end end Shoes.a

Re: Slot width and subclassing

2009-02-25 Thread Kyle King
Changing width to parent.width outputs 600 in both cases. Kyle On Feb 25, 2009, at 9:10 PM, Andre Nathan wrote: Hi I was trying to figure out how to center an image in my app, and I found the following weird behaviour: Shoes.app do stack do p width # ok, prints 600 end end but! cl

Re: Slot width and subclassing

2009-02-25 Thread Andre Nathan
On Wed, 2009-02-25 at 21:33 +, Kyle King wrote: > Changing width to parent.width outputs 600 in both cases. Thank you, that worked. However, I don't think that's what I need... what I was trying to keep the image centered regardless of the window size, like ":align => center" does for text. Is

Re: Slot width and subclassing

2009-02-25 Thread Kyle King
This should horizontally and vertically center an image in any slot: i = image 'your-image.png', :margin_top => '50%', :margin_left => '50%' iw, ih = imagesize 'your_image.png' i.move i.left-(iw/2.0).round, i.top-(ih/2.0).round Cheers, Kyle On Feb 26, 2009, at 12:56 AM,

Re: Slot width and subclassing

2009-02-25 Thread Andre Nathan
On Thu, 2009-02-26 at 01:51 +, Kyle King wrote: > This should horizontally and vertically center an image in any slot: > > i = image 'your-image.png', :margin_top => '50%', :margin_left => '50%' > iw, ih = imagesize 'your_image.png' > i.move i.left-(iw/2.0).round, i.top-(ih/2