glimmer-dsl-swt 4.20.11.1 → 4.20.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83a247e9e977044f7294fcf2430d1ec527f15e0c46b372d0e8c2e91cfbb36321
4
- data.tar.gz: 269d918b90ac0b565a27d71a17dfd7b01194e2df6f18c76a2c5b77d496b45202
3
+ metadata.gz: db6def93b1e2b7c5b5275126e53dbb42e23021721f41a23f98528d1f69f01f1b
4
+ data.tar.gz: 4d5b8fc17d10df490b1614e573d8a678c418f10cc2e5d43d0352905cf5245b1f
5
5
  SHA512:
6
- metadata.gz: 033fb29c9fb0bc37ac6786bb33610ee550628a5def123af28b9c732477329edcb13bca3008581c117fd3751bda9e6c953ac4f69bff319f91848be177dac45d77
7
- data.tar.gz: d286000814adaf8794105b357fbeec08cef2d202436930b64848f914d99eb1bfe27fffd03b51a430495174018ebdae54fb26165a18ca42cf8e8ecfd4bf5b3694
6
+ metadata.gz: fae5f9df309f2e0aada6c7557abb786faffc4cfdac5f82945183389bff644376106f0b41d1bc2b9b0d0cd2aaa14a07f2ad506545290cc7870354c377cad98c06
7
+ data.tar.gz: 85fabb309339aed175bb2bc662af3b9ba9f8b365114bbdaf3f4a642b94187bf2f07406c32c716b3ab71bcfa739a64ff53e7b846a9228e18ed0fe6d84f9890e3a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.12.0
4
+
5
+ - Canvas Shape Listeners: on_mouse_up, on_mouse_down, on_mouse_move, on_drag_detected
6
+ - Make scaffolding not generate an empty () after shell
7
+
3
8
  ### 4.20.11.1
4
9
 
5
10
  - Make scaffolded app project use bundler optionally only and still load glimmer-dsl-swt otherwise, like in gem-packaged mode (`glimmer package:gem`) to avoid erroring out about bundler.
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 SWT 4.20.11.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 SWT 4.20.12.0
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -15,7 +15,7 @@
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.11.1 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.12.0 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
19
19
 
20
20
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
21
21
 
@@ -45,12 +45,6 @@ shell {
45
45
  }.open
46
46
  ```
47
47
 
48
- Run via `glimmer samples` or directly:
49
-
50
- ```
51
- glimmer samples/hello/hello_world.rb
52
- ```
53
-
54
48
  Glimmer app:
55
49
 
56
50
  ![Hello World](images/glimmer-hello-world.png)
@@ -62,25 +56,25 @@ Learn more about [Hello, World!](docs/reference/GLIMMER_SAMPLES#hello-world).
62
56
  Glimmer GUI DSL code (from [samples/hello/hello_table.rb](samples/hello/hello_table.rb)):
63
57
 
64
58
  ```ruby
