diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-02-24 17:49:26 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-02-24 17:49:26 -0500 |
| commit | c99ff181003c565385c21b92ca15161fbdff2bd8 (patch) | |
| tree | e5f55594cfc6a5912807449166653ff049894293 /len_test.go | |
| parent | 1b48ef0a114dfb85f2a5b8c5bed7c2b9bc8b72cc (diff) | |
| download | gui-c99ff181003c565385c21b92ca15161fbdff2bd8.zip | |
add layout constraints and abs/rel units
Diffstat (limited to 'len_test.go')
| -rw-r--r-- | len_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/len_test.go b/len_test.go new file mode 100644 index 0000000..91b0886 --- /dev/null +++ b/len_test.go @@ -0,0 +1,16 @@ +package gui_test + +import ( + "fmt" + "image" + + "github.com/faiface/gui" +) + +func ExampleRelative() { + var l Length = Relative(0.10) // 10% + r := image.Rect(0, 0, 100, 100) // 100x100 rectangle + fmt.Println(l.Px(r)) + // Output: + // 10 +} |