obf 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/obf/external.rb +3 -2
- data/lib/obf/pdf.rb +2 -10
- data/lib/obf/utils.rb +9 -0
- data/lib/tinycolor_convert.js +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c27601024bf7909871b16237383f37f1293e735
|
4
|
+
data.tar.gz: dd85480dd2a3c0761e0822c7f7807c69d29695d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6dc3bd80f1cb84236f42d527d676c3628e72d226c1eb67d142143f015c0a4616f7449679f0fb3ede3a583ae7c8acdd27077216d469fb8b769137834a028fff5
|
7
|
+
data.tar.gz: 98d650f28f82ef7d93f6f97b8ec7da80a1b4e130209a39653faa0f806fd262e4f6b8f5d40465ae22eac6a0f6de80f73fc43cb14832eadb2fe04ec99f9991a5c6
|
data/lib/obf/external.rb
CHANGED
@@ -28,12 +28,13 @@ module OBF::External
|
|
28
28
|
'id' => original_button['id'],
|
29
29
|
'label' => original_button['label'],
|
30
30
|
'vocalization' => original_button['vocalization'],
|
31
|
+
'action' => original_button['action'],
|
31
32
|
'left' => original_button['left'],
|
32
33
|
'top' => original_button['top'],
|
33
34
|
'width' => original_button['width'],
|
34
35
|
'height' => original_button['height'],
|
35
|
-
'border_color' => original_button['border_color'] || "#aaa",
|
36
|
-
'background_color' => original_button['background_color'] || "#fff"
|
36
|
+
'border_color' => OFB::Utils.fix_color(original_button['border_color'] || "#aaa", 'rgb'),
|
37
|
+
'background_color' => OBF::Utils.fix_color(original_button['background_color'] || "#fff", 'rgb')
|
37
38
|
}
|
38
39
|
if original_button['load_board']
|
39
40
|
button['load_board'] = {
|
data/lib/obf/pdf.rb
CHANGED
@@ -48,14 +48,6 @@ module OBF::PDF
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.fix_color(str)
|
52
|
-
@@colors ||= {}
|
53
|
-
return @@colors[str] if @@colors[str]
|
54
|
-
color = `node lib/tinycolor_convert.js "#{str}"`.strip
|
55
|
-
@@colors[str] = color
|
56
|
-
color
|
57
|
-
end
|
58
|
-
|
59
51
|
def self.build_page(pdf, obj, options)
|
60
52
|
OBF::Utils.as_progress_percent(0, 1.0) do
|
61
53
|
doc_width = 11*72 - 72
|
@@ -116,10 +108,10 @@ module OBF::PDF
|
|
116
108
|
fill = "ffffff"
|
117
109
|
border = "eeeeee"
|
118
110
|
if button['background_color']
|
119
|
-
fill = fix_color(button['background_color'])
|
111
|
+
fill = OBF::Utils.fix_color(button['background_color'], 'hex')
|
120
112
|
end
|
121
113
|
if button['border_color']
|
122
|
-
border = fix_color(button['border_color'])
|
114
|
+
border = OBF::Utils.fix_color(button['border_color'], 'hex')
|
123
115
|
end
|
124
116
|
pdf.fill_color fill
|
125
117
|
pdf.stroke_color border
|
data/lib/obf/utils.rb
CHANGED
@@ -118,6 +118,15 @@ module OBF::Utils
|
|
118
118
|
'sounds' => []
|
119
119
|
}
|
120
120
|
end
|
121
|
+
|
122
|
+
def self.fix_color(str, type='hex')
|
123
|
+
lookup = str + "::" + type
|
124
|
+
@@colors ||= {}
|
125
|
+
return @@colors[lookup] if @@colors[lookup]
|
126
|
+
color = `node lib/tinycolor_convert.js "#{str}" #{type}`.strip
|
127
|
+
@@colors[lookup] = color
|
128
|
+
color
|
129
|
+
end
|
121
130
|
|
122
131
|
def self.parse_obf(obj)
|
123
132
|
json = obj
|
data/lib/tinycolor_convert.js
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Whitmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|