The comment on https://pkg.go.dev/gioui.org/io/pointer#Event :
// Position is the position of the event, relative to
// the current transformation, as set by op.TransformOp.
Position f32.Point
What's the intended semantics of "relative"? How is position relative
to a transformation?
thanks!
>> What's the intended semantics of "relative"? How is position relative> to a transformation?>
As I understand it, a 2d point is described by two coordinates, where
each coordinate measures some distance from an origin along (usually)
perpendicular axes. You can phrase this a different way to say that
the point describes a location _relative_ to the origin. In this case,
the origin for the point has been transformed (i.e. shifted, rotated,
etc) to a different place, so the origin for the point is no longer
the top-left corner of the window. Thus, the location described by the
point is relative to the transformation, not relative to the top-left
corner of the window.
On Wed, 15 Nov 2023 at 07:40, Jeff Williams <kanobe@gmail.com> wrote:
>> >> > What's the intended semantics of "relative"? How is position relative> > to a transformation?> >>> As I understand it, a 2d point is described by two coordinates, where> each coordinate measures some distance from an origin along (usually)> perpendicular axes. You can phrase this a different way to say that> the point describes a location _relative_ to the origin. In this case,> the origin for the point has been transformed (i.e. shifted, rotated,> etc) to a different place, so the origin for the point is no longer> the top-left corner of the window. Thus, the location described by the> point is relative to the transformation, not relative to the top-left> corner of the window.
Correct, the position is in the local coordinate system of the receiving tag.
I've (hopefully) cleared up the documentation in
https://git.sr.ht/~eliasnaur/gio/commit/23b6f06e3e0bd85cc52d928f418db4d6692b39a7
Elias
Cool, thanks all!
On 11/15/23, Elias Naur <mail@eliasnaur.com> wrote:
> On Wed, 15 Nov 2023 at 07:40, Jeff Williams <kanobe@gmail.com> wrote:>>>> >>> > What's the intended semantics of "relative"? How is position relative>> > to a transformation?>> >>>>> As I understand it, a 2d point is described by two coordinates, where>> each coordinate measures some distance from an origin along (usually)>> perpendicular axes. You can phrase this a different way to say that>> the point describes a location _relative_ to the origin. In this case,>> the origin for the point has been transformed (i.e. shifted, rotated,>> etc) to a different place, so the origin for the point is no longer>> the top-left corner of the window. Thus, the location described by the>> point is relative to the transformation, not relative to the top-left>> corner of the window.>> Correct, the position is in the local coordinate system of the receiving> tag.> I've (hopefully) cleared up the documentation in>> https://git.sr.ht/~eliasnaur/gio/commit/23b6f06e3e0bd85cc52d928f418db4d6692b39a7>> Elias>