rubysketch 0.3.17 → 0.3.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +6 -0
- data/VERSION +1 -1
- data/lib/rubysketch/processing.rb +20 -3
- data/lib/rubysketch/window.rb +5 -5
- data/rubysketch.gemspec +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: 5a179e1170c79df6daea6d79f66eddc3aa7b50d22b2c685bcb36864f0644212e
|
4
|
+
data.tar.gz: 39565ddbcc31a7b6ef472c1fed40c91be91958531246b1673698afcd68ae621e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 435879c3538ece61aaecee0c19e6ece104934316fb113b2f23d9dc57394ded709417e30e32a7697ba1c465927b9d615fa945d1d4a4aa5068629509a33fcdbfff
|
7
|
+
data.tar.gz: b310a39f0c5e5fc55130d8c2cdd71c7620d17a42976d51fc73d7b09d41eeac15854482280bb213a937eda3474185935f27a1dcb6fd2983fad9a144c140fb337a
|
data/ChangeLog.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.18
|
@@ -1829,7 +1829,7 @@ module RubySketch
|
|
1829
1829
|
@keysPressed__ = Set.new
|
1830
1830
|
@pointerPos__ =
|
1831
1831
|
@pointerPrevPos__ = [0, 0]
|
1832
|
-
@pointersPressed__ =
|
1832
|
+
@pointersPressed__ = []
|
1833
1833
|
@touches__ = []
|
1834
1834
|
@motionGravity__ = createVector 0, 0
|
1835
1835
|
|
@@ -1864,12 +1864,21 @@ module RubySketch
|
|
1864
1864
|
end
|
1865
1865
|
}
|
1866
1866
|
|
1867
|
+
mouseButtonMap = {
|
1868
|
+
mouse_left: LEFT,
|
1869
|
+
mouse_right: RIGHT,
|
1870
|
+
mouse_middle: CENTER
|
1871
|
+
}
|
1872
|
+
|
1867
1873
|
updatePointerStates = -> event, pressed = nil {
|
1868
1874
|
@pointerPos__ = event.pos.to_a
|
1869
1875
|
@touches__ = event.pointers.map {|p| Touch.new(p.id, *p.pos.to_a)}
|
1870
1876
|
if pressed != nil
|
1871
|
-
|
1872
|
-
|
1877
|
+
array = @pointersPressed__
|
1878
|
+
event.type
|
1879
|
+
.tap {|types| types.delete :mouse}
|
1880
|
+
.map {|type| mouseButtonMap[type] || type}
|
1881
|
+
.each {|type| pressed ? array.push(type) : array.delete(type)}
|
1873
1882
|
end
|
1874
1883
|
}
|
1875
1884
|
|
@@ -2142,6 +2151,14 @@ module RubySketch
|
|
2142
2151
|
@pointerPrevPos__[1]
|
2143
2152
|
end
|
2144
2153
|
|
2154
|
+
# Returns which mouse button was pressed
|
2155
|
+
#
|
2156
|
+
# @return [Numeric] LEFT, RIGHT, CENTER or 0
|
2157
|
+
#
|
2158
|
+
def mouseButton()
|
2159
|
+
(@pointersPressed__ & [LEFT, RIGHT, CENTER]).last || 0
|
2160
|
+
end
|
2161
|
+
|
2145
2162
|
# Returns array of touches
|
2146
2163
|
#
|
2147
2164
|
# @return [Array] Touch objects
|
data/lib/rubysketch/window.rb
CHANGED
@@ -24,7 +24,7 @@ module RubySketch
|
|
24
24
|
painter.miter_limit = 10
|
25
25
|
resize_canvas 1, 1
|
26
26
|
|
27
|
-
@canvas_view = add Reflex::View.new {|v|
|
27
|
+
@canvas_view = add Reflex::View.new(name: :canvas) {|v|
|
28
28
|
v.on(:update) {|e| on_canvas_update e}
|
29
29
|
v.on(:draw) {|e| on_canvas_draw e}
|
30
30
|
v.on(:pointer) {|e| on_canvas_pointer e}
|
@@ -58,7 +58,7 @@ module RubySketch
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def on_key(e)
|
61
|
-
block = case e.
|
61
|
+
block = case e.action
|
62
62
|
when :down then @key_down
|
63
63
|
when :up then @key_up
|
64
64
|
end
|
@@ -81,9 +81,9 @@ module RubySketch
|
|
81
81
|
|
82
82
|
def on_canvas_pointer(e)
|
83
83
|
block = case e.action
|
84
|
-
when :down
|
85
|
-
when :up
|
86
|
-
when :move
|
84
|
+
when :down then @pointer_down
|
85
|
+
when :up, :cancel then @pointer_up
|
86
|
+
when :move then e.drag? ? @pointer_drag : @pointer_move
|
87
87
|
end
|
88
88
|
draw_canvas {call_block block, e} if block
|
89
89
|
end
|
data/rubysketch.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
29
|
s.required_ruby_version = '>= 2.6.0'
|
30
30
|
|
31
|
-
s.add_runtime_dependency 'reflexion', '~> 0.1'
|
31
|
+
s.add_runtime_dependency 'reflexion', '~> 0.1.24'
|
32
32
|
|
33
33
|
s.files = `git ls-files`.split $/
|
34
34
|
s.test_files = s.files.grep %r{^(test|spec|features)/}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysketch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reflexion
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.1.24
|
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:
|
26
|
+
version: 0.1.24
|
27
27
|
description: Creative Coding Framework have API compatible to Processing API or p5.js.
|
28
28
|
email: xordog@gmail.com
|
29
29
|
executables: []
|