Re: Concatenating transforms to scale positions but not objects

2019-08-10 Thread Michael Paus

Nir is right here but if you could ask your question on StackOverflow
I'd be willing to comment on it because I was facing a very similar
problem in my projects and I might provide some ideas.

Am 11.08.19 um 01:25 schrieb Nir Lisker:

I think that this is a better question for StackOverflow. This is a
development mailing list.

- Nir

On Sat, Aug 10, 2019 at 6:53 PM Mark Raynsford  wrote:


On 2019-08-06T19:11:42 +0100
Mark Raynsford  wrote:


Hello!

I realize the subject is somewhat convoluted. I'm putting together
something that bears a passing resemblance to a DAW such as Ardour:

Given the tumbleweeds and sounds of crickets, I'm guessing that I
expressed my question rather poorly.

Here's what I'm trying to do: I'm trying to set up a pane with a
transform such that I can place objects inside that pane using
positions that don't correspond to JavaFX "scene pixels". For example,
1024 units in my coordinate system might correspond to 1 "scene pixel"
(is there a better name for the units that JavaFX uses?). However: The
objects that are *inside* the objects that I add to the pane want to
work in "scene pixels" (for example; Labels seem to want to work in
pixel positions when rendering text).

Here's a GitHub gist that gives a short example of this:

https://gist.github.com/io7m/20b071e11da2dcd96896a43fad6df644

I create one container group (actually a Pane) that adds a transform
such that 1 unit == 32 pixels. I add objects to this container. Each
object I add has an *external* pane with a size and position specified
in units, and an *internal* pane that solely exists to invert the scale
of the transform of the *external* pane. Inside this *internal* pane, I
can add Labels and so on and these all render correctly.

I set up bindings between the transforms so that I can effectively
scale and pan the scene by adjusting the transform on the group
container. However: Something about this setup seems to be confusing
something inside JavaFX; the results I'm seeing onscreen don't seem to
match what JavaFX believes the bounds of various objects are. This
causes visual issues when I try to do things like set borders on
objects, and also seems to confuse ScenicView.

Here's a shot with the container group selected (looks correct):

https://ataxia.io7m.com/2019/08/10/view0.png

Here's a shot with the *external* pane of the bottom object selected:

https://ataxia.io7m.com/2019/08/10/view1.png

Note that, although the object actually renders onscreen as the right
size (one of the pale grey boxes), ScenicView seems to believe that the
object's bounds are 1x1: They *are* 1x1, but they're 1x1 when expressed
in my custom coordinate system, not in JavaFX "scene pixels".

Here's a shot with the *internal* pane of the bottom object selected:

https://ataxia.io7m.com/2019/08/10/view2.png

This looks correct in the sense that the bounds encompass the label and
nothing else.

Am I doing something wrong here? I can't tell if I'm basically abusing
transforms or not.

--
Mark Raynsford | http://www.io7m.com






Re: Concatenating transforms to scale positions but not objects

2019-08-10 Thread Nir Lisker
I think that this is a better question for StackOverflow. This is a
development mailing list.

- Nir

On Sat, Aug 10, 2019 at 6:53 PM Mark Raynsford  wrote:

> On 2019-08-06T19:11:42 +0100
> Mark Raynsford  wrote:
>
> > Hello!
> >
> > I realize the subject is somewhat convoluted. I'm putting together
> > something that bears a passing resemblance to a DAW such as Ardour:
>
> Given the tumbleweeds and sounds of crickets, I'm guessing that I
> expressed my question rather poorly.
>
> Here's what I'm trying to do: I'm trying to set up a pane with a
> transform such that I can place objects inside that pane using
> positions that don't correspond to JavaFX "scene pixels". For example,
> 1024 units in my coordinate system might correspond to 1 "scene pixel"
> (is there a better name for the units that JavaFX uses?). However: The
> objects that are *inside* the objects that I add to the pane want to
> work in "scene pixels" (for example; Labels seem to want to work in
> pixel positions when rendering text).
>
> Here's a GitHub gist that gives a short example of this:
>
> https://gist.github.com/io7m/20b071e11da2dcd96896a43fad6df644
>
> I create one container group (actually a Pane) that adds a transform
> such that 1 unit == 32 pixels. I add objects to this container. Each
> object I add has an *external* pane with a size and position specified
> in units, and an *internal* pane that solely exists to invert the scale
> of the transform of the *external* pane. Inside this *internal* pane, I
> can add Labels and so on and these all render correctly.
>
> I set up bindings between the transforms so that I can effectively
> scale and pan the scene by adjusting the transform on the group
> container. However: Something about this setup seems to be confusing
> something inside JavaFX; the results I'm seeing onscreen don't seem to
> match what JavaFX believes the bounds of various objects are. This
> causes visual issues when I try to do things like set borders on
> objects, and also seems to confuse ScenicView.
>
> Here's a shot with the container group selected (looks correct):
>
> https://ataxia.io7m.com/2019/08/10/view0.png
>
> Here's a shot with the *external* pane of the bottom object selected:
>
> https://ataxia.io7m.com/2019/08/10/view1.png
>
> Note that, although the object actually renders onscreen as the right
> size (one of the pale grey boxes), ScenicView seems to believe that the
> object's bounds are 1x1: They *are* 1x1, but they're 1x1 when expressed
> in my custom coordinate system, not in JavaFX "scene pixels".
>
> Here's a shot with the *internal* pane of the bottom object selected:
>
> https://ataxia.io7m.com/2019/08/10/view2.png
>
> This looks correct in the sense that the bounds encompass the label and
> nothing else.
>
> Am I doing something wrong here? I can't tell if I'm basically abusing
> transforms or not.
>
> --
> Mark Raynsford | http://www.io7m.com
>
>


Re: Concatenating transforms to scale positions but not objects

2019-08-10 Thread Mark Raynsford
On 2019-08-06T19:11:42 +0100
Mark Raynsford  wrote:

> Hello!
> 
> I realize the subject is somewhat convoluted. I'm putting together
> something that bears a passing resemblance to a DAW such as Ardour:

Given the tumbleweeds and sounds of crickets, I'm guessing that I
expressed my question rather poorly.

Here's what I'm trying to do: I'm trying to set up a pane with a
transform such that I can place objects inside that pane using
positions that don't correspond to JavaFX "scene pixels". For example,
1024 units in my coordinate system might correspond to 1 "scene pixel"
(is there a better name for the units that JavaFX uses?). However: The
objects that are *inside* the objects that I add to the pane want to
work in "scene pixels" (for example; Labels seem to want to work in
pixel positions when rendering text).

Here's a GitHub gist that gives a short example of this:

https://gist.github.com/io7m/20b071e11da2dcd96896a43fad6df644

I create one container group (actually a Pane) that adds a transform
such that 1 unit == 32 pixels. I add objects to this container. Each
object I add has an *external* pane with a size and position specified
in units, and an *internal* pane that solely exists to invert the scale
of the transform of the *external* pane. Inside this *internal* pane, I
can add Labels and so on and these all render correctly.

I set up bindings between the transforms so that I can effectively
scale and pan the scene by adjusting the transform on the group
container. However: Something about this setup seems to be confusing
something inside JavaFX; the results I'm seeing onscreen don't seem to
match what JavaFX believes the bounds of various objects are. This
causes visual issues when I try to do things like set borders on
objects, and also seems to confuse ScenicView.

Here's a shot with the container group selected (looks correct):

https://ataxia.io7m.com/2019/08/10/view0.png

Here's a shot with the *external* pane of the bottom object selected:

https://ataxia.io7m.com/2019/08/10/view1.png

Note that, although the object actually renders onscreen as the right
size (one of the pale grey boxes), ScenicView seems to believe that the
object's bounds are 1x1: They *are* 1x1, but they're 1x1 when expressed
in my custom coordinate system, not in JavaFX "scene pixels".

Here's a shot with the *internal* pane of the bottom object selected:

https://ataxia.io7m.com/2019/08/10/view2.png

This looks correct in the sense that the bounds encompass the label and
nothing else.

Am I doing something wrong here? I can't tell if I'm basically abusing
transforms or not.

-- 
Mark Raynsford | http://www.io7m.com