fusuma-plugin-touchscreen 0.0.1.alpha → 0.1.0

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +0 -0
  3. data/README.md +71 -2
  4. data/fusuma-plugin-touchscreen.gemspec +3 -2
  5. data/lib/fusuma/plugin/buffers/touch_buffer.rb +17 -81
  6. data/lib/fusuma/plugin/detectors/touch_detector.rb +31 -14
  7. data/lib/fusuma/plugin/detectors/touch_detectors/base.rb +7 -0
  8. data/lib/fusuma/plugin/detectors/touch_detectors/edge_detector.rb +0 -0
  9. data/lib/fusuma/plugin/detectors/touch_detectors/hold_detector.rb +11 -3
  10. data/lib/fusuma/plugin/detectors/touch_detectors/pinch_detector.rb +59 -1
  11. data/lib/fusuma/plugin/detectors/touch_detectors/rotate_detector.rb +65 -1
  12. data/lib/fusuma/plugin/detectors/touch_detectors/swipe_detector.rb +11 -9
  13. data/lib/fusuma/plugin/detectors/touch_detectors/tap_detector.rb +2 -2
  14. data/lib/fusuma/plugin/detectors/touch_detectors/tap_hold_base.rb +21 -0
  15. data/lib/fusuma/plugin/devices/touchscreen_device.rb +0 -0
  16. data/lib/fusuma/plugin/events/records/touch_record.rb +14 -1
  17. data/lib/fusuma/plugin/events/records/touch_records/base.rb +2 -0
  18. data/lib/fusuma/plugin/events/records/touch_records/features/direction.rb +36 -0
  19. data/lib/fusuma/plugin/events/records/touch_records/hold_record.rb +0 -0
  20. data/lib/fusuma/plugin/events/records/touch_records/pinch_record.rb +23 -0
  21. data/lib/fusuma/plugin/events/records/touch_records/rotate_record.rb +23 -0
  22. data/lib/fusuma/plugin/events/records/touch_records/swipe_record.rb +2 -12
  23. data/lib/fusuma/plugin/events/records/touch_records/tap_record.rb +0 -0
  24. data/lib/fusuma/plugin/parsers/touch_parser.rb +2 -47
  25. data/lib/fusuma/plugin/touchscreen/math.rb +68 -0
  26. data/lib/fusuma/plugin/touchscreen/version.rb +1 -1
  27. data/lib/fusuma/plugin/touchscreen.rb +0 -0
  28. data/spec/fusuma/plugin/buffers/touch_buffer_spec.rb +216 -0
  29. data/spec/fusuma/plugin/detectors/hold_detector_spec.rb +71 -0
  30. data/spec/fusuma/plugin/detectors/pinch_detector_spec.rb +96 -0
  31. data/spec/fusuma/plugin/detectors/rotate_detector_spec.rb +123 -0
  32. data/spec/fusuma/plugin/detectors/swipe_detector_spec.rb +141 -0
  33. data/spec/fusuma/plugin/detectors/tap_detector_spec.rb +84 -0
  34. data/spec/fusuma/plugin/detectors/touch_detector_spec.rb +266 -0
  35. data/spec/fusuma/plugin/devices/touchscreen_device_spec.rb +6 -3
  36. data/spec/fusuma/plugin/parsers/touch_parser_spec.rb +30 -5
  37. data/spec/samples/1-finger-hold.txt +0 -0
  38. data/spec/samples/2-fingers-rotate-clockwise.txt +426 -0
  39. data/spec/samples/2-fingers-rotate-counterclockwise.txt +459 -0
  40. data/spec/samples/2-fingers-swipe-right.txt +0 -0
  41. data/spec/samples/3-fingers-pinch-in.txt +140 -0
  42. data/spec/samples/3-fingers-pinch-out.txt +171 -0
  43. data/spec/samples/3-fingers-tap.txt +0 -0
  44. data/spec/{fixtures/libinput-list-devices_ms-surface-3-pro.txt → samples/libinput-list-devices.txt} +0 -0
  45. data/spec/spec_helper.rb +8 -0
  46. data/spec/support/helpers/events_and_records.rb +43 -0
  47. data/spec/support/shared_contexts/with_touch_buffer.rb +10 -0
  48. data/spec/support/shared_examples/real_sample.rb +29 -0
  49. metadata +40 -10
  50. data/lib/fusuma/utils/angle.rb +0 -12
  51. data/spec/samples/libinput-devices.txt +0 -182
@@ -0,0 +1,171 @@
1
+ event4 TOUCH_DOWN +0.000s 0 (0) 59.44/51.77 (150.18/86.70mm)
2
+ event4 TOUCH_FRAME +0.000s
3
+ event4 TOUCH_DOWN +0.044s 1 (1) 49.38/67.32 (124.76/112.74mm)
4
+ event4 TOUCH_FRAME +0.044s
5
+ event4 TOUCH_DOWN +0.054s 2 (2) 51.55/52.91 (130.24/88.60mm)
6
+ event4 TOUCH_FRAME +0.054s
7
+ event4 TOUCH_MOTION +0.194s 1 (1) 49.36/67.34 (124.71/112.77mm)
8
+ event4 TOUCH_FRAME +0.194s
9
+ event4 TOUCH_MOTION +0.204s 1 (1) 49.33/67.34 (124.63/112.77mm)
10
+ event4 TOUCH_FRAME +0.204s
11
+ event4 TOUCH_MOTION +0.214s 1 (1) 49.28/67.34 (124.50/112.77mm)
12
+ event4 TOUCH_FRAME +0.214s
13
+ event4 TOUCH_MOTION +0.224s 1 (1) 49.22/67.35 (124.37/112.79mm)
14
+ event4 TOUCH_FRAME +0.224s
15
+ event4 TOUCH_MOTION +0.234s 1 (1) 49.17/67.35 (124.24/112.79mm)
16
+ event4 TOUCH_FRAME +0.234s
17
+ event4 TOUCH_MOTION +0.243s 1 (1) 49.13/67.35 (124.13/112.79mm)
18
+ event4 TOUCH_FRAME +0.243s
19
+ event4 TOUCH_MOTION +0.253s 1 (1) 49.08/67.37 (124.00/112.81mm)
20
+ event4 TOUCH_FRAME +0.253s
21
+ event4 TOUCH_MOTION +0.263s 1 (1) 49.04/67.38 (123.89/112.84mm)
22
+ event4 TOUCH_FRAME +0.263s
23
+ event4 TOUCH_MOTION +0.273s 1 (1) 48.98/67.39 (123.76/112.86mm)
24
+ event4 TOUCH_FRAME +0.273s
25
+ event4 TOUCH_MOTION +0.283s 1 (1) 48.93/67.39 (123.63/112.86mm)
26
+ event4 TOUCH_FRAME +0.283s
27
+ event4 TOUCH_MOTION +0.293s 1 (1) 48.89/67.39 (123.53/112.86mm)
28
+ event4 TOUCH_FRAME +0.293s
29
+ event4 TOUCH_MOTION +0.304s 1 (1) 48.85/67.41 (123.42/112.88mm)
30
+ event4 TOUCH_FRAME +0.304s
31
+ event4 TOUCH_MOTION +0.313s 1 (1) 48.80/67.41 (123.29/112.88mm)
32
+ event4 TOUCH_FRAME +0.313s
33
+ event4 TOUCH_MOTION +0.323s 1 (1) 48.70/67.41 (123.05/112.88mm)
34
+ event4 TOUCH_FRAME +0.323s
35
+ event4 TOUCH_MOTION +0.332s 1 (1) 48.60/67.42 (122.79/112.91mm)
36
+ event4 TOUCH_FRAME +0.332s
37
+ event4 TOUCH_MOTION +0.343s 1 (1) 48.48/67.42 (122.50/112.91mm)
38
+ event4 TOUCH_FRAME +0.343s
39
+ event4 TOUCH_MOTION +0.353s 1 (1) 48.34/67.45 (122.13/112.95mm)
40
+ event4 TOUCH_MOTION +0.353s 2 (2) 51.53/52.88 (130.18/88.56mm)
41
+ event4 TOUCH_FRAME +0.353s
42
+ event4 TOUCH_MOTION +0.363s 1 (1) 48.16/67.50 (121.68/113.05mm)
43
+ event4 TOUCH_MOTION +0.363s 2 (2) 51.51/52.84 (130.13/88.49mm)
44
+ event4 TOUCH_FRAME +0.363s
45
+ event4 TOUCH_MOTION +0.373s 1 (1) 47.93/67.59 (121.11/113.19mm)
46
+ event4 TOUCH_MOTION +0.373s 2 (2) 51.46/52.77 (130.03/88.37mm)
47
+ event4 TOUCH_FRAME +0.373s
48
+ event4 TOUCH_MOTION +0.383s 1 (1) 47.63/67.77 (120.34/113.49mm)
49
+ event4 TOUCH_MOTION +0.383s 2 (2) 51.42/52.69 (129.92/88.23mm)
50
+ event4 TOUCH_FRAME +0.383s
51
+ event4 TOUCH_MOTION +0.393s 1 (1) 47.29/67.98 (119.47/113.84mm)
52
+ event4 TOUCH_MOTION +0.393s 2 (2) 51.37/52.59 (129.79/88.07mm)
53
+ event4 TOUCH_FRAME +0.393s
54
+ event4 TOUCH_MOTION +0.403s 0 (0) 59.43/51.74 (150.16/86.65mm)
55
+ event4 TOUCH_MOTION +0.403s 1 (1) 46.92/68.23 (118.55/114.26mm)
56
+ event4 TOUCH_MOTION +0.403s 2 (2) 51.31/52.49 (129.63/87.91mm)
57
+ event4 TOUCH_FRAME +0.403s
58
+ event4 TOUCH_MOTION +0.412s 0 (0) 59.42/51.70 (150.13/86.58mm)
59
+ event4 TOUCH_MOTION +0.412s 1 (1) 46.62/68.43 (117.79/114.60mm)
60
+ event4 TOUCH_MOTION +0.412s 2 (2) 51.23/52.35 (129.45/87.67mm)
61
+ event4 TOUCH_FRAME +0.412s
62
+ event4 TOUCH_MOTION +0.422s 0 (0) 59.40/51.65 (150.08/86.49mm)
63
+ event4 TOUCH_MOTION +0.422s 1 (1) 46.35/68.60 (117.11/114.88mm)
64
+ event4 TOUCH_MOTION +0.422s 2 (2) 51.12/52.17 (129.16/87.37mm)
65
+ event4 TOUCH_FRAME +0.422s
66
+ event4 TOUCH_MOTION +0.433s 0 (0) 59.39/51.59 (150.05/86.40mm)
67
+ event4 TOUCH_MOTION +0.433s 1 (1) 46.08/68.73 (116.42/115.09mm)
68
+ event4 TOUCH_MOTION +0.433s 2 (2) 51.02/51.97 (128.89/87.02mm)
69
+ event4 TOUCH_FRAME +0.433s
70
+ event4 TOUCH_MOTION +0.442s 0 (0) 59.38/51.49 (150.03/86.23mm)
71
+ event4 TOUCH_MOTION +0.442s 1 (1) 45.81/68.81 (115.74/115.23mm)
72
+ event4 TOUCH_MOTION +0.442s 2 (2) 50.90/51.73 (128.61/86.63mm)
73
+ event4 TOUCH_FRAME +0.442s
74
+ event4 TOUCH_MOTION +0.452s 0 (0) 59.37/51.37 (150.00/86.02mm)
75
+ event4 TOUCH_MOTION +0.452s 1 (1) 45.52/68.89 (115.00/115.37mm)
76
+ event4 TOUCH_MOTION +0.452s 2 (2) 50.74/51.37 (128.21/86.02mm)
77
+ event4 TOUCH_FRAME +0.452s
78
+ event4 TOUCH_MOTION +0.463s 0 (0) 59.37/51.17 (150.00/85.70mm)
79
+ event4 TOUCH_MOTION +0.463s 1 (1) 45.20/68.98 (114.21/115.51mm)
80
+ event4 TOUCH_MOTION +0.463s 2 (2) 50.59/51.01 (127.82/85.42mm)
81
+ event4 TOUCH_FRAME +0.463s
82
+ event4 TOUCH_MOTION +0.472s 0 (0) 59.37/50.90 (150.00/85.23mm)
83
+ event4 TOUCH_MOTION +0.472s 1 (1) 44.90/69.05 (113.45/115.63mm)
84
+ event4 TOUCH_MOTION +0.472s 2 (2) 50.43/50.67 (127.42/84.86mm)
85
+ event4 TOUCH_FRAME +0.472s
86
+ event4 TOUCH_MOTION +0.482s 0 (0) 59.39/50.53 (150.05/84.63mm)
87
+ event4 TOUCH_MOTION +0.482s 1 (1) 44.51/69.12 (112.45/115.74mm)
88
+ event4 TOUCH_MOTION +0.482s 2 (2) 50.28/50.38 (127.03/84.37mm)
89
+ event4 TOUCH_FRAME +0.482s
90
+ event4 TOUCH_MOTION +0.491s 0 (0) 59.39/50.01 (150.05/83.74mm)
91
+ event4 TOUCH_MOTION +0.491s 1 (1) 44.10/69.21 (111.42/115.91mm)
92
+ event4 TOUCH_MOTION +0.491s 2 (2) 50.09/50.03 (126.55/83.79mm)
93
+ event4 TOUCH_FRAME +0.491s
94
+ event4 TOUCH_MOTION +0.502s 0 (0) 59.38/49.20 (150.03/82.40mm)
95
+ event4 TOUCH_MOTION +0.502s 1 (1) 43.76/69.27 (110.55/116.00mm)
96
+ event4 TOUCH_MOTION +0.502s 2 (2) 49.86/49.62 (125.97/83.09mm)
97
+ event4 TOUCH_FRAME +0.502s
98
+ event4 TOUCH_MOTION +0.512s 0 (0) 59.34/47.99 (149.92/80.37mm)
99
+ event4 TOUCH_MOTION +0.512s 1 (1) 43.46/69.32 (109.82/116.09mm)
100
+ event4 TOUCH_MOTION +0.512s 2 (2) 49.65/49.23 (125.45/82.44mm)
101
+ event4 TOUCH_FRAME +0.512s
102
+ event4 TOUCH_MOTION +0.522s 0 (0) 59.29/46.85 (149.79/78.47mm)
103
+ event4 TOUCH_MOTION +0.522s 1 (1) 43.19/69.34 (109.13/116.12mm)
104
+ event4 TOUCH_MOTION +0.522s 2 (2) 49.45/48.84 (124.95/81.79mm)
105
+ event4 TOUCH_FRAME +0.522s
106
+ event4 TOUCH_MOTION +0.532s 0 (0) 59.22/45.44 (149.63/76.09mm)
107
+ event4 TOUCH_MOTION +0.532s 1 (1) 42.89/69.32 (108.37/116.09mm)
108
+ event4 TOUCH_MOTION +0.532s 2 (2) 49.26/48.47 (124.45/81.16mm)
109
+ event4 TOUCH_FRAME +0.532s
110
+ event4 TOUCH_MOTION +0.543s 0 (0) 59.15/44.41 (149.45/74.37mm)
111
+ event4 TOUCH_MOTION +0.543s 1 (1) 42.58/69.27 (107.58/116.00mm)
112
+ event4 TOUCH_MOTION +0.543s 2 (2) 49.08/48.08 (124.00/80.51mm)
113
+ event4 TOUCH_FRAME +0.543s
114
+ event4 TOUCH_MOTION +0.552s 0 (0) 59.07/43.23 (149.24/72.40mm)
115
+ event4 TOUCH_MOTION +0.552s 1 (1) 42.29/69.18 (106.84/115.86mm)
116
+ event4 TOUCH_MOTION +0.552s 2 (2) 48.86/47.58 (123.45/79.67mm)
117
+ event4 TOUCH_FRAME +0.552s
118
+ event4 TOUCH_MOTION +0.561s 0 (0) 58.96/42.29 (148.97/70.81mm)
119
+ event4 TOUCH_MOTION +0.561s 1 (1) 41.96/69.02 (106.03/115.58mm)
120
+ event4 TOUCH_MOTION +0.561s 2 (2) 48.62/47.09 (122.84/78.86mm)
121
+ event4 TOUCH_FRAME +0.561s
122
+ event4 TOUCH_MOTION +0.571s 0 (0) 58.83/41.36 (148.63/69.26mm)
123
+ event4 TOUCH_MOTION +0.571s 1 (1) 41.66/68.87 (105.26/115.33mm)
124
+ event4 TOUCH_MOTION +0.571s 2 (2) 48.42/46.62 (122.34/78.07mm)
125
+ event4 TOUCH_FRAME +0.571s
126
+ event4 TOUCH_MOTION +0.581s 0 (0) 58.65/40.30 (148.18/67.49mm)
127
+ event4 TOUCH_MOTION +0.581s 1 (1) 41.35/68.74 (104.47/115.12mm)
128
+ event4 TOUCH_MOTION +0.581s 2 (2) 48.13/45.97 (121.61/76.98mm)
129
+ event4 TOUCH_FRAME +0.581s
130
+ event4 TOUCH_MOTION +0.592s 0 (0) 58.49/39.47 (147.79/66.09mm)
131
+ event4 TOUCH_MOTION +0.592s 1 (1) 40.96/68.59 (103.50/114.86mm)
132
+ event4 TOUCH_MOTION +0.592s 2 (2) 47.85/45.33 (120.89/75.91mm)
133
+ event4 TOUCH_FRAME +0.592s
134
+ event4 TOUCH_MOTION +0.601s 0 (0) 58.31/38.55 (147.32/64.56mm)
135
+ event4 TOUCH_MOTION +0.601s 1 (1) 40.60/68.46 (102.58/114.65mm)
136
+ event4 TOUCH_MOTION +0.601s 2 (2) 47.65/44.88 (120.39/75.16mm)
137
+ event4 TOUCH_FRAME +0.601s
138
+ event4 TOUCH_MOTION +0.611s 0 (0) 58.16/37.62 (146.95/63.00mm)
139
+ event4 TOUCH_MOTION +0.611s 1 (1) 40.28/68.35 (101.76/114.47mm)
140
+ event4 TOUCH_MOTION +0.611s 2 (2) 47.46/44.44 (119.92/74.42mm)
141
+ event4 TOUCH_FRAME +0.611s
142
+ event4 TOUCH_MOTION +0.622s 0 (0) 58.08/37.12 (146.74/62.16mm)
143
+ event4 TOUCH_MOTION +0.622s 1 (1) 39.99/68.27 (101.03/114.33mm)
144
+ event4 TOUCH_MOTION +0.622s 2 (2) 47.32/44.09 (119.55/73.84mm)
145
+ event4 TOUCH_FRAME +0.622s
146
+ event4 TOUCH_MOTION +0.631s 0 (0) 58.01/36.73 (146.58/61.51mm)
147
+ event4 TOUCH_MOTION +0.631s 1 (1) 39.60/68.16 (100.05/114.14mm)
148
+ event4 TOUCH_FRAME +0.631s
149
+ event4 TOUCH_MOTION +0.641s 0 (0) 57.96/36.27 (146.45/60.74mm)
150
+ event4 TOUCH_MOTION +0.641s 1 (1) 39.15/68.02 (98.92/113.91mm)
151
+ event4 TOUCH_FRAME +0.641s
152
+ event4 TOUCH_MOTION +0.650s 0 (0) 57.92/35.76 (146.34/59.88mm)
153
+ event4 TOUCH_MOTION +0.650s 1 (1) 38.76/67.88 (97.92/113.67mm)
154
+ event4 TOUCH_FRAME +0.650s
155
+ event4 TOUCH_MOTION +0.660s 0 (0) 57.85/34.72 (146.16/58.14mm)
156
+ event4 TOUCH_MOTION +0.660s 1 (1) 38.20/67.64 (96.53/113.28mm)
157
+ event4 TOUCH_UP +0.660s 2 (2)
158
+ event4 TOUCH_FRAME +0.660s
159
+ event4 TOUCH_MOTION +0.670s 1 (1) 35.19/66.44 (88.92/111.26mm)
160
+ event4 TOUCH_FRAME +0.670s
161
+ event4 TOUCH_MOTION +0.680s 1 (1) 34.94/66.34 (88.29/111.09mm)
162
+ event4 TOUCH_FRAME +0.680s
163
+ event4 TOUCH_MOTION +0.690s 1 (1) 34.41/66.05 (86.95/110.60mm)
164
+ event4 TOUCH_FRAME +0.690s
165
+ event4 TOUCH_UP +0.700s 0 (0)
166
+ event4 TOUCH_MOTION +0.700s 1 (1) 33.93/65.77 (85.74/110.14mm)
167
+ event4 TOUCH_FRAME +0.700s
168
+ event4 TOUCH_MOTION +0.709s 1 (1) 33.29/65.45 (84.11/109.60mm)
169
+ event4 TOUCH_FRAME +0.709s
170
+ event4 TOUCH_UP +0.748s 1 (1)
171
+ event4 TOUCH_FRAME +0.748s
File without changes
data/spec/spec_helper.rb CHANGED
@@ -98,4 +98,12 @@ RSpec.configure do |config|
98
98
  # as the one that triggered the failure.
