dyi 1.0.2 → 1.0.3

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.
data/CHANGES CHANGED
@@ -1,5 +1,14 @@
1
1
  = DYI Changelog
2
2
 
3
+ == Version 1.0.3
4
+ * Bug Fixes
5
+ * DataReader is not working properly in Ruby 1.9.
6
+ * A ECMAScript function dose not work properly.
7
+
8
+ == Version 1.0.2 / 2011-09-30
9
+ * Bug Fixes
10
+ * Initialization script can not register more than one.
11
+
3
12
  == Version 1.0.1 / 2011-09-28
4
13
  * Bug Fixes
5
14
  * A event listeners dose not work properly.
@@ -67,7 +67,7 @@ class ArrowPen < DYI::Drawing::Pen
67
67
  total_length = DYI::Length.new(start_point.distance(end_point))
68
68
  end_point_no_rotate = DYI::Coordinate.new(start_point.x + total_length, start_point.y)
69
69
 
70
- rotate_value = Math.atan2(end_point.y - start_point.y, end_point.x - start_point.x) * 360.0 / (2*Math::PI)
70
+ rotate_value = Math.atan2((end_point.y - start_point.y).to_f, (end_point.x - start_point.x).to_f) * 360.0 / (2*Math::PI)
71
71
 
72
72
  draw_line(canvas, start_point, end_point_no_rotate).rotate(rotate_value, start_point)
73
73
  draw_polygon(canvas, end_point_no_rotate){|line|
data/lib/dyi.rb CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
 
23
23
  module DYI
24
- VERSION = '1.0.2'
24
+ VERSION = '1.0.3'
25
25
  URL = 'http://sourceforge.net/projects/dyi/'
26
26
  end
27
27
 
@@ -168,7 +168,8 @@ module DYI #:nodoc:
168
168
  # data.age_values # => [20, 25]
169
169
  # @since 1.0.0
170
170
  def method_missing(name, *args)
171
- if args.size == 0 && name.to_s =~ /_values\z/ && @schema.members.include?($`)
171
+ if args.size == 0 && name.to_s =~ /_values\z/ &&
172
+ @schema.members.include?(RUBY_VERSION >= '1.9' ? $`.to_sym : $`)
172
173
  @records.map{|r| r.__send__($`)}
173
174
  else
174
175
  super
@@ -241,7 +241,7 @@ module DYI #:nodoc:
241
241
  :duration => animation_duration,
242
242
  :fill => 'freeze',
243
243
  :begin_event => Event.mouseout(pie_sector))
244
- if @legends
244
+ if show_legend?
245
245
  text.add_painting_animation(:to => {:opacity => 1},
246
246
  :duration => animation_duration,
247
247
  :fill => 'freeze',
@@ -96,7 +96,7 @@ module DYI #:nodoc:
96
96
  end
97
97
 
98
98
  def size_adjust=(value) #:nodoc:
99
- @size_adjust = value.to_s.size != 0 ? value.to_s : nil
99
+ @size_adjust = value ? value.to_f : nil
100
100
  end
101
101
 
102
102
  def draw_size
@@ -90,11 +90,11 @@ module DYI #:nodoc:
90
90
  content_type = script.content_type
91
91
  create_cdata_node(sio, 'script',
92
92
  :type => content_type) {
93
- sio << script.body
93
+ sio << script.contents
94
94
  if (i += 1) < length
95
95
  script = canvas.scripts[i]
96
96
  while !script.has_uri_reference? && content_type == script.content_type
97
- sio << script.body
97
+ sio << script.contents
98
98
  break if length <= (i += 1)
99
99
  script = canvas.scripts[i]
100
100
  end
@@ -385,7 +385,7 @@ module DYI #:nodoc:
385
385
  :'xlink:href' => script.href,
386
386
  :type => script.content_type)
387
387
  else
388
- io << script.body
388
+ io << script.contents
389
389
  end
390
390
  end
391
391
 
@@ -48,7 +48,7 @@ module DYI
48
48
  parts << '.addEventListener("' << event.event_name
49
49
  parts << '", function(' << listener.arguments.join(', ') << ") {\n"
50
50
  parts << listener.body
51
- parts << '})'
51
+ parts << '}, false)'
52
52
  parts.join
53
53
  end
54
54
 
@@ -86,15 +86,17 @@ module DYI
86
86
  parts << " var node = elm.el.childNodes.item(j);\n"
87
87
  parts << " if(node.nodeName == \"text\") {\n"
88
88
  parts << " var text_width = node.getComputedTextLength();\n"
89
- parts << " var ext = node.getExtentOfChar(0);\n"
90
- parts << " if(top == null || ext.y < top)\n"
91
- parts << " top = ext.y;\n"
92
- parts << " if(right == null || right < ext.x + text_width)\n"
93
- parts << " right = ext.x + text_width;\n"
94
- parts << " if(bottom == null || bottom < ext.y + ext.height)\n"
95
- parts << " bottom = ext.y + ext.height;\n"
96
- parts << " if(left == null || ext.x < left)\n"
97
- parts << " left = ext.x;\n"
89
+ parts << " if(node.getNumberOfChars() > 0){\n"
90
+ parts << " var ext = node.getExtentOfChar(0);\n"
91
+ parts << " if(top == null || ext.y < top)\n"
92
+ parts << " top = ext.y;\n"
93
+ parts << " if(right == null || right < ext.x + text_width)\n"
94
+ parts << " right = ext.x + text_width;\n"
95
+ parts << " if(bottom == null || bottom < ext.y + ext.height)\n"
96
+ parts << " bottom = ext.y + ext.height;\n"
97
+ parts << " if(left == null || ext.x < left)\n"
98
+ parts << " left = ext.x;\n"
99
+ parts << " }\n"
98
100
  parts << " }\n"
99
101
  parts << " else if(node.nodeName == \"rect\")\n"
100
102
  parts << " rect = node;\n"
@@ -198,8 +200,8 @@ module DYI
198
200
  end
199
201
  end
200
202
 
201
- # (see SimpleScript#body)
202
- def body
203
+ # @since 1.0.3
204
+ def contents
203
205
  parts = []
204
206
  parts << 'function'
205
207
  parts << " #{name}" if name
@@ -240,8 +242,8 @@ module DYI
240
242
  @events.delete(event)
241
243
  end
242
244
 
243
- # (see SimpleScript#body)
244
- def body
245
+ # @since 1.0.3
246
+ def contents
245
247
  if name
246
248
  super
247
249
  else
@@ -68,6 +68,11 @@ module DYI
68
68
  end
69
69
  end
70
70
 
71
+ # @since 1.0.3
72
+ def contents
73
+ @body
74
+ end
75
+
71
76
  # Writes the buffer contents of the object.
72
77
  # @param [Formatter::Base] a formatter for export
73
78
  # @param [IO] io a buffer that is written
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
4
+ hash: 17
5
+ prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yuo
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-30 00:00:00 Z
18
+ date: 2011-11-28 00:00:00 +09:00
19
+ default_executable:
19
20
  dependencies: []
20
21
 
21
22
  description: " DYI is a 2D graphics library, very rich and expressive.\n DYI have been optimized for SVG format, but it is also possible\n to output other format; for example, EPS.\n"
@@ -88,6 +89,7 @@ files:
88
89
  - README
89
90
  - test/path_command_test.rb
90
91
  - test/test_length.rb
92
+ has_rdoc: true
91
93
  homepage: https://sourceforge.net/projects/dyi/
92
94
  licenses:
93
95
  - GPL-3
@@ -119,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
121
  requirements: []
120
122
 
121
123
  rubyforge_project:
122
- rubygems_version: 1.8.5
124
+ rubygems_version: 1.3.7
123
125
  signing_key:
124
126
  specification_version: 3
125
127
  summary: 2D graphics library