65
- # ... model code precedes
66
59
  shell {
67
60
  grid_layout
68
61
 
69
62
  text 'Hello, Table!'
70
63
  background_image File.expand_path('hello_table/baseball_park.png', __dir__)
64
+ image File.expand_path('hello_table/baseball_park.png', __dir__)
71
65
 
72
66
  label {
73
67
  layout_data :center, :center, true, false
74
68
 
75
69
  text 'BASEBALL PLAYOFF SCHEDULE'
76
- background :transparent
70
+ background :transparent if OS.windows?
77
71
  foreground rgb(94, 107, 103)
78
72
  font name: 'Optima', height: 38, style: :bold
79
73
  }
80
74
 
81
75
  combo(:read_only) {
82
76
  layout_data :center, :center, true, false
83
- selection bind(BaseballGame, :playoff_type)
77
+ selection <=> [BaseballGame, :playoff_type]
84
78
  font height: 14
85
79
  }
86
80
 
@@ -121,10 +115,10 @@ shell {
121
115
  }
122
116
 
123
117
  # Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
124
- items bind(BaseballGame, :schedule), column_properties(:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion)
118
+ items <=> [BaseballGame, :schedule, column_properties: [:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion]]
125
119
 
126
120
  # Data-bind table selection
127
- selection bind(BaseballGame, :selected_game)
121
+ selection <=> [BaseballGame, :selected_game]
128
122
 
129
123
  # Default initial sort property
130
124
  sort_property :date
@@ -147,20 +141,13 @@ shell {
147
141
  text 'Book Selected Game'
148
142
  layout_data :center, :center, true, false
149
143
  font height: 14
150
- enabled bind(BaseballGame, :selected_game)
144
+ enabled <= [BaseballGame, :selected_game]
151
145
 
152
146
  on_widget_selected {
153
147
  book_selected_game
154
148
  }
155
149
  }
156
- }.open
157
- # ...
158
- ```
159
-
160
- Run via `glimmer samples` or directly:
161
-
162
- ```
163
- glimmer samples/hello/hello_table.rb
150
+ }
164
151
  ```
165
152
 
166
153
  Glimmer App:
@@ -174,7 +161,6 @@ Learn more about [Hello, Table!](docs/reference/GLIMMER_SAMPLES#hello-table).
174
161
  Glimmer GUI DSL code (from [samples/elaborate/tetris.rb](samples/elaborate/tetris.rb)):
175
162
 
176
163
  ```ruby