99
99
  Kernel.srand config.seed
100
100
  =end
101
+
102
+ Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
103
+ config.include Helpers::EventsAndRecords
101
104
  end
105
+
106
+ if ENV['FUSUMA_DEBUG'] == 'true' || ENV['FUSUMA_DEBUG'] == '1'
107
+ Fusuma::Runner.send(:read_options, {})
108
+ Fusuma::MultiLogger.instance.debug_mode = true
109
+ end
@@ -0,0 +1,43 @@
1
+ require 'fusuma/plugin/events/event'
2
+ require 'fusuma/plugin/events/records/touch_record'
3
+ require 'fusuma/plugin/events/records/text_record'
4
+
5
+ module Helpers
6
+ module EventsAndRecords
7
+
8
+ def generate_event(tag:, time: Time.now, record:)
9
+ Fusuma::Plugin::Events::Event.new(tag: tag, record: record, time: time)
10
+ end
11
+
12
+ def generate_touch_record(status: 'begin', time_offset: 0, finger: 0, x_px: nil, y_px: nil, x_mm: nil, y_mm: nil)
13
+ if status != 'end'
14
+ x_px ||= 10
15
+ y_px ||= 10
16
+ x_mm ||= 10
17
+ y_mm ||= 10
18
+ end
19
+ Fusuma::Plugin::Events::Records::TouchRecord.new(
20
+ status: status,
21
+ time_offset: time_offset,
22
+ finger: finger,
23
+ x_px: x_px,
24
+ y_px: y_px,
25
+ x_mm: x_mm,
26
+ y_mm: y_mm
27
+ )
28
+ end
29
+
30
+ def generate_touch_event(record: generate_touch_record, time: Time.now)
31
+ generate_event(tag: 'libinput_touch_parser', record: record, time: time)
32
+ end
33
+
34
+ def generate_timer_record
35
+ Fusuma::Plugin::Events::Records::TextRecord.new("timer")
36
+ end
37
+
38
+ def generate_timer_event(time: Time.now)
39
+ generate_event(tag: "timer_input", record: generate_timer_record, time: time)
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,10 @@
1
+ require 'fusuma/plugin/buffers/touch_buffer'
2
+
3
+ RSpec.shared_context 'with touch buffer' do
4
+ let(:touch_buffer) { Fusuma::Plugin::Buffers::TouchBuffer.new }
5
+ let(:t) { Time.now }
6
+
7
+ before do
8
+ allow(touch_buffer).to receive(:movement_threshold).and_return(0.5)
9
+ end
10
+ end
@@ -0,0 +1,29 @@
1
+ require 'fusuma/plugin/parsers/touch_parser'
2
+ require 'fusuma/plugin/buffers/touch_buffer'
3
+
4
+ RSpec.shared_examples 'real sample' do |detector_class:, sample_path:, expected_gesture_class:, expected_gesture_attributes:|
5
+ let(:parser) { Fusuma::Plugin::Parsers::TouchParser.new }
6
+ let(:buffer) { Fusuma::Plugin::Buffers::TouchBuffer.new }
7
+ let(:detector) { detector_class.new }
8
+ let(:lines) { File.readlines(sample_path).map(&:strip).reject(&:empty?) }
9
+
10
+ it 'detects the expected gesture' do
11
+ t = Time.now
12
+
13
+ gesture = nil
14
+ lines.find do |line|
15
+ record = parser.parse_record(line)
16
+ next unless record
17
+
18
+ event = Fusuma::Plugin::Events::Event.new(tag: 'libinput_touch_parser', record: record, time: t + record.time_offset)
19
+ buffer.buffer(event)
20
+ gesture = detector.detect(buffer)
21
+ break if gesture
22
+ end
23
+
24
+ expect(gesture).to be_a(expected_gesture_class)
25
+ expected_gesture_attributes.each do |key, value|
26
+ expect(gesture.send(key)).to eq(value)
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma-plugin-touchscreen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Fedotov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-21 00:00:00.000000000 Z
11
+ date: 2023-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fusuma
@@ -44,24 +44,41 @@ files:
44
44
  - lib/fusuma/plugin/detectors/touch_detectors/rotate_detector.rb
45
45
  - lib/fusuma/plugin/detectors/touch_detectors/swipe_detector.rb
46
46
  - lib/fusuma/plugin/detectors/touch_detectors/tap_detector.rb
47
+ - lib/fusuma/plugin/detectors/touch_detectors/tap_hold_base.rb
47
48
  - lib/fusuma/plugin/devices/touchscreen_device.rb
48
49
  - lib/fusuma/plugin/events/records/touch_record.rb
49
50
  - lib/fusuma/plugin/events/records/touch_records/base.rb
51
+ - lib/fusuma/plugin/events/records/touch_records/features/direction.rb
50
52
  - lib/fusuma/plugin/events/records/touch_records/hold_record.rb
53
+ - lib/fusuma/plugin/events/records/touch_records/pinch_record.rb
54
+ - lib/fusuma/plugin/events/records/touch_records/rotate_record.rb
51
55
  - lib/fusuma/plugin/events/records/touch_records/swipe_record.rb
52
56
  - lib/fusuma/plugin/events/records/touch_records/tap_record.rb
53
57
  - lib/fusuma/plugin/parsers/touch_parser.rb
54
58
  - lib/fusuma/plugin/touchscreen.rb
59
+ - lib/fusuma/plugin/touchscreen/math.rb
55
60
  - lib/fusuma/plugin/touchscreen/version.rb
56
- - lib/fusuma/utils/angle.rb
57
- - spec/fixtures/libinput-list-devices_ms-surface-3-pro.txt
61
+ - spec/fusuma/plugin/buffers/touch_buffer_spec.rb
62
+ - spec/fusuma/plugin/detectors/hold_detector_spec.rb
63
+ - spec/fusuma/plugin/detectors/pinch_detector_spec.rb
64
+ - spec/fusuma/plugin/detectors/rotate_detector_spec.rb
65
+ - spec/fusuma/plugin/detectors/swipe_detector_spec.rb
66
+ - spec/fusuma/plugin/detectors/tap_detector_spec.rb
67
+ - spec/fusuma/plugin/detectors/touch_detector_spec.rb
58
68
  - spec/fusuma/plugin/devices/touchscreen_device_spec.rb
59
69
  - spec/fusuma/plugin/parsers/touch_parser_spec.rb
60
70
  - spec/samples/1-finger-hold.txt
71
+ - spec/samples/2-fingers-rotate-clockwise.txt
72
+ - spec/samples/2-fingers-rotate-counterclockwise.txt
61
73
  - spec/samples/2-fingers-swipe-right.txt
74
+ - spec/samples/3-fingers-pinch-in.txt
75
+ - spec/samples/3-fingers-pinch-out.txt
62
76
  - spec/samples/3-fingers-tap.txt
