pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Issue with use of StackPane, Label, and ScaleDecorator
Date Thu, 25 Jul 2013 23:42:04 GMT
Erik.

What is it you are trying to achieve with the ScaleDecorator?  I think the
'issue' stems from the use of StackPane, but without knowing what you are
aiming for it is hard to know if it *is* and issue :)  I looked at your
previous question and wonder if using a Panel inside of the StackPane might
help.

Anyway...

You can add a ShadeDecorator to the label in your example to highlight its
bounds and visualize what is currently happening.  This shows that the
label is normally the size of the StackPane before ScaleDecorator shrinks
it.
label.getDecorators().add(new ShadeDecorator(0.3f, Color.GREEN)); //
ShadeDecorator

ScaleDecorator has properties to control vertical and horizontal alignment,
both of which default to 'CENTER'
http://pivot.apache.org/2.0.2/docs/api/org/apache/pivot/wtk/effects/ScaleDecorator.html
http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java

You can change these and rerun your example to see that the text no longer
appears to be pushed into the center of the window.
final ScaleDecorator sd = new ScaleDecorator();
sd.setHorizontalAlignment(HorizontalAlignment.LEFT);
sd.setVerticalAlignment(VerticalAlignment.TOP);

Chris



On 25 July 2013 00:40, Erik Innocent <einnocent@gmail.com> wrote:

> To Roger, thanks for your help with my issue with Label positioning with
> StackPane. But now i'm having an issue with scaling and how it affects
> positioning.
>
> The problem is that as I scale down a Label with ScaleDecorator when using
> StackPane, the Label moves toward the center of the display. I've provided
> a test case at:
>
> https://gist.github.com/einnocent/6075609
>
> Is this correct behavior? I was expecting the label to remain in the same
> place. Note that even when I do a Label.setLocation(), it has no effect
> (uncomment the line in Runnable.run() to see this).
>
> What can do I to make the Label remain at its origin?
>
> I genuinely appreciate your time in looking into this, and I thank you
> again.
> --E
>
> PS -- Marek Repak, you can remove yourself from this list by sending an
> email to user-unsubscribe@pivot.apache.org
>
>

Mime
View raw message