177
- # ... more code resides in other files (navigate sample files to learn more)
178
164
  shell(:no_resize) {
179
165
  grid_layout {
180
166
  num_columns 2
@@ -196,13 +182,6 @@ shell(:no_resize) {
196
182
  layout_data(:fill, :fill, true, true)
197
183
  }
198
184
  }
199
- # ...
200
- ```
201
-
202
- Run via `glimmer samples` or directly:
203
-
204
- ```
205
- glimmer samples/elaborate/tetris.rb
206
185
  ```
207
186
 
208
187
  Glimmer app:
@@ -347,7 +326,7 @@ jgem install glimmer-dsl-swt
347
326
 
348
327
  Or this command if you want a specific version:
349
328
  ```
350
- jgem install glimmer-dsl-swt -v 4.20.11.1
329
+ jgem install glimmer-dsl-swt -v 4.20.12.0
351
330
  ```
352
331
 
353
332
  `jgem` is JRuby's version of `gem` command.
@@ -375,7 +354,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
375
354
 
376
355
  Add the following to `Gemfile`:
377
356
  ```
378
- gem 'glimmer-dsl-swt', '~> 4.20.11.1'
357
+ gem 'glimmer-dsl-swt', '~> 4.20.12.0'
379
358
  ```
380
359
 
381
360
  And, then run:
@@ -396,7 +375,7 @@ glimmer
396
375
  ```
397
376
 
398
377
  ```
399
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.11.1
378
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.12.0
400
379
 
401
380
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
402
381
 
@@ -443,7 +422,9 @@ Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and
443
422
  glimmer scaffold:gem:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]
444
423
  ```
445
424
 
446
- Learn more at: [docs/reference/GLIMMER_COMMAND.md](docs/reference/GLIMMER_COMMAND.md)
425
+ Learn more at:
426
+
427
+ [docs/reference/GLIMMER_COMMAND.md](docs/reference/GLIMMER_COMMAND.md)
447
428
 
448
429
  ## Girb (Glimmer irb) Command
449
430
 
@@ -455,7 +436,9 @@ girb
455
436
 
456
437
  ![GIRB](/images/glimmer-girb.png)
457
438
 
458
- Learn more at: [docs/reference/GLIMMER_GIRB.md](docs/reference/GLIMMER_GIRB.md)
439
+ Learn more at:
440
+
441
+ [docs/reference/GLIMMER_GIRB.md](docs/reference/GLIMMER_GIRB.md)
459
442
 
460
443
  ## Glimmer GUI DSL Syntax
461
444
 
@@ -495,13 +478,17 @@ table(:multi) {
495
478
 
496
479
  If you need more widgets, you can check out the [Nebula Project](https://github.com/AndyObtiva/glimmer-cw-nebula) (50+ enterprise-grade custom widgets)
497
480
 
498
- Learn more at: [docs/reference/GLIMMER_GUI_DSL_SYNTAX.md](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md)
481
+ Learn more at:
482
+
483
+ [docs/reference/GLIMMER_GUI_DSL_SYNTAX.md](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md)
499
484
 
500
485
  ## Glimmer Configuration
501
486
 
502
487
  Glimmer configuration may be done via the `Glimmer::Config` module.
503
488
 
504
- Learn more at: [docs/reference/GLIMMER_CONFIGURATION.md](docs/reference/GLIMMER_CONFIGURATION.md)
489
+ Learn more at:
490
+
491
+ [docs/reference/GLIMMER_CONFIGURATION.md](docs/reference/GLIMMER_CONFIGURATION.md)
505
492
 
506
493
  ## Glimmer Style Guide
507
494
 
@@ -509,6 +496,10 @@ Learn more at: [docs/reference/GLIMMER_CONFIGURATION.md](docs/reference/GLIMMER_
509
496
 
510
497
  ## Samples
511
498
 
499
+ See a listing of samples including screenshots and explanations at:
500
+
501
+ [docs/reference/GLIMMER_SAMPLES.md](/docs/reference/GLIMMER_SAMPLES.md)
502
+
512
503
  Check the [samples](/docs/reference/GLIMMER_SAMPLES.md) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer-dsl-swt` gem first and then run:
513
504
  ```
514
505
  glimmer samples
@@ -518,8 +509,6 @@ glimmer samples
518
509
 
519
510
  ![Glimmer Meta-Sample](/images/glimmer-meta-sample.png)
520
511
 
521
- See a listing of samples including screenshots and explanations at: [docs/reference/GLIMMER_SAMPLES.md](/docs/reference/GLIMMER_SAMPLES.md)
522
-
523
512
  ## In Production
524
513
 
525
514
  The following production apps have been built with Glimmer.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.11.1
1
+ 4.20.12.0
@@ -44,6 +44,7 @@
44
44
  - [Hello, Canvas Transform!](#hello-canvas-transform)
45
45
  - [Hello, Canvas Path!](#hello-canvas-path)
46
46
  - [Hello, Canvas Data Binding!](#hello-canvas-data-binding)
47
+ - [Hello, Canvas Shape Listeners!](#hello-canvas-shape-listeners)
47
48
  - [Hello, Cursor!](#hello-cursor)
48
49
  - [Hello, Progress Bar!](#hello-progress-bar)
49
50
  - [Hello, Tree!](#hello-tree)
@@ -816,6 +817,22 @@ Hello, Canvas Data Binding!
816
817
 
817
818
  ![Hello Canvas Data Binding Line Changed](/images/glimmer-hello-canvas-data-binding-line-changed.png)
818
819
 
820
+ #### Hello, Canvas Shape Listeners!
821
+
822
+ This sample demonstrates Canvas Shape DSL listeners, which are constrained within the bounds of their owning shape.
823
+
824
+ Code:
825
+
826
+ [samples/hello/hello_canvas_shape_listeners.rb](/samples/hello/hello_canvas_shape_listeners.rb)
827
+
828
+ Hello, Canvas Shape Listeners!
829
+
830
+ ![Hello Canvas Shape Listeners](/images/glimmer-hello-canvas-shape-listeners.png)
831
+
832
+ Hello, Canvas Shape Listeners! - Dragged Circle
833
+
834
+ ![Hello Canvas Shape Listeners Dragged](/images/glimmer-hello-canvas-shape-listeners-dragged.png)
835
+
819
836
  #### Hello, Cursor!
820
837
 
821
838
  This sample demonstrates the use of the `cursor` property keyword to change the mouse cursor.
Binary file
@@ -21,6 +21,7 @@
21
21
 
22
22
  require 'glimmer/dsl/expression'
23
23
  require 'glimmer/swt/display_proxy'
24
+ require 'glimmer/swt/custom/shape'
24
25
 
25
26
  module Glimmer
26
27
  module DSL
@@ -31,9 +32,9 @@ module Glimmer
31
32
  def can_interpret?(parent, keyword, *args, &block)
32
33
  Glimmer::Config.logger.debug {"keyword starts with on_: #{keyword.start_with?('on_')}"}
33
34
  return false unless keyword.start_with?('on_')
34
- widget_or_display_parentage = parent.respond_to?(:swt_widget) || parent.is_a?(Glimmer::SWT::DisplayProxy)
35
- Glimmer::Config.logger.debug {"parent #{parent} is a widget or display: #{widget_or_display_parentage}"}
36
- return false unless widget_or_display_parentage
35
+ proper_parent = parent.respond_to?(:swt_widget) || parent.is_a?(Glimmer::SWT::DisplayProxy) || parent.is_a?(Glimmer::SWT::Custom::Shape)
36
+ Glimmer::Config.logger.debug {"parent #{parent} is a widget, shape, or display: #{proper_parent}"}
37
+ return false unless proper_parent
37
38
  Glimmer::Config.logger.debug {"block exists?: #{!block.nil?}"}
38
39
  raise Glimmer::Error, "Listener is missing block for keyword: #{keyword}" unless block_given?
39
40
  Glimmer::Config.logger.debug {"args are empty?: #{args.empty?}"}
@@ -640,7 +640,7 @@ module Glimmer
640
640
  ## Top-most widget must be a shell or another custom shell
641
641
  #
642
642
  body {
643
- shell(#{':fill_screen' if shell_type == :desktopify}) {
643
+ shell#{'(:fill_screen)' if shell_type == :desktopify} {
644
644
  # Replace example content below with custom shell content
645
645
  minimum_size #{shell_type == :desktopify ? '768, 432' : '420, 240'}
646
646
  image File.join(APP_ROOT, 'package', 'windows', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.ico") if OS.windows?
@@ -239,6 +239,7 @@ module Glimmer
239
239
  end
240
240
  end
241
241
  end
242
+ alias translate move_by
242
243
 
243
244
  # rotates shape for an angle around its center
244
245
  # this operation is not cumulative (it resets angle every time)
@@ -563,6 +564,17 @@ module Glimmer
563
564
  end
564
565
  end
565
566
 
567
+ def can_handle_observation_request?(observation_request)
568
+ drawable.can_handle_observation_request?(observation_request)
569
+ end
570
+
571
+ def handle_observation_request(observation_request, &block)
572
+ shape_block = lambda do |event|
573
+ block.call(event) if include?(event.x, event.y)
574
+ end
575
+ drawable.handle_observation_request(observation_request, &shape_block)
576
+ end
577
+
566
578
  # Sets data just like SWT widgets
567
579
  def set_data(key=nil, value)
568
580
  @data ||= {}
@@ -0,0 +1,171 @@
1
+ # Copyright (c) 2007-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer-dsl-swt'
23
+
24
+ class HelloCanvasShapeListeners
25
+ include Glimmer::UI::CustomShell
26
+
27
+ attr_accessor :shape_name, :listener_event, :dragged_shape
28
+
29
+ body {
30
+ shell {
31
+ row_layout(:vertical) {
32
+ fill true
33
+ center true
34
+ margin_width 0
35
+ margin_height 0
36
+ }
37
+
38
+ text 'Hello, Canvas Shape Listeners!'
39
+
40
+ label(:center) {
41
+ text 'Current Shape:'
42
+ font style: :bold
43
+ }
44
+ label(:center) {
45
+ text <= [self, :shape_name]
46
+ }
47
+
48
+ label(:center) {
49
+ text 'Current Event:'
50
+ font style: :bold
51
+ }
52
+ label(:center) {
53
+ text <= [self, :listener_event]
54
+ }
55
+
56
+ canvas { |canvas_proxy|
57
+ layout_data {
58
+ width 350
59
+ height 200
60
+ }
61
+
62
+ background :white
63
+
64
+ @rectangle = rectangle(25, 25, 50, 50) {
65
+ background :red
66
+
67
+ # these listener events are limited to the rectangle bounds
68
+
69
+ on_mouse_down do |event|
70
+ self.shape_name = 'Square'
71
+ self.listener_event = 'Mouse Down'
72
+ end
73
+
74
+ on_drag_detected do |event|
75
+ self.shape_name = 'Square'
76
+ self.listener_event += ' / Drag Detected'
77
+ self.dragged_shape = @rectangle
78
+ end
79
+
80
+ on_mouse_move do |event|
81
+ if listener_event.to_s.empty? || shape_name != 'Square'
82
+ self.listener_event = "Mouse Move"
83
+ elsif !listener_event.to_s.include?('Mouse Move')
84
+ self.listener_event += " / Mouse Move"
85
+ end
86
+ self.shape_name = 'Square'
87
+ end
88
+
89
+ on_mouse_up do |event|
90
+ self.shape_name = 'Square'
91
+ self.listener_event += ' / Mouse Up'
92
+ self.dragged_shape = nil
93
+ end
94
+ }
95
+
96
+ @oval = oval(150, 120, 50, 50) {
97
+ background :green
98
+
99
+ # these listener events are limited to the oval bounds
100
+
101
+ on_mouse_down do |event|
102
+ self.shape_name = 'Circle'
103
+ self.listener_event = 'Mouse Down'
104
+ end
105
+
106
+ on_drag_detected do |event|
107
+ self.shape_name = 'Circle'
108
+ self.listener_event += ' / Drag Detected'
109
+ self.dragged_shape = @oval
110
+ end
111
+
112
+ on_mouse_move do |event|
113
+ if listener_event.to_s.empty? || shape_name != 'Circle'
114
+ self.listener_event = "Mouse Move"
115
+ elsif !listener_event.to_s.include?('Mouse Move')
116
+ self.listener_event += " / Mouse Move"
117
+ end
118
+ self.shape_name = 'Circle'
119
+ end
120
+
121
+ on_mouse_up do |event|
122
+ self.shape_name = 'Circle'
123
+ self.listener_event += ' / Mouse Up'
124
+ self.dragged_shape = nil
125
+ end
126
+ }
127
+
128
+ @polygon = polygon(260, 25, 300, 25, 260, 65) {
129
+ background :blue
130
+
131
+ # these listener events are limited to the polygon bounds
132
+
133
+ on_mouse_down do |event|
134
+ self.shape_name = 'Triangle'
135
+ self.listener_event = 'Mouse Down'
136
+ end
137
+
138
+ on_drag_detected do |event|
139
+ self.shape_name = 'Triangle'
140
+ self.listener_event += ' / Drag Detected'
141
+ self.dragged_shape = @polygon
142
+ end
143
+
144
+ on_mouse_move do |event|
145
+ if listener_event.to_s.empty? || shape_name != 'Triangle'
146
+ self.listener_event = "Mouse Move"
147
+ elsif !listener_event.to_s.include?('Mouse Move')
148
+ self.listener_event += " / Mouse Move"
149
+ end
150
+ self.shape_name = 'Triangle'
151
+ end
152
+
153
+ on_mouse_up do |event|
154
+ self.shape_name = 'Triangle'
155
+ self.listener_event += ' / Mouse Up'
156
+ self.dragged_shape = nil
157
+ end
158
+ }
159
+
160
+ # This is a general canvas listener event, which is used to move shape even if mouse goes out of its bounds
161
+ on_mouse_move do |event|
162
+ dragged_shape.move_by(event.x - @last_x.to_f, event.y - @last_y.to_f) if dragged_shape
163
+ @last_x = event.x
164
+ @last_y = event.y
165
+ end
166
+ }
167
+ }
168
+ }
169
+ end
170
+
171
+ HelloCanvasShapeListeners.launch
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.11.1
4
+ version: 4.20.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-23 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -577,6 +577,7 @@ files:
577
577
  - samples/hello/hello_canvas_animation_multi.rb
578
578
  - samples/hello/hello_canvas_data_binding.rb
579
579
  - samples/hello/hello_canvas_path.rb
580
+ - samples/hello/hello_canvas_shape_listeners.rb
580
581
  - samples/hello/hello_canvas_transform.rb
581
582
  - samples/hello/hello_checkbox.rb
582
583
  - samples/hello/hello_checkbox_group.rb