cpee-frames 1.0.2 → 1.0.3

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: d33782c18a633f94faa8add964f95d0f44912516775c14538e6d12bdbc486505
4
- data.tar.gz: fc7719677b5caa0f0a74b9536102c5d65ee2482e62201d1f64c0191a249b71f3
3
+ metadata.gz: f6e3e17dafdfc33eea6a1985ef1195ae366e481783eee9a0521f2e24b376ab89
4
+ data.tar.gz: b1027c8c1e6ddea9122c87ccef384c1e628f8db1fa6369f61e819d235446cb96
5
5
  SHA512:
6
- metadata.gz: 4dda8dac7b5c65ff3d4a87681e843cfae72be0cbb5ae103727bdfa374a12dd6742fb1966ce4e70d457c16c4732e51abed31c7499a59c8adb778bcc92b556a410
7
- data.tar.gz: 5d75b601db50a612e2b31d4200c7cefd4647c3eb0f864772b6585d94b5f71e7d122d320b0d0a7c709b31cc6bc77f4617aea17337108c47953a88ea6977e29375
6
+ metadata.gz: 182e44f12d97f59918eaea3a2590614c7758f920f2a4ce06ed848623348941fd60bfc493add7228f4f228d32867fb42bf66984d0505a68f95d4c294b49e7c17b
7
+ data.tar.gz: 190580b76dfc5a2100ad0cd1fbee4056f7db53ce9fa9cc7845574b3d87c8ee7923470c8b7da53e0047590696bc563790c3c1f4caaa880227fb5d8d4ff9894d86
data/cpee-frames.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-frames"
3
- s.version = "1.0.2"
3
+ s.version = "1.0.3"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "GPL-3.0"
6
6
  s.summary = "Dashboard management service with UI and backend for the cpee.org family of workflow management tools"
@@ -29,6 +29,17 @@ module CPEE
29
29
 
30
30
  SERVER = File.expand_path(File.join(__dir__,'frames.xml'))
31
31
 
32
+ def self::overlap?(l1x, l1y, r1x, r1y, l2x, l2y, r2x, r2y)
33
+ if l1x > r2x || l2x > r1x
34
+ return false
35
+ end
36
+ if l1y > r2y || l2y > r1y
37
+ return false
38
+ end
39
+ return true
40
+ end
41
+
42
+
32
43
  # https://coderwall.com/p/atyfyq/ruby-string-to-boolean
33
44
  # showbutton
34
45
  refine String do #{{{
@@ -100,7 +111,7 @@ module CPEE
100
111
 
101
112
  #check if new frame overlaps others if it does, delete overlapped frames
102
113
  data_hash["data"].each do | c |
103
- if doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
114
+ if CPEE::Frames::overlap?(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
104
115
  data_hash["data"].delete(c)
105
116
  end
106
117
  end
@@ -146,7 +157,7 @@ module CPEE
146
157
 
147
158
  #check if new frame overlaps others if it does, delete overlapped frames
148
159
  data_hash["data"].each do | c |
149
- if doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
160
+ if CPEE::Frames::overlap?(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
150
161
  data_hash["data"].delete(c)
151
162
  end
152
163
  end
@@ -199,7 +210,7 @@ module CPEE
199
210
  data_hash = JSON::parse(file)
200
211
 
201
212
  data_hash["data"].each do | c |
202
- if doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[0].value.to_i, @p[1].value.to_i, (@p[0].value.to_i + 1), (@p[1].value.to_i + 1))
213
+ if CPEE::Frames::overlap?(c['lx'], c['ly'], c['rx'], c['ry'], @p[0].value.to_i, @p[1].value.to_i, (@p[0].value.to_i + 1), (@p[1].value.to_i + 1))
203
214
  data_hash["data"].delete(c)
204
215
  end
205
216
  end
@@ -208,16 +219,6 @@ module CPEE
208
219
  end
209
220
  end
210
221
 
211
- def doOverlap(l1x, l1y, r1x, r1y, l2x, l2y, r2x, r2y)
212
- if l1x > r2x || l2x > r1x
213
- return false;
214
- end
215
- if l1y > r2y || l2y > r1y
216
- return false;
217
- end
218
- return true;
219
- end
220
-
221
222
  class Delete < Riddl::Implementation
222
223
  def response
223
224
  data_dir = @a[1]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-frames
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuell Gall