| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.ui.pointer; |
| |
| /// A floating-point 3x3 matrix. |
| /// - The values are placed in column-major order. |
| alias Mat3 = array<float32, 9>; |
| |
| /// A floating-point two-dimensional point. |
| /// - The values are placed in (x, y) order. |
| alias Point2 = array<float32, 2>; |
| |
| /// An axis-aligned rectangle. It is defined by its minimal and maximal extents |
| /// in a coordinate system. |
| type Rectangle = struct { |
| /// The minimal extent of this rectangle, inclusive. |
| /// - Its coordinates are pairwise less than the maximal extent's |
| /// coordinates. |
| min Point2; |
| |
| /// The maximal extent of this rectangle, inclusive. |
| /// - Its coordinates are pairwise greater than the minimal extent's |
| /// coordinates. |
| max Point2; |
| }; |
| |
| /// The parameters of the associated view and viewport, sufficient to correctly |
| /// interpret the position and scale of pointer events dispatched to this view. |
| /// |
| /// Ordering. These parameters arrive over the same channel as pointer events, |
| /// to provide synchronous context for interpreting the position of pointer |
| /// events in the view's local coordinate system. |
| /// |
| /// Inter-protocol redundancy. Some of these parameters may also be sent over an |
| /// independent channel dedicated to view control; the client is responsible for |
| /// correct use of asynchronously received parameters. |
| /// |
| /// TODO(fxbug.dev/81798): Rename viewport, it is used in Flatland. |
| type ViewParameters = struct { |
| /// The view's area of content, placed in the coordinate system of the view. |
| /// |
| /// The rectangle is defined by the parent view's setup of clipping on this |
| /// view. |
| view Rectangle; |
| |
| /// The viewport's area of interaction, placed in an independent coordinate |
| /// system. |
| /// |
| /// A pointer event's position is defined in the coordinate system of this |
| /// viewport. |
| /// |
| /// A change in viewport extents means the region for pointer interaction |
| /// has itself moved, or changed in size, or both. |
| viewport Rectangle; |
| |
| /// The transform matrix that relates a point's position in the viewport's |
| /// coordinate system to its position in the view's coordinate system. |
| viewport_to_view_transform Mat3; |
| }; |