svgle 0.4.6 → 0.4.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fb055aaee37ccc0fa5120270db02d20c030e42585c5734b9eb5e9016ec68a09
4
- data.tar.gz: c628f66d2b9f4dbb4450cd4d39c187dac14083c89c77f6af3b5283f6c6b2ae18
3
+ metadata.gz: 4e75a2b4aa745a539a340cc99365feb7f225068856f1ae47326e5da19a4d3176
4
+ data.tar.gz: 1dc30b3366df5b9bf7d6f0fca5bddaf37a6b683245e8366b051eeaa7f45993a2
5
5
  SHA512:
6
- metadata.gz: 1d6e8ef0ad700fbfc9aa946d329b63c33145ddbda57f1b15a29ed5ebd32653ecdc8bbbbd253ca8fe4ff26a3744f2dd965f1ebb95ab7148150b3d0d8228ee6b39
7
- data.tar.gz: 4cb552836d8ad8094dda484df33d111643a80fbe9b553f0a609b4681172e45ffa8046c03fb0406214f000bbffc47b9abbba366591f32c3eb52457be5f7cfbd8f
6
+ metadata.gz: 9a08e9a791925659dce44744b13226b28c4c709dba7eebd0c4acfcd9b5d011725ee3e356e168b653951393ad511e6618aeae17b8503fc52a73cfb819d7ebbac5
7
+ data.tar.gz: deea6aaa44eb88b97047de85e1d3c8c709850c6ff6deec9965daed0dc299584b4d45abbbb8f5d1136833c1648df17bf626490b2ead3bb7f0797ef9ebc64fdc15
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- Ħߵ�uzDo���XHwa�e`�K��������]���&$W|�%IEwQ�D��#�y�Ja���$�s~�l1�(j��D�R0���}*���Րs�`^C�zJq���
2
- �.S�q|��_o"'����]
1
+ C=mu� iN�E^���y܇��rG/�a��qw^IJ�n�:� s��Z���/������2׿!\]A~ӵ3{��5zr(2{�j^�:y�Ȅ?���o2��S�:<�n
2
+ ��W$���a$���UC��'��S���<�ǒ��T���pR������!~x u:�Qg�UG��f�?���.�
@@ -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
- DEFAULT_CSS = <<CSS
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 < Element
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 < Element
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 < Element
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 < Element
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 < Element
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 DEFAULT_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: Svgle::Circle,
172
- ellipse: Svgle::Ellipse,
173
- line: Svgle::Line,
174
- g: Svgle::G,
175
- image: Svgle::Image,
176
- svg: Svgle::Svg,
177
- script: Svgle::Script,
178
- style: Svgle::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: Svgle::Polygon,
181
- polyline: Svgle::Polyline,
182
- path: Svgle::Path,
183
- rect: Svgle::Rect,
184
- text: Svgle::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.6
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-05-12 00:00:00.000000000 Z
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