glimmer-dsl-libui 0.4.22 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +53 -8
- data/VERSION +1 -1
- data/examples/color_the_circles.rb +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/shape/arc.rb +17 -0
- data/lib/glimmer/libui/shape/bezier.rb +9 -0
- data/lib/glimmer/libui/shape/circle.rb +7 -2
- data/lib/glimmer/libui/shape/line.rb +9 -0
- data/lib/glimmer/libui/shape/polybezier.rb +12 -0
- data/lib/glimmer/libui/shape/polygon.rb +11 -0
- data/lib/glimmer/libui/shape/polyline.rb +11 -0
- data/lib/glimmer/libui/shape/rectangle.rb +7 -2
- data/lib/glimmer/libui/shape/square.rb +9 -2
- data/lib/glimmer/libui/shape.rb +40 -0
- data/lib/glimmer-dsl-libui.rb +1 -0
- metadata +27 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08fe50ceac6ad2e11ec6599ba592d0a040cd4b7158a788dd8d001fddfa7e337e'
|
4
|
+
data.tar.gz: b10af93758d8b4141962c9b73c87f16419f302785b29b84cf62befe86181d507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffcf60fe7615eaac2109035a3ce64510ca2f76c5726c2c1c48fe0adba98ad1780c5f599fc9cb154ed789571710e5e2239f950e8dc16ec041f4727e5d0bfcef53
|
7
|
+
data.tar.gz: 4bb634aec81f105cd2de9aa9b2e0e3b4bd9c0eb1e715b8309cbdb4f7cd42113631e2f9d51e3db14ea9362bde930d6602ee23d7df6bb987edaf337a0d94f2756d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.3
|
4
|
+
|
5
|
+
- Support `polyline` `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 `polygon` `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
|
+
- Support `polybezier` `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?)
|
8
|
+
|
9
|
+
## 0.5.2
|
10
|
+
|
11
|
+
- 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?)
|
12
|
+
- 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?)
|
13
|
+
|
14
|
+
## 0.5.1
|
15
|
+
|
16
|
+
- Upgrade to libui 0.0.14
|
17
|
+
- Alter `Shape#contain?` to support `outline: ` and `distance_tolerance: ` options as per perfect-shape gem
|
18
|
+
- Support `arc` `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?)
|
19
|
+
- Support `circle` `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?)
|
20
|
+
|
21
|
+
## 0.5.0
|
22
|
+
|
23
|
+
- Upgrade to glimmer 2.6.0
|
24
|
+
- Support `rectangle` `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?)
|
25
|
+
- Support `square` `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?)
|
26
|
+
|
3
27
|
## 0.4.22
|
4
28
|
|
5
29
|
- examples/tetris.rb "Show Next Block Preview" menu item under "View" menu
|
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.
|
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.3
|
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)
|
@@ -330,7 +330,7 @@ Mac | Windows | Linux
|
|
330
330
|
|
331
331
|
![glimmer-dsl-libui-mac-tetris.gif](images/glimmer-dsl-libui-mac-tetris.gif)
|
332
332
|
|
333
|
-
NOTE: [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) is 100% feature-complete and in beta mode (though the C [libui](https://github.com/andlabs/libui) is still mid-alpha). Please help make better by contributing, adopting for small or low risk projects, and providing feedback. The more feedback and issues you report the better.
|
333
|
+
NOTE: [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) is 100% feature-complete with regards to covering the C [libui](https://github.com/andlabs/libui) library API and in beta mode (though the C [libui](https://github.com/andlabs/libui) is still mid-alpha, which is why [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) cannot be declared v1.0.0 yet). Please help make better by contributing, adopting for small or low risk projects, and providing feedback. The more feedback and issues you report the better.
|
334
334
|
|
335
335
|
**[Glimmer](https://rubygems.org/gems/glimmer) DSL Comparison Table:**
|
336
336
|
DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
@@ -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.
|
522
|
+
gem 'glimmer-dsl-libui', '~> 0.5.3'
|
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.
|
@@ -1008,15 +1016,49 @@ To draw `text` in an `area`, you simply nest a `text(x, y, width)` control direc
|
|
1008
1016
|
Example (you may copy/paste in [`girb`](#girb-glimmer-irb)):
|
1009
1017
|
|
1010
1018
|
```ruby
|
1019
|
+
require 'glimmer-dsl-libui'
|
1020
|
+
|
1021
|
+
include Glimmer
|
1022
|
+
|
1011
1023
|
window('area text drawing') {
|
1012
1024
|
area {
|
1013
1025
|
text {
|
1014
1026
|
default_font family: 'Helvetica', size: 12, weight: :normal, italic: :normal, stretch: :normal
|
1015
1027
|
|
1028
|
+
string('This ') {
|
1029
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1030
|
+
color r: 128, g: 0, b: 0, a: 1
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
string('is ') {
|
1034
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1035
|
+
color r: 0, g: 128, b: 0, a: 1
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
string('a ') {
|
1039
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1040
|
+
color r: 0, g: 0, b: 128, a: 1
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
string('short ') {
|
1044
|
+
font size: 20, weight: :bold, italic: :italic, stretch: :normal
|
1045
|
+
color r: 128, g: 128, b: 0, a: 1
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
string('attributed ') {
|
1049
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1050
|
+
color r: 0, g: 128, b: 128, a: 1
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
string("string \n\n") {
|
1054
|
+
font size: 20, weight: :bold, italic: :normal, stretch: :normal
|
1055
|
+
color r: 128, g: 0, b: 128, a: 1
|
1056
|
+
}
|
1057
|
+
|
1016
1058
|
string {
|
1017
1059
|
font family: 'Georgia', size: 13, weight: :medium, italic: :normal, stretch: :normal
|
1018
|
-
color r:
|
1019
|
-
background r:
|
1060
|
+
color r: 0, g: 128, b: 255, a: 1
|
1061
|
+
background r: 255, g: 255, b: 0, a: 0.5
|
1020
1062
|
underline :single
|
1021
1063
|
underline_color :spelling
|
1022
1064
|
open_type_features {
|
@@ -1029,13 +1071,14 @@ window('area text drawing') {
|
|
1029
1071
|
"attributed string\n" \
|
1030
1072
|
"spanning multiple lines\n\n"
|
1031
1073
|
}
|
1032
|
-
|
1033
|
-
string('This is a short unattributed string')
|
1034
1074
|
}
|
1035
1075
|
}
|
1036
1076
|
}.show
|
1037
1077
|
```
|
1038
1078
|
|
1079
|
+
![glimmer-dsl-libui-mac-area-text-drawing.png](/images/glimmer-dsl-libui-mac-area-text-drawing.png)
|
1080
|
+
|
1081
|
+
|
1039
1082
|
You may checkout [examples/basic_draw_text.rb](#basic-draw-text) and [examples/custom_draw_text.rb](#custom-draw-text) for examples of using `text` inside `area`.
|
1040
1083
|
|
1041
1084
|
Mac | Windows | Linux
|
@@ -1853,6 +1896,8 @@ For Mac, consider [Platypus](https://github.com/sveinbjornt/Platypus) (builds a
|
|
1853
1896
|
|
1854
1897
|
For Linux, simply package your app as a [Ruby Gem](https://guides.rubygems.org/what-is-a-gem/) and [build rpm package from Ruby Gem](https://www.redpill-linpro.com/sysadvent/2015/12/07/building-rpms-from-gems.html) or [build deb package from Ruby Gem](https://openpreservation.org/blogs/building-debian-package-ruby-program/).
|
1855
1898
|
|
1899
|
+
Also, there is a promising project called [ruby-packer](https://github.com/pmq20/ruby-packer) that supports all platforms.
|
1900
|
+
|
1856
1901
|
## Glimmer Style Guide
|
1857
1902
|
|
1858
1903
|
**1 - Control arguments are always wrapped by parentheses.**
|
@@ -5496,7 +5541,7 @@ class ColorTheCircles
|
|
5496
5541
|
|
5497
5542
|
def color_circle(x, y)
|
5498
5543
|
clicked_circle_data = @circles_data.find do |circle_data|
|
5499
|
-
circle_data[:fill].nil? && circle_data[:circle]&.
|
5544
|
+
circle_data[:fill].nil? && circle_data[:circle]&.contain?(x, y)
|
5500
5545
|
end
|
5501
5546
|
if clicked_circle_data
|
5502
5547
|
clicked_circle_data[:fill] = clicked_circle_data[:stroke]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.3
|
@@ -81,7 +81,7 @@ class ColorTheCircles
|
|
81
81
|
|
82
82
|
def color_circle(x, y)
|
83
83
|
clicked_circle_data = @circles_data.find do |circle_data|
|
84
|
-
circle_data[:fill].nil? && circle_data[:circle]&.
|
84
|
+
circle_data[:fill].nil? && circle_data[:circle]&.contain?(x, y)
|
85
85
|
end
|
86
86
|
if clicked_circle_data
|
87
87
|
clicked_circle_data[:fill] = clicked_circle_data[:stroke]
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -44,6 +44,23 @@ module Glimmer
|
|
44
44
|
end
|
45
45
|
super
|
46
46
|
end
|
47
|
+
|
48
|
+
def perfect_shape
|
49
|
+
perfect_shape_dependencies = [x_center, y_center, radius, start_angle, sweep, is_negative]
|
50
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
51
|
+
x_center, y_center, radius, start_angle, sweep, is_negative = @perfect_shape_dependencies = perfect_shape_dependencies
|
52
|
+
sign = is_negative ? 1 : -1
|
53
|
+
start = is_negative ? (360 - start_angle) : -1*start_angle
|
54
|
+
extent = is_negative ? (360 - sweep) : -1*sweep
|
55
|
+
@perfect_shape = PerfectShape::Arc.new(
|
56
|
+
type: :open,
|
57
|
+
center_x: x_center, center_y: y_center,
|
58
|
+
radius_x: radius, radius_y: radius,
|
59
|
+
start: start, extent: extent
|
60
|
+
)
|
61
|
+
end
|
62
|
+
@perfect_shape
|
63
|
+
end
|
47
64
|
end
|
48
65
|
end
|
49
66
|
end
|
@@ -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
|
@@ -45,8 +45,13 @@ module Glimmer
|
|
45
45
|
super
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
|
48
|
+
def perfect_shape
|
49
|
+
perfect_shape_dependencies = [x_center, y_center, radius]
|
50
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
51
|
+
x_center, y_center, radius = @perfect_shape_dependencies = perfect_shape_dependencies
|
52
|
+
@perfect_shape = PerfectShape::Circle.new(center_x: x_center, center_y: y_center, radius: radius)
|
53
|
+
end
|
54
|
+
@perfect_shape
|
50
55
|
end
|
51
56
|
end
|
52
57
|
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
|
@@ -39,6 +39,18 @@ module Glimmer
|
|
39
39
|
end
|
40
40
|
super
|
41
41
|
end
|
42
|
+
|
43
|
+
def perfect_shape
|
44
|
+
perfect_shape_dependencies = PerfectShape::MultiPoint.normalize_point_array(point_array)
|
45
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
46
|
+
point_array = @perfect_shape_dependencies = perfect_shape_dependencies
|
47
|
+
path_shapes = [point_array.first]
|
48
|
+
bezier_shape_points = point_array.drop(1).each.with_index.to_a.group_by {|pair| pair.last/3}.values.map {|arr| arr.map(&:first)}
|
49
|
+
path_shapes += bezier_shape_points.map { |points| PerfectShape::CubicBezierCurve.new(points: points) }
|
50
|
+
@perfect_shape = PerfectShape::Path.new(closed: false, shapes: path_shapes)
|
51
|
+
end
|
52
|
+
@perfect_shape
|
53
|
+
end
|
42
54
|
end
|
43
55
|
end
|
44
56
|
end
|
@@ -40,6 +40,17 @@ module Glimmer
|
|
40
40
|
end
|
41
41
|
super
|
42
42
|
end
|
43
|
+
|
44
|
+
def perfect_shape
|
45
|
+
perfect_shape_dependencies = PerfectShape::MultiPoint.normalize_point_array(point_array)
|
46
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
47
|
+
point_array = @perfect_shape_dependencies = perfect_shape_dependencies
|
48
|
+
path_shapes = [point_array.first]
|
49
|
+
path_shapes += point_array.drop(1).map { |point| PerfectShape::Line.new(points: [point]) }
|
50
|
+
@perfect_shape = PerfectShape::Path.new(closed: true, shapes: path_shapes)
|
51
|
+
end
|
52
|
+
@perfect_shape
|
53
|
+
end
|
43
54
|
end
|
44
55
|
end
|
45
56
|
end
|
@@ -39,6 +39,17 @@ module Glimmer
|
|
39
39
|
end
|
40
40
|
super
|
41
41
|
end
|
42
|
+
|
43
|
+
def perfect_shape
|
44
|
+
perfect_shape_dependencies = PerfectShape::MultiPoint.normalize_point_array(point_array)
|
45
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
46
|
+
point_array = @perfect_shape_dependencies = perfect_shape_dependencies
|
47
|
+
path_shapes = [point_array.first]
|
48
|
+
path_shapes += point_array.drop(1).map { |point| PerfectShape::Line.new(points: [point]) }
|
49
|
+
@perfect_shape = PerfectShape::Path.new(closed: false, shapes: path_shapes)
|
50
|
+
end
|
51
|
+
@perfect_shape
|
52
|
+
end
|
42
53
|
end
|
43
54
|
end
|
44
55
|
end
|
@@ -33,8 +33,13 @@ module Glimmer
|
|
33
33
|
super
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
x
|
36
|
+
def perfect_shape
|
37
|
+
perfect_shape_dependencies = [x, y, width, height]
|
38
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
39
|
+
x, y, width, height = @perfect_shape_dependencies = perfect_shape_dependencies
|
40
|
+
@perfect_shape = PerfectShape::Rectangle.new(x: x, y: y, width: width, height: height)
|
41
|
+
end
|
42
|
+
@perfect_shape
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
@@ -33,8 +33,15 @@ module Glimmer
|
|
33
33
|
super
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
# TODO look into refactoring/unifying code with Rectangle
|
37
|
+
|
38
|
+
def perfect_shape
|
39
|
+
perfect_shape_dependencies = [x, y, length]
|
40
|
+
if perfect_shape_dependencies != @perfect_shape_dependencies
|
41
|
+
@perfect_shape_dependencies = perfect_shape_dependencies
|
42
|
+
@perfect_shape = PerfectShape::Square.new(x: @perfect_shape_dependencies[0], y: @perfect_shape_dependencies[1], length: @perfect_shape_dependencies[2])
|
43
|
+
end
|
44
|
+
@perfect_shape
|
38
45
|
end
|
39
46
|
end
|
40
47
|
end
|
data/lib/glimmer/libui/shape.rb
CHANGED
@@ -145,6 +145,46 @@ module Glimmer
|
|
145
145
|
end
|
146
146
|
alias transform= transform
|
147
147
|
alias set_transform transform
|
148
|
+
|
149
|
+
# Returns if shape contains point on the inside when outline is false (default)
|
150
|
+
# or if point is on the outline when outline is true
|
151
|
+
# distance_tolerance is used when outline is true to enable a fuzz factor in
|
152
|
+
# determining if a point lies on the outline (e.g. makes it easier to select
|
153
|
+
# a shape by mouse)
|
154
|
+
def contain?(*point, outline: false, distance_tolerance: 0)
|
155
|
+
perfect_shape&.contain?(*point, outline: outline, distance_tolerance: distance_tolerance)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns if shape includes point on the inside when filled
|
159
|
+
# or if shape includes point on the outline when stroked
|
160
|
+
def include?(*point)
|
161
|
+
if fill.empty?
|
162
|
+
contain?(*point, outline: true, distance_tolerance: ((stroke[:thickness] || 1) - 1))
|
163
|
+
else
|
164
|
+
contain?(*point)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns bounding box Array consisting of
|
169
|
+
# [minx, miny, width, height]
|
170
|
+
def bounding_box
|
171
|
+
perfect_shape_bounding_box = perfect_shape&.bounding_box
|
172
|
+
return if perfect_shape_bounding_box.nil?
|
173
|
+
[
|
174
|
+
perfect_shape_bounding_box.x,
|
175
|
+
perfect_shape_bounding_box.y,
|
176
|
+
perfect_shape_bounding_box.width,
|
177
|
+
perfect_shape_bounding_box.height,
|
178
|
+
]
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns PerfectShape object matching this shape to enable
|
182
|
+
# executing computational geometry algorithms
|
183
|
+
#
|
184
|
+
# Subclasses must implement
|
185
|
+
def perfect_shape
|
186
|
+
# No Op
|
187
|
+
end
|
148
188
|
|
149
189
|
def respond_to?(method_name, *args, &block)
|
150
190
|
self.class.parameters.include?(method_name.to_s.sub(/=$/, '').sub(/^set_/, '').to_sym) or
|
data/lib/glimmer-dsl-libui.rb
CHANGED
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.
|
4
|
+
version: 0.5.3
|
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-
|
11
|
+
date: 2022-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.6.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: perfect-shape
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: os
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +78,14 @@ dependencies:
|
|
64
78
|
requirements:
|
65
79
|
- - "~>"
|
66
80
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.0.
|
81
|
+
version: 0.0.14
|
68
82
|
type: :runtime
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.0.
|
88
|
+
version: 0.0.14
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: chunky_png
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,12 +219,13 @@ dependencies:
|
|
205
219
|
- !ruby/object:Gem::Version
|
206
220
|
version: 0.7.0
|
207
221
|
description: Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI
|
208
|
-
Library) -
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
keyword
|
222
|
+
Library) - Winner of Fukuoka Ruby Award Competition 2022 Special Award - No need
|
223
|
+
to pre-install any prerequisites. Just install the gem and have platform-independent
|
224
|
+
native GUI that just works! Glimmer DSL for LibUI aims to provide declarative DSL
|
225
|
+
syntax that visually maps to GUI control hierarchy, convention over configuration
|
226
|
+
via smart defaults, automation of low-level details, requiring the least amount
|
227
|
+
of syntax possible to build GUI, bidirectional data-binding, and custom keyword
|
228
|
+
support.
|
214
229
|
email: andy.am@gmail.com
|
215
230
|
executables:
|
216
231
|
- girb
|