63
- - spec/samples/libinput-devices.txt
77
+ - spec/samples/libinput-list-devices.txt
64
78
  - spec/spec_helper.rb
79
+ - spec/support/helpers/events_and_records.rb
80
+ - spec/support/shared_contexts/with_touch_buffer.rb
81
+ - spec/support/shared_examples/real_sample.rb
65
82
  homepage: https://github.com/Phaengris/fusuma-plugin-touchscreen
66
83
  licenses:
67
84
  - MIT
@@ -74,23 +91,36 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
91
  requirements:
75
92
  - - ">="
76
93
  - !ruby/object:Gem::Version
77
- version: '2.3'
94
+ version: 2.5.1
78
95
  required_rubygems_version: !ruby/object:Gem::Requirement
79
96
  requirements:
80
- - - ">"
97
+ - - ">="
81
98
  - !ruby/object:Gem::Version
82
- version: 1.3.1
99
+ version: '0'
83
100
  requirements: []
84
101
  rubygems_version: 3.3.7
85
102
  signing_key:
86
103
  specification_version: 4
87
104
  summary: Touchscreen support plugin for Fusuma
88
105
  test_files:
89
- - spec/fixtures/libinput-list-devices_ms-surface-3-pro.txt
106
+ - spec/fusuma/plugin/buffers/touch_buffer_spec.rb
107
+ - spec/fusuma/plugin/detectors/hold_detector_spec.rb
108
+ - spec/fusuma/plugin/detectors/pinch_detector_spec.rb
109
+ - spec/fusuma/plugin/detectors/rotate_detector_spec.rb
110
+ - spec/fusuma/plugin/detectors/swipe_detector_spec.rb
111
+ - spec/fusuma/plugin/detectors/tap_detector_spec.rb
112
+ - spec/fusuma/plugin/detectors/touch_detector_spec.rb
90
113
  - spec/fusuma/plugin/devices/touchscreen_device_spec.rb
