15 Commits

Author SHA1 Message Date
c1ceda055e remove all but linux/x11 and js/wasm, retarget import url 2025-10-19 18:34:09 +01:00
Chris Waldon
59695984e5 layout: add resize helpers for constraints
This commit adds two helper methods to layout.Contraints that make it easier to
manipulate the constraints while keeping their invariants. In particular, code
manually manipulating constraints usually fails to correctly ensure that the
max does not become smaller than the min, the min does not exceed the max, and
that no value goes below zero.

It's quite a few lines to check these invariants yourself in every custom layout,
so I think it makes sense to offer helpers for this.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2023-05-02 12:33:30 -06:00
Elias Naur
162250392b layout: respect minimum constraint size in Flex.Layout
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-07-08 09:18:13 +02:00
Pierre Curto
64bcb1ccd5 layout: do not reset cross axis constraints in Direction for N, S, E and W
Fixes #268

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2021-09-19 11:04:02 +02:00
Elias Naur
4484674ab1 layout: don't run alloc tests with -race
The race runtime allocates where the non-race runtime doesn't.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-03 10:18:57 +02:00
Elias Naur
ce0cc706ad layout: add test that Flex doesn't allocate
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-02 11:37:45 +02:00
Elias Naur
3701e2eb1d layout: move examples to example_test.go
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-12-02 17:46:40 +01:00
Elias Naur
11506a974e layout: add NewContext, make zero value Contexts useful
While here, unexport the Queue and Config fields. The NewContext
cosntructor is shorter, and there is no reason to expose the fields
to accidental mutation.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-12-02 13:13:15 +01:00
Elias Naur
5c0f1ed954 layout: update tests
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-17 14:22:24 +02:00
Elias Naur
529fd4d307 layout: rename Flex.Flexible to just Flex
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 09:20:04 +02:00
Elias Naur
8d82a3eaa6 layout: delete Init methods from Flex and Stack
With Context containing all the necessary information, separate
Init methods no longer makes much sense. Delete them and thereby
remove a source of runtime panics.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-06 09:17:41 +02:00
Elias Naur
e031308172 layout: take a size, not constraints in Context.Reset
Taking a constraint in Reset smells too much of a layout operation,
whereas a size is simpler and only serves to set the context constraints
to something sensible.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 15:35:05 +02:00
Elias Naur
3784ece6dd all: rename package ui to unit
Package ui is now only about units except for the Config.Now method.
Remove Now and rename Config to Converter. Add layout.Config to
replace the old ui.Config.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur
e7a97bf176 io/event: move event types from package ui to its own package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 15:18:08 +02:00
Elias Naur
22cd88df9f all: rename the gioui.org/ui module to gioui.org
The "ui" is redundant and stutters.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:37:06 +02:00