On Thu, Nov 15, 2007 at 11:44:02PM -0800, Michael Daines wrote:
> Might it be possible to include a :click option or similar on shapes at
> some point? Cairo has cairo_in_fill and cairo_in_stroke, which could handle
> hit-testing for stuff like stars and circles, I guess?
Trunk now has events on shapes. Also, release events have been
added. Here's a sample:
Shoes.app do
@drag = nil
@o = oval(100, 100, 100, 100)
@o.click do
_, x, y = self.mouse
@drag = [EMAIL PROTECTED], x - @o.left, y - @o.top]
end
@o.release do
@drag = nil
end
motion do |x, y, b|
if @drag
@drag[0].move x - @drag[1], y - @drag[2]
end
end
end
Thanks for the pointer to cairo_in_fill, that was exactly the
thing.
_why