91
114
  - spec/fusuma/plugin/parsers/touch_parser_spec.rb
92
115
  - spec/samples/1-finger-hold.txt
116
+ - spec/samples/2-fingers-rotate-clockwise.txt
117
+ - spec/samples/2-fingers-rotate-counterclockwise.txt
93
118
  - spec/samples/2-fingers-swipe-right.txt
119
+ - spec/samples/3-fingers-pinch-in.txt
120
+ - spec/samples/3-fingers-pinch-out.txt
94
121
  - spec/samples/3-fingers-tap.txt
95
- - spec/samples/libinput-devices.txt
122
+ - spec/samples/libinput-list-devices.txt
96
123
  - spec/spec_helper.rb
124
+ - spec/support/helpers/events_and_records.rb
125
+ - spec/support/shared_contexts/with_touch_buffer.rb
126
+ - spec/support/shared_examples/real_sample.rb
@@ -1,12 +0,0 @@
1
- module Fusuma
2
- module Utils
3
- module Angle
4
-
5
- def self.difference(angle1, angle2)
6
- da = (angle1 - angle2).abs
7
- da > 180 ? 360 - da : da
8
- end
9
-
10
- end # module Angle
11
- end
12
- end
@@ -1,182 +0,0 @@
1
- Device: Video Bus
2
- Kernel: /dev/input/event7
3
- Group: 1
4
- Seat: seat0, default
5
- Capabilities: keyboard
6
- Tap-to-click: n/a
7
- Tap-and-drag: n/a
8
- Tap drag lock: n/a
9
- Left-handed: n/a
10
- Nat.scrolling: n/a
11
- Middle emulation: n/a
12
- Calibration: n/a
13
- Scroll methods: none
14
- Click methods: none
15
- Disable-w-typing: n/a
16
- Accel profiles: n/a
17
- Rotation: n/a
18
-
19
- Device: Surface Pro 3/4 Buttons
20
- Kernel: /dev/input/event14
21
- Group: 2
22
- Seat: seat0, default
23
- Capabilities: keyboard
24
- Tap-to-click: n/a
25
- Tap-and-drag: n/a
26
- Tap drag lock: n/a
27
- Left-handed: n/a
28
- Nat.scrolling: n/a
29
- Middle emulation: n/a
30
- Calibration: n/a
31
- Scroll methods: none
32
- Click methods: none
33
- Disable-w-typing: n/a
34
- Accel profiles: n/a
35
- Rotation: n/a
36
-
37
- Device: Lid Switch
38
- Kernel: /dev/input/event0
39
- Group: 3
40
- Seat: seat0, default
41
- Capabilities: switch
42
- Tap-to-click: n/a
43
- Tap-and-drag: n/a
44
- Tap drag lock: n/a
45
- Left-handed: n/a
46
- Nat.scrolling: n/a
47
- Middle emulation: n/a
48
- Calibration: n/a
49
- Scroll methods: none
50
- Click methods: none
51
- Disable-w-typing: n/a
52
- Accel profiles: n/a
53
- Rotation: n/a
54
-
55
- Device: Microsoft Surface Type Cover Keyboard
56
- Kernel: /dev/input/event13
57
- Group: 4
58
- Seat: seat0, default
59
- Capabilities: keyboard pointer
60
- Tap-to-click: n/a
61
- Tap-and-drag: n/a
62
- Tap drag lock: n/a
63
- Left-handed: n/a
64
- Nat.scrolling: disabled
65
- Middle emulation: n/a
66
- Calibration: n/a
67
- Scroll methods: none
68
- Click methods: none
69
- Disable-w-typing: n/a
70
- Accel profiles: n/a
71
- Rotation: n/a
72
-
73
- Device: Microsoft Surface Type Cover Mouse
74
- Kernel: /dev/input/event15
75
- Group: 4
76
- Seat: seat0, default
77
- Capabilities: pointer
78
- Tap-to-click: n/a
79
- Tap-and-drag: n/a
80
- Tap drag lock: n/a
81
- Left-handed: disabled
82
- Nat.scrolling: disabled
83
- Middle emulation: disabled
84
- Calibration: n/a
85
- Scroll methods: button
86
- Click methods: none
87
- Disable-w-typing: n/a
88
- Accel profiles: flat *adaptive
89
- Rotation: n/a
90
-
91
- Device: Microsoft Surface Type Cover Touchpad
92
- Kernel: /dev/input/event17
93
- Group: 4
94
- Seat: seat0, default
95
- Size: 98x50mm
96
- Capabilities: pointer gesture
97
- Tap-to-click: disabled
98
- Tap-and-drag: enabled
99
- Tap drag lock: disabled
100
- Left-handed: disabled
101
- Nat.scrolling: disabled
102
- Middle emulation: disabled
103
- Calibration: n/a
104
- Scroll methods: *two-finger edge
105
- Click methods: *button-areas clickfinger
106
- Disable-w-typing: enabled
107
- Accel profiles: flat *adaptive
108
- Rotation: n/a
109
-
110
- Device: Microsoft LifeCam Front: Micros
111
- Kernel: /dev/input/event1
112
- Group: 5
113
- Seat: seat0, default
114
- Capabilities: keyboard
115
- Tap-to-click: n/a
116
- Tap-and-drag: n/a
117
- Tap drag lock: n/a
118
- Left-handed: n/a
119
- Nat.scrolling: n/a
120
- Middle emulation: n/a
121
- Calibration: n/a
122
- Scroll methods: none
123
- Click methods: none
124
- Disable-w-typing: n/a
125
- Accel profiles: n/a
126
- Rotation: n/a
127
-
128
- Device: Microsoft LifeCam Rear: Microso
129
- Kernel: /dev/input/event2
130
- Group: 6
131
- Seat: seat0, default
132
- Capabilities: keyboard
133
- Tap-to-click: n/a
134
- Tap-and-drag: n/a
135
- Tap drag lock: n/a
136
- Left-handed: n/a
137
- Nat.scrolling: n/a
138
- Middle emulation: n/a
139
- Calibration: n/a
140
- Scroll methods: none
141
- Click methods: none
142
- Disable-w-typing: n/a
143
- Accel profiles: n/a
144
- Rotation: n/a
145
-
146
- Device: NTRG0001:01 1B96:1B05 Stylus
147
- Kernel: /dev/input/event3
148
- Group: 7
149
- Seat: seat0, default
150
- Size: 253x167mm
151
- Capabilities: tablet
152
- Tap-to-click: n/a
153
- Tap-and-drag: n/a
154
- Tap drag lock: n/a
155
- Left-handed: n/a
156
- Nat.scrolling: n/a
157
- Middle emulation: n/a
158
- Calibration: identity matrix
159
- Scroll methods: none
160
- Click methods: none
161
- Disable-w-typing: n/a
162
- Accel profiles: none
163
- Rotation: n/a
164
-
165
- Device: NTRG0001:01 1B96:1B05
166
- Kernel: /dev/input/event4
167
- Group: 7
168
- Seat: seat0, default
169
- Size: 253x167mm
170
- Capabilities: touch
171
- Tap-to-click: n/a
172
- Tap-and-drag: n/a
173
- Tap drag lock: n/a
174
- Left-handed: n/a
175
- Nat.scrolling: n/a
176
- Middle emulation: n/a
177
- Calibration: identity matrix
178
- Scroll methods: none
179
- Click methods: none
180
- Disable-w-typing: n/a
181
- Accel profiles: n/a
182
- Rotation: n/a