Commit Graph

21 Commits

Author SHA1 Message Date
Elias Naur a2baffdbfd ui: expand package documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-09 20:35:04 +02:00
Elias Naur 6e26c92c75 all: remove exported Decode methods on operations
Add decode functions to the packages that need them instead. For
TransformOp that is used in multiple packages, add the decode
function to the internal ops package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 17:21:34 +02:00
Elias Naur b3517a365e ui,internal/ops,internal/opconst: move OpsReader to internal ops package
To avoid import cycles, move the op constants to its own package,
internal/opconst.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 17:21:26 +02:00
Elias Naur fe20cde393 ui: rename TransformOp.Mul to Multiply and split InvTransform
Multiply is a bit longer but more clear. InvTransform was really
two operations: Invert and Transform.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 14:47:14 +02:00
Elias Naur 9be695cc24 ui: fix TransformOp.Offset
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 14:20:40 +02:00
Elias Naur 5f2adf9b2f ui: get rid of Inf
It's not worth the special cases. Use a large value where needed
(layout.List, text.Editor...) instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 12:12:51 +02:00
Elias Naur 5e1f078b12 ui: merge Transform into TransformOp
The separate Transform type is not worth its weight.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 02:50:55 -07:00
Elias Naur f44ccec043 ui/pointer: simplify pointer pass through
Get rid of the confused LayerOp and the transparent property from
AreaOp. Add an explicit PassOp to specify whether pointer events
pass-through the current area.

Let AreaOp swallow events even when no handlers are active for the
area. That behaviour is less surprising and allow clients to disable
a widget by keeping its areas but leave out its handlers.

Simplify the pointer.HitResult enum to just a bool: hit or no hit.

Finally, simplify the pointer queue by tracking parent areas and
node with indices.
2019-07-10 22:43:03 +02:00
Elias Naur f90ef91b19 ui: fix comment for TransformOp 2019-07-10 20:47:42 +02:00
Elias Naur 32aae18293 ui,ui/app: convert Config to an interface
To keep the interface slim, remove the helper methods and shorten
the essential method, Pixels, to Px.

Add and use unexported Config implementation in the app package.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-10 17:20:55 +02:00
Elias Naur 320579814f ui: rename Config.Val to Pixels
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-10 14:00:44 +02:00
Elias Naur ad4215a7eb ui: use ints for unit conversions to pixels
The dp and sp units are approximate and mostly used for layout
dimensions that operate in whole pixels. This change alters the
Config methods to return pixels in ints instead of floats, which
results in smoother use for layout and emphasize the inexactness of
the device independent units.

Clients can still access to raw PxPrDp and PxPrSp factors from
Config.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-10 13:31:06 +02:00
Elias Naur 7aa7bb3be4 ui: rename ops to have Op suffixed, not prefixed
Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:01:45 +02:00
Elias Naur b10a6938cd ui/app: update comment and fix typo
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 14:54:34 +02:00
Elias Naur 955fe1bc77 ui: make the reference list argument to Ops.Write variadic
Makes the code nicer.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-03 15:22:11 +02:00
Elias Naur 0d2cffe196 ui: let OpsReader keep track of references
Instead of exposing the entire reference slice, return the relevant
references from Next.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 00cb158247 ui: add Config.Sp and Config.Dp convenience methods
And rename Pixels to Val.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-16 19:32:47 +02:00
Elias Naur 20f55a4ad7 all: delete the ui.Op type
It's no longer used.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:27:50 +02:00
Elias Naur 252e058766 all: serialize ops
Pros:
- Much less per-frame garbage
- Allow future preprocessing of ops while building it
- Much fewer interface calls and pointer chasing
- Allow future serialization of ops for remote rendering

Cons:
- Slightly clumsier API

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-27 22:19:34 +02:00
Elias Naur 8b2f6dbf13 ui: add doc.go
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-03-31 14:45:26 +02:00
Elias Naur 0f05231c35 all: initial import
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-03-31 10:47:22 +02:00