I don't think a Decorator is going to help here. Decorators are, by definition, non-interactive (they just "decorate"). You'll probably need to create a custom ScalePane class that overrides paint() and the mouse handling methods (there's currently no way to do that at the skin level). G
On Jul 15, 2011, at 5:51 PM, Bill van Melle wrote: > A while back I submitted a feature request for a "ScalePane", a container > that would automatically scale its contents to the container's actual size > (https://issues.apache.org/jira/browse/PIVOT-710). I find myself increasingly > in need of such a beast, or at least something like it -- I'd settle for a > container that I could set a scale factor on. Some of the work is already > done in the form of ScaleDecorator, but the decorator handles only the output > side. If you have any interactive content, the mouse hits are all wrong (I > include a simple demonstration of the issue below). > > Anyway, I want to take a crack at implementing a scaling container, and > wondered if any of the experts here had suggestions for the right approach. > At first blush, it seems like I could add a ScaleDecorator, and then override > all the mouse-related events in the skin to scale the x,y coordinates before > passing them in to the container's component. Are there other things to worry > about? > > > The example: clicking on the first checkbox checks the second checkbox. > > <Window title="Scale fail" maximized="true" > xmlns:bxml="http://pivot.apache.org/bxml" > xmlns:effects="org.apache.pivot.wtk.effects" > xmlns="org.apache.pivot.wtk"> > <BoxPane> > <Border styles="{color:10,thickness:8,padding:4}"> > <decorators> > <effects:ScaleDecorator scaleY="2" scaleX="2" > horizontalAlignment="left" verticalAlignment="top" /> > </decorators> > <BoxPane orientation="vertical"> > <Checkbox buttonData="Checkbox 1" tooltipText="This is the first checkbox" /> > <Checkbox buttonData="Checkbox 2" tooltipText="This is the second checkbox" /> > </BoxPane> > </Border> > </BoxPane> > </Window> >
