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 +4 -4
- data/cpee-frames.gemspec +1 -1
- data/lib/cpee-frames/implementation.rb +14 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6e3e17dafdfc33eea6a1985ef1195ae366e481783eee9a0521f2e24b376ab89
|
4
|
+
data.tar.gz: b1027c8c1e6ddea9122c87ccef384c1e628f8db1fa6369f61e819d235446cb96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
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
|
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
|
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]
|