glimmer-dsl-libui 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04aa1c93edebb982ee709366ff59b81a93a7dc79b8263ae17852f1d8302a3017
4
- data.tar.gz: ca30e790f8c93262de84920fbd0a22c584eab485d5fc4467f3ac9d52310a4410
3
+ metadata.gz: e5fd4f6d3b6fcc780223f17cd51767f153a77c73472434fdc8d13995ba8ddc00
4
+ data.tar.gz: 965a9726bf24afe64ac5e5288e60e9b9a2f1dd2e7ae6f81e49fbfead40bc07ed
5
5
  SHA512:
6
- metadata.gz: 4c553da5930af45532c1b9ea8cb11c48d29d0b24a6229c7abeb28854c71d4e2e3cc933f2bc8a5231c8fe5debc7e424a03b316b56a805c68a235d25605ef7ff2c
7
- data.tar.gz: a06cf47acaa964bfd73d5385082c4949ef9b76e0a54db230d29d961626367880e13e8e00cf63e3b78e40bb1cdafec29ea589e40b934ecc08268e768a5a2b48ac
6
+ metadata.gz: 9f3e4b130032060d4ea47528c6b6f80c8080917a9d50fcb3f0d4d11718594f1913e6a417c83d25a7e8c74136a7ce3597bf501f29339f48aa3ea577532f0af5e2
7
+ data.tar.gz: 66f8aa203283d3a4ef570690573c6344b0024f57164abfd16502153efa9ad49b1eaedf8d204a9723882fd86068bf2be44f30eb3b890b4e1d20ba73189677ca2e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.5.2
4
+
5
+ - Support `line` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
6
+ - Support `bezier` `bounding_box` (minx, miny, width, height), `contain?` method (checking if shape contains point inside) and `include?` method (checking on outline if stroked and inside if filled?)
7
+
3
8
  ## 0.5.1
4
9
 
5
10
  - Upgrade to libui 0.0.14
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.5.1
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.5.2
2
2
  ## Prerequisite-Free Ruby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
4
4
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -519,7 +519,7 @@ gem install glimmer-dsl-libui
519
519
  Or install via Bundler `Gemfile`:
520
520
 
521
521
  ```ruby
522
- gem 'glimmer-dsl-libui', '~> 0.5.1'
522
+ gem 'glimmer-dsl-libui', '~> 0.5.2'
523
523
  ```
524
524
 
525
525
  Test that installation worked by running the [Meta-Example](#examples):
@@ -985,6 +985,14 @@ Mac | Windows | Linux
985
985
  ----|---------|------
986
986
  ![glimmer-dsl-libui-mac-area-gallery.png](images/glimmer-dsl-libui-mac-area-gallery.png) | ![glimmer-dsl-libui-windows-area-gallery.png](images/glimmer-dsl-libui-windows-area-gallery.png) | ![glimmer-dsl-libui-linux-area-gallery.png](images/glimmer-dsl-libui-linux-area-gallery.png)
987
987
 
988
+ ##### Shape Methods
989
+
990
+ - `::parameters`: returns parameters of a shape class
991
+ - `#bounding_box`: returns `Array` containing `[min_x, min_y, width, height]`
992
+ - `#contain?(*point, outline: false, distance_tolerance: 0)`: Returns if point (`[x, y]` `Array` or args) is inside the shape when `outline` is `false` or on the outline when `outline` is `true`. `distance_tolerance` is used when `outline` is `true` as a fuzz factor for declaring a point on the outline of the shape (e.g. helps users select a shape from its outline more easily).
993
+ - `#include?(*point)`: Returns if point (`[x, y]` `Array` or args) is inside the shape when filled (having `fill` value) or on the outline when stroked (not having `fill` value yet `stroke` value only)
994
+ - `#perfect_shape`: returns [PerfectShape](https://github.com/AndyObtiva/perfect-shape) object matching the [libui](https://github.com/andlabs/libui) shape.
995
+
988
996
  #### Area Text
989
997
 
990
998
  To draw `text` in an `area`, you simply nest a `text(x, y, width)` control directly under `area` or inside a `on_draw` listener, and then nest attributed `string {[attributes]; string_value}` controls underneath it returning an actual `String` (think of them as the `<span>` or `<p>` element in html, which contains a string of text). Alternatively, you can nest attributed `string(string_value) {[attributes]}` if `string_value` is a short single-line string. An attributed `string` value can be changed dynamically via its `string` property.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
Binary file
@@ -49,6 +49,15 @@ module Glimmer
49
49
  def include_start_point?
50
50
  x && y
51
51
  end
52
+
53
+ def perfect_shape
54
+ perfect_shape_dependencies = [x, y, c1_x, c1_y, c2_x, c2_y, end_x, end_y]
55
+ if perfect_shape_dependencies != @perfect_shape_dependencies
56
+ x, y, c1_x, c1_y, c2_x, c2_y, end_x, end_y = @perfect_shape_dependencies = perfect_shape_dependencies
57
+ @perfect_shape = PerfectShape::CubicBezierCurve.new(points: [[x, y], [c1_x, c1_y], [c2_x, c2_y], [end_x, end_y]])
58
+ end
59
+ @perfect_shape
60
+ end
52
61
  end
53
62
  end
54
63
  end
@@ -52,6 +52,15 @@ module Glimmer
52
52
  # start point
53
53
  !parent.is_a?(Figure) && end_x && end_y
54
54
  end
55
+
56
+ def perfect_shape
57
+ perfect_shape_dependencies = [x, y, end_x, end_y]
58
+ if perfect_shape_dependencies != @perfect_shape_dependencies
59
+ x, y, end_x, end_y = @perfect_shape_dependencies = perfect_shape_dependencies
60
+ @perfect_shape = PerfectShape::Line.new(points: [[x, y], [end_x, end_y]])
61
+ end
62
+ @perfect_shape
63
+ end
55
64
  end
56
65
  end
57
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-16 00:00:00.000000000 Z
11
+ date: 2022-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer