glimmer-dsl-libui 0.5.10 → 0.5.11
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 +4 -4
- data/CHANGELOG.md +15 -1
- data/README.md +76 -16
- data/VERSION +1 -1
- data/examples/shape_coloring.rb +56 -12
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/libui/control_proxy/path_proxy.rb +4 -0
- data/lib/glimmer/libui/perfect_shaped.rb +19 -0
- data/lib/glimmer/libui/shape/arc.rb +5 -0
- data/lib/glimmer/libui/shape/bezier.rb +11 -0
- data/lib/glimmer/libui/shape/circle.rb +5 -0
- data/lib/glimmer/libui/shape/figure.rb +6 -0
- data/lib/glimmer/libui/shape/line.rb +7 -0
- data/lib/glimmer/libui/shape/polybezier.rb +4 -0
- data/lib/glimmer/libui/shape/polygon.rb +4 -0
- data/lib/glimmer/libui/shape/polyline.rb +4 -0
- data/lib/glimmer/libui/shape/rectangle.rb +5 -0
- data/lib/glimmer/libui/shape/square.rb +5 -0
- data/lib/glimmer/libui/shape.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edec94cbcdfb5f8766a7b04c6c19719a8525d971349db5c3f2989b762cee2c56
|
4
|
+
data.tar.gz: 60706b17b64dd6660a14dc46e31ec16039daa3074e4f3e3561061d20898271ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08e7c05b971f6ff16213dbdf14f8809fe45aa8f8d8b2ba563468eaf2eb14867a6cce4552fe4ae897e2a475b19b59f8179eb18864f15981db3c55bbe2dddd724
|
7
|
+
data.tar.gz: a96f5e238962f5998385046af93b2b5f101612e3626be7261de9373f7e106dd03fab044afe9bb2b5a7130f2b6e90ce900551a9ad209cddeb1fd2df59065edfca
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.5.11
|
4
|
+
|
5
|
+
- Upgrade to perfect-shape 1.0.4
|
6
|
+
- Update examples/shape_coloring.rb with basic drag and drop support
|
7
|
+
- Support `#move_by(x_delta, y_delta)` (alias `translate`) method on all shapes and `path` (e.g. useful in drag and drop)
|
8
|
+
- Support `#move(x, y)` method on all shapes and `path` to move to x,y coordinate directly
|
9
|
+
- Support `#min_x` minimum x coordinate of shape/`path` (of top-left corner)
|
10
|
+
- Support `#min_y` minimum y coordinate of shape/`path` (of top-left corner)
|
11
|
+
- Support `#max_x` maximum x coordinate of shape/`path` (of bottom-right corner)
|
12
|
+
- Support `#max_y` maximum y coordinate of shape/`path` (of bottom-right corner)
|
13
|
+
- Support `#center_point` (`Array` of x,y) center point of shape/`path`
|
14
|
+
- Support `#center_x` center x coordinate of shape/`path`
|
15
|
+
- Support `#center_y` center y coordinate of shape/`path`
|
16
|
+
|
3
17
|
## 0.5.10
|
4
18
|
|
5
|
-
- Support nesting area mouse
|
19
|
+
- Support nesting area mouse listeners underneath shapes directly given the newly added support for the `include?(x, y)` method, which can be used to detect if a mouse event fired for a specific shape
|
6
20
|
- examples/shape_coloring.rb
|
7
21
|
|
8
22
|
## 0.5.9
|
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
|
+
# [<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.11
|
2
2
|
## Prerequisite-Free Ruby Desktop Development GUI Library
|
3
3
|
[](http://badge.fury.io/rb/glimmer-dsl-libui)
|
4
4
|
[](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -579,7 +579,7 @@ gem install glimmer-dsl-libui
|
|
579
579
|
Or install via Bundler `Gemfile`:
|
580
580
|
|
581
581
|
```ruby
|
582
|
-
gem 'glimmer-dsl-libui', '~> 0.5.
|
582
|
+
gem 'glimmer-dsl-libui', '~> 0.5.11'
|
583
583
|
```
|
584
584
|
|
585
585
|
Test that installation worked by running the [Meta-Example](#examples):
|
@@ -1088,13 +1088,22 @@ Mac | Windows | Linux
|
|
1088
1088
|
----|---------|------
|
1089
1089
|
 |  | 
|
1090
1090
|
|
1091
|
-
##### Shape Methods
|
1091
|
+
##### Area Path Shape Methods
|
1092
1092
|
|
1093
1093
|
- `::parameters`: returns parameters of a shape class
|
1094
1094
|
- `#bounding_box`: returns `Array` containing `[min_x, min_y, width, height]`
|
1095
1095
|
- `#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).
|
1096
1096
|
- `#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)
|
1097
1097
|
- `#perfect_shape`: returns [PerfectShape](https://github.com/AndyObtiva/perfect-shape) object matching the [libui](https://github.com/andlabs/libui) shape.
|
1098
|
+
- `#move_by(x_delta, y_delta)` (alias: `translate`): moves (translates) shape by x,y delta
|
1099
|
+
- `#move(x, y)`: moves (translates) shape to x,y coordinates (in the top-left x,y corner of the shape)
|
1100
|
+
- `#min_x`: minimum x coordinate of shape (of top-left corner)
|
1101
|
+
- `#min_y`: minimum y coordinate of shape (of top-left corner)
|
1102
|
+
- `#max_x`: maximum x coordinate of shape (of bottom-right corner)
|
1103
|
+
- `#max_y`: maximum y coordinate of shape (of bottom-right corner)
|
1104
|
+
- `#center_point` (`Array` of x,y): center point of shape
|
1105
|
+
- `#center_x`: center x coordinate of shape
|
1106
|
+
- `#center_y`: center y coordinate of shape
|
1098
1107
|
|
1099
1108
|
#### Area Text
|
1100
1109
|
|
@@ -11023,7 +11032,9 @@ Timer.new
|
|
11023
11032
|
|
11024
11033
|
#### Shape Coloring
|
11025
11034
|
|
11026
|
-
This example demonstrates being able to nest
|
11035
|
+
This example demonstrates being able to nest listeners within shapes directly, and [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) will automatically detect when the mouse lands inside the shapes to notify listeners.
|
11036
|
+
|
11037
|
+
This example also demonstrates very basic drag and drop support, implemented manually with shape listeners.
|
11027
11038
|
|
11028
11039
|
[examples/shape_coloring.rb](examples/shape_coloring.rb)
|
11029
11040
|
|
@@ -11039,7 +11050,12 @@ Run with this command if you installed the [Ruby gem](https://rubygems.org/gems/
|
|
11039
11050
|
ruby -r glimmer-dsl-libui -e "require 'examples/shape_coloring'"
|
11040
11051
|
```
|
11041
11052
|
|
11053
|
+
Shape Coloring Example
|
11054
|
+
|
11042
11055
|

|
11056
|
+
|
11057
|
+

|
11058
|
+
|
11043
11059
|

|
11044
11060
|
|
11045
11061
|
New [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) Version:
|
@@ -11057,11 +11073,11 @@ class ShapeColoring
|
|
11057
11073
|
}
|
11058
11074
|
|
11059
11075
|
body {
|
11060
|
-
window('Shape Coloring', 200,
|
11076
|
+
window('Shape Coloring', 200, 220) {
|
11061
11077
|
margined false
|
11062
11078
|
|
11063
11079
|
grid {
|
11064
|
-
label("
|
11080
|
+
label("Drag & drop shapes to move or\nclick a shape to select and\nchange color via color button") {
|
11065
11081
|
left 0
|
11066
11082
|
top 0
|
11067
11083
|
hexpand true
|
@@ -11090,19 +11106,19 @@ class ShapeColoring
|
|
11090
11106
|
fill :white
|
11091
11107
|
}
|
11092
11108
|
|
11093
|
-
@shapes << colorable(:rectangle, 20, 20, 40, 20) {
|
11109
|
+
@shapes << colorable(:rectangle, 20, 20, 40, 20) {
|
11094
11110
|
fill :lime
|
11095
11111
|
}
|
11096
11112
|
|
11097
|
-
@shapes << colorable(:square, 80, 20, 20) {
|
11113
|
+
@shapes << colorable(:square, 80, 20, 20) {
|
11098
11114
|
fill :blue
|
11099
11115
|
}
|
11100
11116
|
|
11101
|
-
@shapes << colorable(:circle, 75, 70, 20
|
11117
|
+
@shapes << colorable(:circle, 75, 70, 20) {
|
11102
11118
|
fill :green
|
11103
11119
|
}
|
11104
11120
|
|
11105
|
-
@shapes << colorable(:arc, 120, 70, 40, 0, 145) {
|
11121
|
+
@shapes << colorable(:arc, 120, 70, 40, 0, 145) {
|
11106
11122
|
fill :orange
|
11107
11123
|
}
|
11108
11124
|
|
@@ -11115,6 +11131,14 @@ class ShapeColoring
|
|
11115
11131
|
40, 120, 20, 120, 30, 91) {
|
11116
11132
|
fill :pink
|
11117
11133
|
}
|
11134
|
+
|
11135
|
+
on_mouse_dragged do |area_mouse_event|
|
11136
|
+
mouse_dragged(area_mouse_event)
|
11137
|
+
end
|
11138
|
+
|
11139
|
+
on_mouse_dropped do |area_mouse_event|
|
11140
|
+
mouse_dropped(area_mouse_event)
|
11141
|
+
end
|
11118
11142
|
}
|
11119
11143
|
}
|
11120
11144
|
}
|
@@ -11123,18 +11147,54 @@ class ShapeColoring
|
|
11123
11147
|
def colorable(shape_symbol, *args, &content)
|
11124
11148
|
send(shape_symbol, *args) do |shape|
|
11125
11149
|
on_mouse_up do |area_mouse_event|
|
11126
|
-
|
11127
|
-
|
11128
|
-
|
11129
|
-
|
11130
|
-
|
11131
|
-
|
11150
|
+
unless @dragged_shape
|
11151
|
+
old_stroke = Glimmer::LibUI.interpret_color(shape.stroke).slice(:r, :g, :b)
|
11152
|
+
@shapes.each {|sh| sh.stroke = nil}
|
11153
|
+
@selected_shape = nil
|
11154
|
+
unless old_stroke == COLOR_SELECTION
|
11155
|
+
shape.stroke = COLOR_SELECTION.merge(thickness: 2)
|
11156
|
+
@selected_shape = shape
|
11157
|
+
end
|
11132
11158
|
end
|
11133
11159
|
end
|
11134
11160
|
|
11161
|
+
on_mouse_drag_started do |area_mouse_event|
|
11162
|
+
mouse_drag_started(shape, area_mouse_event)
|
11163
|
+
end
|
11164
|
+
|
11165
|
+
on_mouse_dragged do |area_mouse_event|
|
11166
|
+
mouse_dragged(area_mouse_event)
|
11167
|
+
end
|
11168
|
+
|
11169
|
+
on_mouse_dropped do |area_mouse_event|
|
11170
|
+
mouse_dropped(area_mouse_event)
|
11171
|
+
end
|
11172
|
+
|
11135
11173
|
content.call(shape)
|
11136
11174
|
end
|
11137
11175
|
end
|
11176
|
+
|
11177
|
+
def mouse_drag_started(dragged_shape, area_mouse_event)
|
11178
|
+
@dragged_shape = dragged_shape
|
11179
|
+
@dragged_shape_x = area_mouse_event[:x]
|
11180
|
+
@dragged_shape_y = area_mouse_event[:y]
|
11181
|
+
end
|
11182
|
+
|
11183
|
+
def mouse_dragged(area_mouse_event)
|
11184
|
+
if @dragged_shape && @dragged_shape_x && @dragged_shape_y
|
11185
|
+
x_delta = area_mouse_event[:x] - @dragged_shape_x
|
11186
|
+
y_delta = area_mouse_event[:y] - @dragged_shape_y
|
11187
|
+
@dragged_shape.move_by(x_delta, y_delta)
|
11188
|
+
@dragged_shape_x = area_mouse_event[:x]
|
11189
|
+
@dragged_shape_y = area_mouse_event[:y]
|
11190
|
+
end
|
11191
|
+
end
|
11192
|
+
|
11193
|
+
def mouse_dropped(area_mouse_event)
|
11194
|
+
@dragged_shape = nil
|
11195
|
+
@dragged_shape_x = nil
|
11196
|
+
@dragged_shape_y = nil
|
11197
|
+
end
|
11138
11198
|
end
|
11139
11199
|
|
11140
11200
|
ShapeColoring.launch
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.11
|
data/examples/shape_coloring.rb
CHANGED
@@ -10,11 +10,11 @@ class ShapeColoring
|
|
10
10
|
}
|
11
11
|
|
12
12
|
body {
|
13
|
-
window('Shape Coloring', 200,
|
13
|
+
window('Shape Coloring', 200, 220) {
|
14
14
|
margined false
|
15
15
|
|
16
16
|
grid {
|
17
|
-
label("
|
17
|
+
label("Drag & drop shapes to move or\nclick a shape to select and\nchange color via color button") {
|
18
18
|
left 0
|
19
19
|
top 0
|
20
20
|
hexpand true
|
@@ -43,19 +43,19 @@ class ShapeColoring
|
|
43
43
|
fill :white
|
44
44
|
}
|
45
45
|
|
46
|
-
@shapes << colorable(:rectangle, 20, 20, 40, 20) {
|
46
|
+
@shapes << colorable(:rectangle, 20, 20, 40, 20) {
|
47
47
|
fill :lime
|
48
48
|
}
|
49
49
|
|
50
|
-
@shapes << colorable(:square, 80, 20, 20) {
|
50
|
+
@shapes << colorable(:square, 80, 20, 20) {
|
51
51
|
fill :blue
|
52
52
|
}
|
53
53
|
|
54
|
-
@shapes << colorable(:circle, 75, 70, 20
|
54
|
+
@shapes << colorable(:circle, 75, 70, 20) {
|
55
55
|
fill :green
|
56
56
|
}
|
57
57
|
|
58
|
-
@shapes << colorable(:arc, 120, 70, 40, 0, 145) {
|
58
|
+
@shapes << colorable(:arc, 120, 70, 40, 0, 145) {
|
59
59
|
fill :orange
|
60
60
|
}
|
61
61
|
|
@@ -68,6 +68,14 @@ class ShapeColoring
|
|
68
68
|
40, 120, 20, 120, 30, 91) {
|
69
69
|
fill :pink
|
70
70
|
}
|
71
|
+
|
72
|
+
on_mouse_dragged do |area_mouse_event|
|
73
|
+
mouse_dragged(area_mouse_event)
|
74
|
+
end
|
75
|
+
|
76
|
+
on_mouse_dropped do |area_mouse_event|
|
77
|
+
mouse_dropped(area_mouse_event)
|
78
|
+
end
|
71
79
|
}
|
72
80
|
}
|
73
81
|
}
|
@@ -76,18 +84,54 @@ class ShapeColoring
|
|
76
84
|
def colorable(shape_symbol, *args, &content)
|
77
85
|
send(shape_symbol, *args) do |shape|
|
78
86
|
on_mouse_up do |area_mouse_event|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
87
|
+
unless @dragged_shape
|
88
|
+
old_stroke = Glimmer::LibUI.interpret_color(shape.stroke).slice(:r, :g, :b)
|
89
|
+
@shapes.each {|sh| sh.stroke = nil}
|
90
|
+
@selected_shape = nil
|
91
|
+
unless old_stroke == COLOR_SELECTION
|
92
|
+
shape.stroke = COLOR_SELECTION.merge(thickness: 2)
|
93
|
+
@selected_shape = shape
|
94
|
+
end
|
85
95
|
end
|
86
96
|
end
|
87
97
|
|
98
|
+
on_mouse_drag_started do |area_mouse_event|
|
99
|
+
mouse_drag_started(shape, area_mouse_event)
|
100
|
+
end
|
101
|
+
|
102
|
+
on_mouse_dragged do |area_mouse_event|
|
103
|
+
mouse_dragged(area_mouse_event)
|
104
|
+
end
|
105
|
+
|
106
|
+
on_mouse_dropped do |area_mouse_event|
|
107
|
+
mouse_dropped(area_mouse_event)
|
108
|
+
end
|
109
|
+
|
88
110
|
content.call(shape)
|
89
111
|
end
|
90
112
|
end
|
113
|
+
|
114
|
+
def mouse_drag_started(dragged_shape, area_mouse_event)
|
115
|
+
@dragged_shape = dragged_shape
|
116
|
+
@dragged_shape_x = area_mouse_event[:x]
|
117
|
+
@dragged_shape_y = area_mouse_event[:y]
|
118
|
+
end
|
119
|
+
|
120
|
+
def mouse_dragged(area_mouse_event)
|
121
|
+
if @dragged_shape && @dragged_shape_x && @dragged_shape_y
|
122
|
+
x_delta = area_mouse_event[:x] - @dragged_shape_x
|
123
|
+
y_delta = area_mouse_event[:y] - @dragged_shape_y
|
124
|
+
@dragged_shape.move_by(x_delta, y_delta)
|
125
|
+
@dragged_shape_x = area_mouse_event[:x]
|
126
|
+
@dragged_shape_y = area_mouse_event[:y]
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def mouse_dropped(area_mouse_event)
|
131
|
+
@dragged_shape = nil
|
132
|
+
@dragged_shape_x = nil
|
133
|
+
@dragged_shape_y = nil
|
134
|
+
end
|
91
135
|
end
|
92
136
|
|
93
137
|
ShapeColoring.launch
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -162,6 +162,10 @@ module Glimmer
|
|
162
162
|
@parent_proxy&.request_auto_redraw
|
163
163
|
end
|
164
164
|
|
165
|
+
def move_by(x_delta, y_delta)
|
166
|
+
children.each {|child| child.move_by(x_delta, y_delta)}
|
167
|
+
end
|
168
|
+
|
165
169
|
def perfect_shape
|
166
170
|
perfect_shape_dependencies = [draw_fill_mode, children]
|
167
171
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -1,7 +1,14 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
1
3
|
module Glimmer
|
2
4
|
module LibUI
|
3
5
|
# GUI View objects that can be represented by PerfectShape objects
|
4
6
|
module PerfectShaped
|
7
|
+
extend Forwardable
|
8
|
+
|
9
|
+
def_delegators :perfect_shape,
|
10
|
+
:min_x, :min_y, :max_x, :max_y, :center_point, :center_x, :center_y
|
11
|
+
|
5
12
|
# Returns if shape contains point on the inside when outline is false (default)
|
6
13
|
# or if point is on the outline when outline is true
|
7
14
|
# distance_tolerance is used when outline is true to enable a fuzz factor in
|
@@ -34,6 +41,18 @@ module Glimmer
|
|
34
41
|
]
|
35
42
|
end
|
36
43
|
|
44
|
+
# moves by x delta and y delta. Classes must implement
|
45
|
+
def move_by(x_delta, y_delta)
|
46
|
+
# No Op
|
47
|
+
end
|
48
|
+
alias translate move_by
|
49
|
+
|
50
|
+
def move(x, y)
|
51
|
+
x_delta = x - perfect_shape.min_x
|
52
|
+
y_delta = y - perfect_shape.min_y
|
53
|
+
move_by(x_delta, y_delta)
|
54
|
+
end
|
55
|
+
|
37
56
|
# Returns PerfectShape object matching this shape to enable
|
38
57
|
# executing computational geometry algorithms
|
39
58
|
#
|
@@ -45,6 +45,11 @@ module Glimmer
|
|
45
45
|
super
|
46
46
|
end
|
47
47
|
|
48
|
+
def move_by(x_delta, y_delta)
|
49
|
+
self.x_center += x_delta
|
50
|
+
self.y_center += y_delta
|
51
|
+
end
|
52
|
+
|
48
53
|
def perfect_shape
|
49
54
|
perfect_shape_dependencies = [x_center, y_center, radius, start_angle, sweep, is_negative]
|
50
55
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -50,6 +50,17 @@ module Glimmer
|
|
50
50
|
x && y
|
51
51
|
end
|
52
52
|
|
53
|
+
def move_by(x_delta, y_delta)
|
54
|
+
self.x += x_delta
|
55
|
+
self.y += y_delta
|
56
|
+
self.c1_x += x_delta
|
57
|
+
self.c1_y += y_delta
|
58
|
+
self.c2_x += x_delta
|
59
|
+
self.c2_y += y_delta
|
60
|
+
self.end_x += x_delta
|
61
|
+
self.end_y += y_delta
|
62
|
+
end
|
63
|
+
|
53
64
|
def perfect_shape
|
54
65
|
perfect_shape_dependencies = [x, y, c1_x, c1_y, c2_x, c2_y, end_x, end_y]
|
55
66
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -45,6 +45,11 @@ module Glimmer
|
|
45
45
|
super
|
46
46
|
end
|
47
47
|
|
48
|
+
def move_by(x_delta, y_delta)
|
49
|
+
self.x_center += x_delta
|
50
|
+
self.y_center += y_delta
|
51
|
+
end
|
52
|
+
|
48
53
|
def perfect_shape
|
49
54
|
perfect_shape_dependencies = [x_center, y_center, radius]
|
50
55
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -51,6 +51,12 @@ module Glimmer
|
|
51
51
|
alias set_closed closed
|
52
52
|
alias closed? closed
|
53
53
|
|
54
|
+
def move_by(x_delta, y_delta)
|
55
|
+
self.x += x_delta
|
56
|
+
self.y += y_delta
|
57
|
+
children.each {|child| child.move_by(x_delta, y_delta)}
|
58
|
+
end
|
59
|
+
|
54
60
|
def perfect_shape
|
55
61
|
perfect_shape_dependencies = [x, y, closed, parent.draw_fill_mode, children]
|
56
62
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -53,6 +53,13 @@ module Glimmer
|
|
53
53
|
!parent.is_a?(Figure) && end_x && end_y
|
54
54
|
end
|
55
55
|
|
56
|
+
def move_by(x_delta, y_delta)
|
57
|
+
self.x += x_delta
|
58
|
+
self.y += y_delta
|
59
|
+
self.end_x += x_delta
|
60
|
+
self.end_y += y_delta
|
61
|
+
end
|
62
|
+
|
56
63
|
def perfect_shape
|
57
64
|
perfect_shape_dependencies = [x, y, end_x, end_y]
|
58
65
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -40,6 +40,10 @@ module Glimmer
|
|
40
40
|
super
|
41
41
|
end
|
42
42
|
|
43
|
+
def move_by(x_delta, y_delta)
|
44
|
+
self.point_array = point_array.each_with_index.map {|coordinate, i| i.even? ? coordinate + x_delta : coordinate + y_delta}
|
45
|
+
end
|
46
|
+
|
43
47
|
def perfect_shape
|
44
48
|
perfect_shape_dependencies = PerfectShape::MultiPoint.normalize_point_array(point_array)
|
45
49
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -41,6 +41,10 @@ module Glimmer
|
|
41
41
|
super
|
42
42
|
end
|
43
43
|
|
44
|
+
def move_by(x_delta, y_delta)
|
45
|
+
self.point_array = point_array.each_with_index.map {|coordinate, i| i.even? ? coordinate + x_delta : coordinate + y_delta}
|
46
|
+
end
|
47
|
+
|
44
48
|
def perfect_shape
|
45
49
|
perfect_shape_dependencies = PerfectShape::MultiPoint.normalize_point_array(point_array)
|
46
50
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -40,6 +40,10 @@ module Glimmer
|
|
40
40
|
super
|
41
41
|
end
|
42
42
|
|
43
|
+
def move_by(x_delta, y_delta)
|
44
|
+
self.point_array = point_array.each_with_index.map {|coordinate, i| i.even? ? coordinate + x_delta : coordinate + y_delta}
|
45
|
+
end
|
46
|
+
|
43
47
|
def perfect_shape
|
44
48
|
perfect_shape_dependencies = PerfectShape::MultiPoint.normalize_point_array(point_array)
|
45
49
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -33,6 +33,11 @@ module Glimmer
|
|
33
33
|
super
|
34
34
|
end
|
35
35
|
|
36
|
+
def move_by(x_delta, y_delta)
|
37
|
+
self.x += x_delta
|
38
|
+
self.y += y_delta
|
39
|
+
end
|
40
|
+
|
36
41
|
def perfect_shape
|
37
42
|
perfect_shape_dependencies = [x, y, width, height]
|
38
43
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
@@ -35,6 +35,11 @@ module Glimmer
|
|
35
35
|
|
36
36
|
# TODO look into refactoring/unifying code with Rectangle
|
37
37
|
|
38
|
+
def move_by(x_delta, y_delta)
|
39
|
+
self.x += x_delta
|
40
|
+
self.y += y_delta
|
41
|
+
end
|
42
|
+
|
38
43
|
def perfect_shape
|
39
44
|
perfect_shape_dependencies = [x, y, length]
|
40
45
|
if perfect_shape_dependencies != @perfect_shape_dependencies
|
data/lib/glimmer/libui/shape.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.5.
|
4
|
+
version: 0.5.11
|
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-05-
|
11
|
+
date: 2022-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.
|
33
|
+
version: 1.0.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0.
|
40
|
+
version: 1.0.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: super_module
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|