svgle 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -2
- data/lib/svgle.rb +41 -20
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e75a2b4aa745a539a340cc99365feb7f225068856f1ae47326e5da19a4d3176
|
4
|
+
data.tar.gz: 1dc30b3366df5b9bf7d6f0fca5bddaf37a6b683245e8366b051eeaa7f45993a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a08e9a791925659dce44744b13226b28c4c709dba7eebd0c4acfcd9b5d011725ee3e356e168b653951393ad511e6618aeae17b8503fc52a73cfb819d7ebbac5
|
7
|
+
data.tar.gz: deea6aaa44eb88b97047de85e1d3c8c709850c6ff6deec9965daed0dc299584b4d45abbbb8f5d1136833c1648df17bf626490b2ead3bb7f0797ef9ebc64fdc15
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
C=mu� iN�E^���y܇��r�G/�a��qw^IJ�n�:� s��Z���/������2!\]A~ӵ3{��5zr(�2{�j^�:y�Ȅ?���o2��S�:<�n�
|
2
|
+
��W$���a$���UC��'��S���<�ǒ��T���pR������!~xu:�Q�g�UG��f�?���.�
|
data/lib/svgle.rb
CHANGED
@@ -16,8 +16,9 @@ require 'domle'
|
|
16
16
|
# http://stackoverflow.com/questions/7946187/point-and-ellipse-rotated-position-test-algorithm
|
17
17
|
# computational geometry - ruby http://sourceforge.net/projects/ruby-comp-geom/
|
18
18
|
|
19
|
-
|
19
|
+
DEFAULT_SVGLE_CSS = <<CSS
|
20
20
|
|
21
|
+
g {background-color: orange}
|
21
22
|
svg {background-color: white}
|
22
23
|
rect {fill: yellow}
|
23
24
|
line, polyline {stroke: green; stroke-width: 3}
|
@@ -31,14 +32,20 @@ class Svgle < Domle
|
|
31
32
|
|
32
33
|
|
33
34
|
class SvgElement < Element
|
35
|
+
|
36
|
+
@attr_map = {}
|
37
|
+
attr_reader :attr_map
|
38
|
+
|
34
39
|
attr2_accessor *%i(stroke stroke-width)
|
40
|
+
|
41
|
+
|
35
42
|
end
|
36
43
|
|
37
44
|
class Shape < SvgElement
|
38
45
|
attr2_accessor *%i(fill)
|
39
46
|
end
|
40
47
|
|
41
|
-
class A <
|
48
|
+
class A < SvgElement
|
42
49
|
# undecided how to implement this
|
43
50
|
# see http://stackoverflow.com/questions/12422668/getting-xlinkhref-attribute-of-the-svg-image-element-dynamically-using-js-i
|
44
51
|
#attr2_accessor *%i(href)
|
@@ -58,7 +65,7 @@ class Svgle < Domle
|
|
58
65
|
end
|
59
66
|
end
|
60
67
|
|
61
|
-
class G <
|
68
|
+
class G < SvgElement
|
62
69
|
attr2_accessor *%i(fill opacity)
|
63
70
|
def boundary()
|
64
71
|
[0,0,0,0]
|
@@ -73,7 +80,7 @@ class Svgle < Domle
|
|
73
80
|
end
|
74
81
|
end
|
75
82
|
|
76
|
-
class Image <
|
83
|
+
class Image < SvgElement
|
77
84
|
|
78
85
|
attr2_accessor *%i(x y width height xlink:href src)
|
79
86
|
|
@@ -133,7 +140,7 @@ class Svgle < Domle
|
|
133
140
|
|
134
141
|
end
|
135
142
|
|
136
|
-
class Svg <
|
143
|
+
class Svg < SvgElement
|
137
144
|
attr2_accessor *%i(width height background-color)
|
138
145
|
def boundary()
|
139
146
|
[0,0,0,0]
|
@@ -141,11 +148,24 @@ class Svgle < Domle
|
|
141
148
|
end
|
142
149
|
|
143
150
|
|
144
|
-
class Text <
|
151
|
+
class Text < SvgElement
|
152
|
+
|
145
153
|
attr2_accessor *%i(x y fill)
|
154
|
+
|
146
155
|
def boundary()
|
147
156
|
[0,0,0,0]
|
148
157
|
end
|
158
|
+
|
159
|
+
def text=(raw_s)
|
160
|
+
|
161
|
+
oldval = @child_elements.first
|
162
|
+
|
163
|
+
r = super(raw_s)
|
164
|
+
@obj.text = raw_s if oldval != raw_s
|
165
|
+
|
166
|
+
return r
|
167
|
+
|
168
|
+
end
|
149
169
|
end
|
150
170
|
|
151
171
|
def initialize(src='<svg/>', callback: nil, rexle: self, debug: false)
|
@@ -160,7 +180,8 @@ class Svgle < Domle
|
|
160
180
|
protected
|
161
181
|
|
162
182
|
def add_default_css()
|
163
|
-
add_css
|
183
|
+
add_css Object.const_get self.class.to_s + '::' + 'DEFAULT_' +
|
184
|
+
self.class.to_s.upcase + '_CSS'
|
164
185
|
add_inline_css()
|
165
186
|
end
|
166
187
|
|
@@ -168,20 +189,20 @@ class Svgle < Domle
|
|
168
189
|
|
169
190
|
def defined_elements()
|
170
191
|
{
|
171
|
-
circle:
|
172
|
-
ellipse:
|
173
|
-
line:
|
174
|
-
g:
|
175
|
-
image:
|
176
|
-
svg:
|
177
|
-
script:
|
178
|
-
style:
|
192
|
+
circle: Circle,
|
193
|
+
ellipse: Ellipse,
|
194
|
+
line: Line,
|
195
|
+
g: G,
|
196
|
+
image: Image,
|
197
|
+
svg: Svg,
|
198
|
+
script: Script,
|
199
|
+
style: Style,
|
179
200
|
doc: Rexle::Element,
|
180
|
-
polygon:
|
181
|
-
polyline:
|
182
|
-
path:
|
183
|
-
rect:
|
184
|
-
text:
|
201
|
+
polygon: Polygon,
|
202
|
+
polyline: Polyline,
|
203
|
+
path: Path,
|
204
|
+
rect: Rect,
|
205
|
+
text: Text
|
185
206
|
}
|
186
207
|
end
|
187
208
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svgle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
NIUWaOW01S4o47sU3I51CSMWxo0LvDUyjQ5BahXzrnkaUCAZxlAAIqXum9zvCr5K
|
36
36
|
qG+QACUIuvQdA+C3SKv19pE2
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: domle
|
metadata.gz.sig
CHANGED
Binary file
|