r2dsvg 0.3.1 → 0.5.0
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 +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/lib/r2dsvg.rb +152 -395
 - metadata +59 -39
 - 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: 218f3f75c56256cfbf3ccd9f0755d31bfad7ec53ae8a235e32103118de2fc8e9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 21aba9150ca1a85bfe48352c02e5bac17b276de41133b97d4e887a823bd85a2d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0250d7a5f4a76af1811e16ad9d38a9e9be12a13708abf20698876a5a94d22fa293ce94bb879d19f900fa802e78b85e73c8eedc455418cf7dd7685f70938a9181
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8fe0f560dddc4f193338019384356665170fb130a08f03407a3dda0709d03e4b91ed3fbf40c7cb2a0911344a915ab0aa6b9d92b6c28db584e3654a7c1c349200
         
     | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/lib/r2dsvg.rb
    CHANGED
    
    | 
         @@ -5,468 +5,225 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
            # Description: Experimental gem to render SVG within a Ruby2D application. 
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            require ' 
     | 
| 
       9 
     | 
    
         
            -
            require 'ruby2d'  # experimental gem depends upon simple2d binaries
         
     | 
| 
       10 
     | 
    
         
            -
            require 'dom_render'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'r2dsvg/r2dsvg_module'
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
10 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
            rect {fill: yellow}
         
     | 
| 
       17 
     | 
    
         
            -
            line, polyline {stroke: green; stroke-width: 3}
         
     | 
| 
       18 
     | 
    
         
            -
            text {fill: red, size: 20}
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            CSS
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            module SvgleX
         
     | 
| 
      
 11 
     | 
    
         
            +
            class Reader
         
     | 
| 
      
 12 
     | 
    
         
            +
              include R2dEngine
         
     | 
| 
      
 13 
     | 
    
         
            +
              using ColouredText
         
     | 
| 
       23 
14 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
               
     | 
| 
      
 15 
     | 
    
         
            +
              def initialize(s, model=Svgle, debug: false)
         
     | 
| 
       25 
16 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                 
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                 
     | 
| 
      
 17 
     | 
    
         
            +
                svg, _ = RXFHelper.read(s)    
         
     | 
| 
      
 18 
     | 
    
         
            +
                doc = model.new(svg, debug: debug)
         
     | 
| 
      
 19 
     | 
    
         
            +
                @a = Render.new(doc, debug: debug).to_a    
         
     | 
| 
       29 
20 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                def obj()
         
     | 
| 
       31 
     | 
    
         
            -
                  @obj
         
     | 
| 
       32 
     | 
    
         
            -
                end
         
     | 
| 
       33 
21 
     | 
    
         | 
| 
       34 
22 
     | 
    
         
             
              end
         
     | 
| 
       35 
23 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
              def to_a()
         
     | 
| 
      
 25 
     | 
    
         
            +
                @a
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
              
         
     | 
| 
       36 
28 
     | 
    
         
             
            end
         
     | 
| 
       37 
29 
     | 
    
         | 
| 
       38 
30 
     | 
    
         
             
            class R2dSvg
         
     | 
| 
       39 
31 
     | 
    
         
             
              include Ruby2D
         
     | 
| 
      
 32 
     | 
    
         
            +
              include R2dEngine
         
     | 
| 
       40 
33 
     | 
    
         
             
              using ColouredText
         
     | 
| 
       41 
34 
     | 
    
         
             
              using SvgleX
         
     | 
| 
       42 
35 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
               
     | 
| 
       44 
     | 
    
         
            -
                
         
     | 
| 
       45 
     | 
    
         
            -
                def audio(e, attributes, raw_style)
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                  puts 'inside audio attributes: ' + attributes.inspect if @debug
         
     | 
| 
       48 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       49 
     | 
    
         
            -
                  h = attributes
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                  sources = e.xpath('source').map do |x|
         
     | 
| 
       52 
     | 
    
         
            -
                    h = x.attributes.to_h
         
     | 
| 
       53 
     | 
    
         
            -
                    h.delete :style
         
     | 
| 
       54 
     | 
    
         
            -
                    h
         
     | 
| 
       55 
     | 
    
         
            -
                  end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                  [:embed_audio, sources, e]
         
     | 
| 
       58 
     | 
    
         
            -
                end    
         
     | 
| 
       59 
     | 
    
         
            -
                
         
     | 
| 
       60 
     | 
    
         
            -
                def circle(e, attributes, raw_style)
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                  h = attributes
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                  x, y, radius= %i(cx cy r).map{|x| h[x].to_i }
         
     | 
| 
       67 
     | 
    
         
            -
                  fill = h[:fill]
         
     | 
| 
       68 
     | 
    
         
            -
                  
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                  [:draw_circle, [x, y], radius, fill, style, render_all(e)]
         
     | 
| 
       71 
     | 
    
         
            -
                end       
         
     | 
| 
       72 
     | 
    
         
            -
                
         
     | 
| 
       73 
     | 
    
         
            -
                # not yet implemented
         
     | 
| 
       74 
     | 
    
         
            -
                #
         
     | 
| 
       75 
     | 
    
         
            -
                def ellipse(e, attributes, raw_style)
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       78 
     | 
    
         
            -
                  h = attributes
         
     | 
| 
      
 36 
     | 
    
         
            +
              attr_reader :doc
         
     | 
| 
       79 
37 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
                  width = h[:rx].to_i * 2
         
     | 
| 
       82 
     | 
    
         
            -
                  height = h[:ry].to_i * 2
         
     | 
| 
      
 38 
     | 
    
         
            +
              def initialize(s, title: 'R2dSVG', debug: false, server: false)
         
     | 
| 
       83 
39 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                end    
         
     | 
| 
      
 40 
     | 
    
         
            +
                @debug = debug
         
     | 
| 
       86 
41 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
                 
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
                  x1, y1, x2, y2 = %i(x1 y1 x2 y2).map{|x| attributes[x].to_i }
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
                  [:draw_line, [x1, y1, x2, y2], style, render_all(e)]
         
     | 
| 
       94 
     | 
    
         
            -
                end   
         
     | 
| 
       95 
     | 
    
         
            -
                    
         
     | 
| 
      
 42 
     | 
    
         
            +
                @window = window = Window.new
         
     | 
| 
      
 43 
     | 
    
         
            +
                @loaded = false
         
     | 
| 
      
 44 
     | 
    
         
            +
                @model = Svgle
         
     | 
| 
       96 
45 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
                 
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       100 
     | 
    
         
            -
                  h = attributes
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                  x, y, width, height = %i(x y width height).map{|x| h[x] ? h[x].to_i : nil }
         
     | 
| 
       103 
     | 
    
         
            -
                  src = h[:'xlink:href']
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                  [:draw_image, [x, y, width, height], src, style, e, render_all(e)]
         
     | 
| 
       106 
     | 
    
         
            -
                end       
         
     | 
| 
       107 
     | 
    
         
            -
                
         
     | 
| 
       108 
     | 
    
         
            -
                def polygon(e, attributes, raw_style)
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       111 
     | 
    
         
            -
                  points = attributes[:points].split(/\s+/). \
         
     | 
| 
       112 
     | 
    
         
            -
                                                   map {|x| x.split(/\s*,\s*/).map(&:to_i)}
         
     | 
| 
      
 46 
     | 
    
         
            +
                read(s, title)    
         
     | 
| 
       113 
47 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                def polyline(e, attributes, raw_style)
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       120 
     | 
    
         
            -
                  points = attributes[:points].split(/\s+/). \
         
     | 
| 
       121 
     | 
    
         
            -
                                                   map {|x| x.split(/\s*,\s*/).map(&:to_i)}
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
                  [:draw_lines, points, style, render_all(e)]
         
     | 
| 
       124 
     | 
    
         
            -
                end      
         
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
                def rect(e, attributes, raw_style)
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
                  puts 'inside rect attributes: ' + attributes.inspect if @debug
         
     | 
| 
       129 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       130 
     | 
    
         
            -
                  h = attributes
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                  x1, y1, width, height = %i(x y width height).map{|x| h[x].to_i }
         
     | 
| 
       133 
     | 
    
         
            -
                  x2, y2, = x1 + width, y1 + height
         
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
                  [:draw_rectangle, [x1, y1, x2, y2], style, e, render_all(e)]
         
     | 
| 
      
 48 
     | 
    
         
            +
                if server then
         
     | 
| 
      
 49 
     | 
    
         
            +
                  drb = OneDrb::Server.new(host: '127.0.0.1', port: '57844', obj: self)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  Thread.new { drb.start }
         
     | 
| 
       136 
51 
     | 
    
         
             
                end
         
     | 
| 
       137 
52 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
                 
     | 
| 
       139 
     | 
    
         
            -
                  [:script]
         
     | 
| 
       140 
     | 
    
         
            -
                end     
         
     | 
| 
       141 
     | 
    
         
            -
                   
         
     | 
| 
       142 
     | 
    
         
            -
                def svg(e, attributes, raw_style)
         
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
                  style = style_filter(attributes).merge(raw_style)
         
     | 
| 
       145 
     | 
    
         
            -
                        
         
     | 
| 
       146 
     | 
    
         
            -
                  h = attributes
         
     | 
| 
       147 
     | 
    
         
            -
                  width, height = %i(width height).map{|x| h[x].to_i }
         
     | 
| 
      
 53 
     | 
    
         
            +
                if @loaded then
         
     | 
| 
       148 
54 
     | 
    
         | 
| 
       149 
     | 
    
         
            -
                   
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
                   
     | 
| 
       155 
     | 
    
         
            -
                  style.merge!({font_size: '20'})
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
                  x, y = %i(x y).map{|x| attributes[x].to_i }
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                  [:draw_text, [x, y], e.text, style, e, render_all(e)]
         
     | 
| 
       160 
     | 
    
         
            -
                end        
         
     | 
| 
      
 55 
     | 
    
         
            +
                  window.on(:mouse_move) do |event|
         
     | 
| 
      
 56 
     | 
    
         
            +
                    mouse :mousemove, event
         
     | 
| 
      
 57 
     | 
    
         
            +
                    mouse :mouseenter, event
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
                  
         
     | 
| 
      
 60 
     | 
    
         
            +
                  window.on(:mouse_down) do |event|
         
     | 
| 
       161 
61 
     | 
    
         | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
                    if event.button == :left then
         
     | 
| 
      
 63 
     | 
    
         
            +
                      
         
     | 
| 
      
 64 
     | 
    
         
            +
                      # click and mousedown do the same thing
         
     | 
| 
      
 65 
     | 
    
         
            +
                      mouse :click, event 
         
     | 
| 
      
 66 
     | 
    
         
            +
                      mouse :mousedown, event
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
      
 68 
     | 
    
         
            +
                    
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end          
         
     | 
| 
       163 
70 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
                    attributes.has_key?(x) ? r.merge(x => attributes[x]) : r          
         
     | 
| 
      
 71 
     | 
    
         
            +
                  window.on :key_down do |event|
         
     | 
| 
      
 72 
     | 
    
         
            +
                    # A key was pressed
         
     | 
| 
      
 73 
     | 
    
         
            +
                    keyboard :keydown, event
         
     | 
| 
       168 
74 
     | 
    
         
             
                  end
         
     | 
| 
       169 
75 
     | 
    
         | 
| 
       170 
76 
     | 
    
         
             
                end
         
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
                
         
     | 
| 
       177 
     | 
    
         
            -
                attr_accessor :area
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
       180 
     | 
    
         
            -
                def initialize(window, debug: false)
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                  @window, @debug = window, debug     
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
      
 77 
     | 
    
         
            +
            =begin     
         
     | 
| 
      
 78 
     | 
    
         
            +
                window.on :key_held do |event|
         
     | 
| 
      
 79 
     | 
    
         
            +
                  # A key is being held down
         
     | 
| 
      
 80 
     | 
    
         
            +
                  puts event.key
         
     | 
| 
      
 81 
     | 
    
         
            +
                  keyboard :onkeyheld, event
         
     | 
| 
       184 
82 
     | 
    
         
             
                end
         
     | 
| 
       185 
83 
     | 
    
         | 
| 
       186 
     | 
    
         
            -
                 
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
                   
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
                  x, y, width, height = dimensions
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
                  #gc = gc_ini(fill: style[:fill] || :none)
         
     | 
| 
       193 
     | 
    
         
            -
                  #@area.window.draw_arc(gc, 1, x, y, width, height, 0, 64 * 360)
         
     | 
| 
       194 
     | 
    
         
            -
                end      
         
     | 
| 
       195 
     | 
    
         
            -
                
         
     | 
| 
       196 
     | 
    
         
            -
                def draw_circle(args)
         
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
                  coords, radius, fill, style, e = args
         
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
                  x1, y1 = coords
         
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
                  if @debug then
         
     | 
| 
       203 
     | 
    
         
            -
                    puts 'inside draw_circle'.info
         
     | 
| 
       204 
     | 
    
         
            -
                    puts ('style: ' + style.inspect).debug 
         
     | 
| 
       205 
     | 
    
         
            -
                  end 
         
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
                  obj = Circle.new(
         
     | 
| 
       208 
     | 
    
         
            -
                    x: x1, y: y1,
         
     | 
| 
       209 
     | 
    
         
            -
                    radius: radius,
         
     | 
| 
       210 
     | 
    
         
            -
                    sectors: 32,
         
     | 
| 
       211 
     | 
    
         
            -
                    color: style[:fill],
         
     | 
| 
       212 
     | 
    
         
            -
                    z: style[:"z-index"].to_i
         
     | 
| 
       213 
     | 
    
         
            -
                  )
         
     | 
| 
       214 
     | 
    
         
            -
                  e.obj = obj if e.respond_to? :obj=
         
     | 
| 
       215 
     | 
    
         
            -
                  @window.add obj
         
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
      
 84 
     | 
    
         
            +
                window.on :key_up do |event|
         
     | 
| 
      
 85 
     | 
    
         
            +
                  # A key was released
         
     | 
| 
      
 86 
     | 
    
         
            +
                  puts event.key
         
     | 
| 
      
 87 
     | 
    
         
            +
                  keyboard :onkeyup, event
         
     | 
| 
       217 
88 
     | 
    
         
             
                end    
         
     | 
| 
      
 89 
     | 
    
         
            +
            =end
         
     | 
| 
      
 90 
     | 
    
         
            +
                window.show
         
     | 
| 
       218 
91 
     | 
    
         | 
| 
       219 
     | 
    
         
            -
                def draw_image(args)
         
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
                  dimensions, src, style, e = args
         
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
                  x, y, width, height = dimensions      
         
     | 
| 
       224 
     | 
    
         
            -
                  
         
     | 
| 
       225 
     | 
    
         
            -
                  filepath = Tempfile.new('r2dsvg').path + File.basename(src)
         
     | 
| 
       226 
     | 
    
         
            -
                  puts 'filepath: ' + filepath.inspect if @debug
         
     | 
| 
       227 
     | 
    
         
            -
                  File.write filepath, RXFHelper.read(src).first
         
     | 
| 
       228 
     | 
    
         
            -
                    
         
     | 
| 
       229 
     | 
    
         
            -
                  
         
     | 
| 
       230 
     | 
    
         
            -
                  if File.exists? filepath then
         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
                    obj = Image.new(
         
     | 
| 
       233 
     | 
    
         
            -
                      filepath,
         
     | 
| 
       234 
     | 
    
         
            -
                      x: x, y: y,
         
     | 
| 
       235 
     | 
    
         
            -
                      width: width, height: height,
         
     | 
| 
       236 
     | 
    
         
            -
                      color: style[:fill],
         
     | 
| 
       237 
     | 
    
         
            -
                      z: style[:"z-index"].to_i
         
     | 
| 
       238 
     | 
    
         
            -
                    )        
         
     | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
       240 
     | 
    
         
            -
                    e.obj = obj if e.respond_to? :obj=
         
     | 
| 
       241 
     | 
    
         
            -
                    @window.add obj
         
     | 
| 
       242 
     | 
    
         
            -
                  end
         
     | 
| 
       243 
     | 
    
         
            -
                end     
         
     | 
| 
       244 
92 
     | 
    
         | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
     | 
    
         
            -
             
     | 
| 
       248 
     | 
    
         
            -
             
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
                    puts 'inside draw_rectangle'.info
         
     | 
| 
       253 
     | 
    
         
            -
                    puts ('style: ' + style.inspect).debug 
         
     | 
| 
       254 
     | 
    
         
            -
                  end 
         
     | 
| 
      
 93 
     | 
    
         
            +
              end
         
     | 
| 
      
 94 
     | 
    
         
            +
              
         
     | 
| 
      
 95 
     | 
    
         
            +
              def clear()
         
     | 
| 
      
 96 
     | 
    
         
            +
                @window.clear
         
     | 
| 
      
 97 
     | 
    
         
            +
              end
         
     | 
| 
      
 98 
     | 
    
         
            +
              
         
     | 
| 
      
 99 
     | 
    
         
            +
              def read(unknown, title=@title)
         
     | 
| 
       255 
100 
     | 
    
         | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
                    width: style[:"stroke-width"].to_f,
         
     | 
| 
       260 
     | 
    
         
            -
                    color: style[:"stroke"],
         
     | 
| 
       261 
     | 
    
         
            -
                    z: style[:"z-index"].to_i
         
     | 
| 
       262 
     | 
    
         
            -
                  ) 
         
     | 
| 
       263 
     | 
    
         
            -
                  
         
     | 
| 
       264 
     | 
    
         
            -
                  e.obj = obj if e.respond_to? :obj=
         
     | 
| 
       265 
     | 
    
         
            -
                  @window.add obj
         
     | 
| 
       266 
     | 
    
         
            -
                  
         
     | 
| 
       267 
     | 
    
         
            -
                end    
         
     | 
| 
      
 101 
     | 
    
         
            +
                @loaded = false
         
     | 
| 
      
 102 
     | 
    
         
            +
                @window.clear
         
     | 
| 
      
 103 
     | 
    
         
            +
                doc = nil
         
     | 
| 
       268 
104 
     | 
    
         | 
| 
       269 
     | 
    
         
            -
                 
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
                   
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
                   
     | 
| 
       274 
     | 
    
         
            -
                  coords = points
         
     | 
| 
      
 105 
     | 
    
         
            +
                if unknown.is_a? String
         
     | 
| 
      
 106 
     | 
    
         
            +
                  
         
     | 
| 
      
 107 
     | 
    
         
            +
                  svg, _ = RXFHelper.read(unknown)    
         
     | 
| 
      
 108 
     | 
    
         
            +
                  doc = @model.new(svg, callback: self, debug: @debug)
         
     | 
| 
      
 109 
     | 
    
         
            +
                  instructions = Render.new(doc, debug: @debug).to_a      
         
     | 
| 
       275 
110 
     | 
    
         | 
| 
       276 
     | 
    
         
            -
             
     | 
| 
       277 
     | 
    
         
            -
                    puts 'inside draw_polygon'.info
         
     | 
| 
       278 
     | 
    
         
            -
                    puts ('style: ' + style.inspect).debug 
         
     | 
| 
       279 
     | 
    
         
            -
                  end 
         
     | 
| 
      
 111 
     | 
    
         
            +
                elsif unknown.is_a? Array
         
     | 
| 
       280 
112 
     | 
    
         | 
| 
       281 
     | 
    
         
            -
                  puts  
     | 
| 
      
 113 
     | 
    
         
            +
                  puts 'array found' if @debug
         
     | 
| 
      
 114 
     | 
    
         
            +
                  
         
     | 
| 
      
 115 
     | 
    
         
            +
                  instructions = unknown
         
     | 
| 
       282 
116 
     | 
    
         | 
| 
       283 
     | 
    
         
            -
                  h = coords.map.with_index do |c2,i|
         
     | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
                    %w(x y).zip(c2).map {|key, c| [(key + (i+1).to_s).to_sym, c] }
         
     | 
| 
       286 
     | 
    
         
            -
                    
         
     | 
| 
       287 
     | 
    
         
            -
                  end.flatten(1).to_h
         
     | 
| 
       288 
     | 
    
         
            -
                  puts ('triangle h: ' + h.inspect).debug if @debug      
         
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
       290 
     | 
    
         
            -
                  puts ('triangle h merged: ' + h.inspect).debug if @debug
         
     | 
| 
       291 
     | 
    
         
            -
                  obj = Triangle.new(h.merge({color: style[:fill], z: style[:"z-index"].to_i}))
         
     | 
| 
       292 
     | 
    
         
            -
                  e.obj = obj if e.respond_to? :obj=
         
     | 
| 
       293 
     | 
    
         
            -
                  @window.add obj
         
     | 
| 
       294 
     | 
    
         
            -
                end       
         
     | 
| 
       295 
     | 
    
         
            -
             
     | 
| 
       296 
     | 
    
         
            -
             
     | 
| 
       297 
     | 
    
         
            -
                # not yet implemented
         
     | 
| 
       298 
     | 
    
         
            -
                #
         
     | 
| 
       299 
     | 
    
         
            -
                def draw_lines(args)
         
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
     | 
    
         
            -
                  coords, width, style, e = args
         
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
       303 
     | 
    
         
            -
                  x1, y1, x2, y2 = coords
         
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
                 
         
     | 
| 
       306 
     | 
    
         
            -
                end       
         
     | 
| 
       307 
     | 
    
         
            -
                
         
     | 
| 
       308 
     | 
    
         
            -
                def draw_rectangle(args)
         
     | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
                  coords, style, e = args
         
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
       312 
     | 
    
         
            -
                  x1, y1, x2, y2 = coords
         
     | 
| 
       313 
     | 
    
         
            -
             
     | 
| 
       314 
     | 
    
         
            -
                  if @debug then
         
     | 
| 
       315 
     | 
    
         
            -
                    puts 'inside draw_rectangle'.info
         
     | 
| 
       316 
     | 
    
         
            -
                    puts ('style: ' + style.inspect).debug 
         
     | 
| 
       317 
     | 
    
         
            -
                  end 
         
     | 
| 
       318 
     | 
    
         
            -
             
     | 
| 
       319 
     | 
    
         
            -
                  obj = Rectangle.new(
         
     | 
| 
       320 
     | 
    
         
            -
                    x: x1, y: y1,
         
     | 
| 
       321 
     | 
    
         
            -
                    width: x2 - x1, height: y2 - y1,
         
     | 
| 
       322 
     | 
    
         
            -
                    color: style[:fill],
         
     | 
| 
       323 
     | 
    
         
            -
                    z: style[:"z-index"].to_i
         
     | 
| 
       324 
     | 
    
         
            -
                  )
         
     | 
| 
       325 
     | 
    
         
            -
                  e.obj = obj if e.respond_to? :obj=
         
     | 
| 
       326 
     | 
    
         
            -
                  @window.add obj
         
     | 
| 
       327 
     | 
    
         
            -
             
     | 
| 
       328 
     | 
    
         
            -
                end
         
     | 
| 
       329 
     | 
    
         
            -
                
         
     | 
| 
       330 
     | 
    
         
            -
                def draw_text(args)
         
     | 
| 
       331 
     | 
    
         
            -
             
     | 
| 
       332 
     | 
    
         
            -
                  coords, text, style, e = args
         
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
       334 
     | 
    
         
            -
                  x, y = coords
         
     | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
                  if @debug then
         
     | 
| 
       337 
     | 
    
         
            -
                    puts 'inside draw_text'.info
         
     | 
| 
       338 
     | 
    
         
            -
                    puts ('style: ' + style.inspect).debug 
         
     | 
| 
       339 
     | 
    
         
            -
                  end 
         
     | 
| 
       340 
     | 
    
         
            -
                 
         
     | 
| 
       341 
     | 
    
         
            -
                  obj = Text.new(
         
     | 
| 
       342 
     | 
    
         
            -
                    text,
         
     | 
| 
       343 
     | 
    
         
            -
                    x: x, y: y,
         
     | 
| 
       344 
     | 
    
         
            -
                    #font: 'vera.ttf',
         
     | 
| 
       345 
     | 
    
         
            -
                    size: style[:font_size].to_i,
         
     | 
| 
       346 
     | 
    
         
            -
                    color: style[:color],
         
     | 
| 
       347 
     | 
    
         
            -
                    z: style[:"z-index"].to_i
         
     | 
| 
       348 
     | 
    
         
            -
                  )
         
     | 
| 
       349 
     | 
    
         
            -
                  e.obj = obj
         
     | 
| 
       350 
     | 
    
         
            -
                  @window.add obj
         
     | 
| 
       351 
     | 
    
         
            -
             
     | 
| 
       352 
117 
     | 
    
         
             
                end
         
     | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
                 
     | 
| 
       355 
     | 
    
         
            -
                # MP3, Ogg Vorbis, and FLAC.
         
     | 
| 
      
 118 
     | 
    
         
            +
             
         
     | 
| 
      
 119 
     | 
    
         
            +
                drawing = DrawingInstructions.new @window, debug: @debug
         
     | 
| 
       356 
120 
     | 
    
         | 
| 
       357 
     | 
    
         
            -
                 
     | 
| 
      
 121 
     | 
    
         
            +
                if doc then    
         
     | 
| 
       358 
122 
     | 
    
         | 
| 
       359 
     | 
    
         
            -
                   
     | 
| 
      
 123 
     | 
    
         
            +
                  @width, @height = %i(width height).map{|x| doc.root.attributes[x].to_i }
         
     | 
| 
      
 124 
     | 
    
         
            +
                  @window.set title: title, width: @width, height: @height        
         
     | 
| 
      
 125 
     | 
    
         
            +
                
         
     | 
| 
       360 
126 
     | 
    
         | 
| 
       361 
     | 
    
         
            -
                   
     | 
| 
       362 
     | 
    
         
            -
                    puts 'sources: ' + sources.inspect if @debug
         
     | 
| 
       363 
     | 
    
         
            -
                    puts 'inside embed_audio'.info
         
     | 
| 
       364 
     | 
    
         
            -
                  end 
         
     | 
| 
       365 
     | 
    
         
            -
                 
         
     | 
| 
      
 127 
     | 
    
         
            +
                  threads = []
         
     | 
| 
       366 
128 
     | 
    
         | 
| 
       367 
     | 
    
         
            -
                   
     | 
| 
       368 
     | 
    
         
            -
                    
         
     | 
| 
       369 
     | 
    
         
            -
                     
     | 
| 
       370 
     | 
    
         
            -
                    File.write filepath, RXFHelper.read(source[:src]).first
         
     | 
| 
       371 
     | 
    
         
            -
                    filepath
         
     | 
| 
      
 129 
     | 
    
         
            +
                  threads << Thread.new do
         
     | 
| 
      
 130 
     | 
    
         
            +
                    doc.root.xpath('//script').each {|x| eval x.texts.join }      
         
     | 
| 
      
 131 
     | 
    
         
            +
                    drawing.render instructions   
         
     | 
| 
       372 
132 
     | 
    
         
             
                  end
         
     | 
| 
       373 
133 
     | 
    
         | 
| 
       374 
     | 
    
         
            -
                   
     | 
| 
       375 
     | 
    
         
            -
                  
         
     | 
| 
       376 
     | 
    
         
            -
                  return unless audio
         
     | 
| 
       377 
     | 
    
         
            -
                  
         
     | 
| 
       378 
     | 
    
         
            -
                  file = File.exists?(audio) ? audio : nil
         
     | 
| 
       379 
     | 
    
         
            -
                  puts 'file: ' + file.inspect if @debug
         
     | 
| 
      
 134 
     | 
    
         
            +
                  threads.join
         
     | 
| 
       380 
135 
     | 
    
         | 
| 
       381 
     | 
    
         
            -
                   
     | 
| 
       382 
     | 
    
         
            -
                   
     | 
| 
      
 136 
     | 
    
         
            +
                  @loaded = true
         
     | 
| 
      
 137 
     | 
    
         
            +
                  @doc = doc
         
     | 
| 
       383 
138 
     | 
    
         | 
| 
       384 
     | 
    
         
            -
             
     | 
| 
       385 
     | 
    
         
            -
             
     | 
| 
       386 
     | 
    
         
            -
                end     
         
     | 
| 
       387 
     | 
    
         
            -
                
         
     | 
| 
       388 
     | 
    
         
            -
                def window(args)
         
     | 
| 
       389 
     | 
    
         
            -
                end
         
     | 
| 
       390 
     | 
    
         
            -
             
     | 
| 
       391 
     | 
    
         
            -
                def render(a)
         
     | 
| 
       392 
     | 
    
         
            -
                  method(a[0]).call(args=a[1..2])
         
     | 
| 
       393 
     | 
    
         
            -
                  draw a[3]
         
     | 
| 
       394 
     | 
    
         
            -
                end
         
     | 
| 
       395 
     | 
    
         
            -
                
         
     | 
| 
       396 
     | 
    
         
            -
                def script(args)
         
     | 
| 
       397 
     | 
    
         
            -
             
     | 
| 
       398 
     | 
    
         
            -
                end         
         
     | 
| 
       399 
     | 
    
         
            -
             
     | 
| 
       400 
     | 
    
         
            -
                private
         
     | 
| 
       401 
     | 
    
         
            -
             
     | 
| 
       402 
     | 
    
         
            -
                def draw(a)
         
     | 
| 
      
 139 
     | 
    
         
            +
                else
         
     | 
| 
       403 
140 
     | 
    
         | 
| 
       404 
     | 
    
         
            -
                   
     | 
| 
       405 
     | 
    
         
            -
             
     | 
| 
       406 
     | 
    
         
            -
             
     | 
| 
       407 
     | 
    
         
            -
             
     | 
| 
       408 
     | 
    
         
            -
                    if x.is_a? Symbol then
         
     | 
| 
       409 
     | 
    
         
            -
                      method(x).call(args=remaining)
         
     | 
| 
       410 
     | 
    
         
            -
                    elsif x.is_a? String then
         
     | 
| 
       411 
     | 
    
         
            -
                      draw remaining
         
     | 
| 
       412 
     | 
    
         
            -
                    elsif x.is_a? Array
         
     | 
| 
       413 
     | 
    
         
            -
                      draw remaining
         
     | 
| 
       414 
     | 
    
         
            -
                    else        
         
     | 
| 
       415 
     | 
    
         
            -
                      method(x).call(remaining.take 2)
         
     | 
| 
       416 
     | 
    
         
            -
                    end
         
     | 
| 
       417 
     | 
    
         
            -
                    
         
     | 
| 
       418 
     | 
    
         
            -
                  end
         
     | 
| 
       419 
     | 
    
         
            -
             
     | 
| 
      
 141 
     | 
    
         
            +
                  drawing.render instructions   
         
     | 
| 
      
 142 
     | 
    
         
            +
                  h = instructions[2]
         
     | 
| 
      
 143 
     | 
    
         
            +
                  @width, @height = h[:width].to_i, h[:height].to_i
         
     | 
| 
      
 144 
     | 
    
         
            +
                  @window.set title: 'Untitled', width: @width, height: @height    
         
     | 
| 
       420 
145 
     | 
    
         
             
                end
         
     | 
| 
       421 
     | 
    
         
            -
             
     | 
| 
       422 
     | 
    
         
            -
              end
         
     | 
| 
       423 
     | 
    
         
            -
             
     | 
| 
       424 
     | 
    
         
            -
              def initialize(svg, title: 'R2dSVG', debug: false)
         
     | 
| 
       425 
     | 
    
         
            -
             
     | 
| 
       426 
     | 
    
         
            -
                @svg, @debug = svg, debug
         
     | 
| 
       427 
     | 
    
         
            -
                doc = Svgle.new(svg, callback: self, debug: debug)
         
     | 
| 
       428 
     | 
    
         
            -
                instructions = Render.new(doc, debug: debug).to_a
         
     | 
| 
       429 
     | 
    
         
            -
             
     | 
| 
       430 
     | 
    
         
            -
                window = Window.new        
         
     | 
| 
       431 
     | 
    
         
            -
                drawing = DrawingInstructions.new window, debug: debug
         
     | 
| 
       432 
     | 
    
         
            -
                puts ('instructions: ' + instructions.inspect).debug if @debug
         
     | 
| 
       433 
     | 
    
         
            -
             
     | 
| 
       434 
     | 
    
         
            -
                @width, @height = %i(width height).map{|x| doc.root.attributes[x].to_i }
         
     | 
| 
       435 
     | 
    
         
            -
                window.set title: title, width: @width, height: @height        
         
     | 
| 
       436 
     | 
    
         
            -
                
         
     | 
| 
       437 
146 
     | 
    
         | 
| 
       438 
     | 
    
         
            -
             
     | 
| 
      
 147 
     | 
    
         
            +
              end  
         
     | 
| 
      
 148 
     | 
    
         
            +
              
         
     | 
| 
      
 149 
     | 
    
         
            +
              def refresh()
         
     | 
| 
      
 150 
     | 
    
         
            +
                puts 'do nothing' if @debug
         
     | 
| 
      
 151 
     | 
    
         
            +
              end
         
     | 
| 
      
 152 
     | 
    
         
            +
              
         
     | 
| 
      
 153 
     | 
    
         
            +
              
         
     | 
| 
      
 154 
     | 
    
         
            +
              private
         
     | 
| 
      
 155 
     | 
    
         
            +
              
         
     | 
| 
      
 156 
     | 
    
         
            +
              def keyboard(action, event)
         
     | 
| 
       439 
157 
     | 
    
         | 
| 
       440 
     | 
    
         
            -
                 
     | 
| 
       441 
     | 
    
         
            -
             
     | 
| 
       442 
     | 
    
         
            -
                @doc = doc              
         
     | 
| 
      
 158 
     | 
    
         
            +
                doc = @doc
         
     | 
| 
       443 
159 
     | 
    
         | 
| 
       444 
     | 
    
         
            -
                 
     | 
| 
      
 160 
     | 
    
         
            +
                @doc.root.xpath("//*[@on#{action}]").each do |x|
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                  if block_given? then
         
     | 
| 
      
 163 
     | 
    
         
            +
                    valid = yield(x)
         
     | 
| 
      
 164 
     | 
    
         
            +
                    statement = x.method(('on' + action.to_s).to_sym).call()
         
     | 
| 
      
 165 
     | 
    
         
            +
                    puts 'statement: ' + statement.inspect if @debug
         
     | 
| 
      
 166 
     | 
    
         
            +
                    eval statement if valid
         
     | 
| 
      
 167 
     | 
    
         
            +
                  else
         
     | 
| 
      
 168 
     | 
    
         
            +
                    statement = x.method(('on' + action.to_s).to_sym).call()
         
     | 
| 
      
 169 
     | 
    
         
            +
                    puts 'statement: ' + statement.inspect if @debug
         
     | 
| 
      
 170 
     | 
    
         
            +
                    eval statement
         
     | 
| 
      
 171 
     | 
    
         
            +
                  end
         
     | 
| 
       445 
172 
     | 
    
         | 
| 
       446 
     | 
    
         
            -
                window.on(:mouse_down) do |event|
         
     | 
| 
       447 
     | 
    
         
            -
                  mouse :down, event if event.button == :left
         
     | 
| 
       448 
173 
     | 
    
         
             
                end
         
     | 
| 
       449 
     | 
    
         
            -
             
     | 
| 
       450 
     | 
    
         
            -
             
     | 
| 
       451 
     | 
    
         
            -
             
     | 
| 
       452 
     | 
    
         
            -
              end
         
     | 
| 
       453 
     | 
    
         
            -
              
         
     | 
| 
       454 
     | 
    
         
            -
              private
         
     | 
| 
      
 174 
     | 
    
         
            +
                
         
     | 
| 
      
 175 
     | 
    
         
            +
                @doc.event[action].each {|name| method(name).call event }
         
     | 
| 
      
 176 
     | 
    
         
            +
                    
         
     | 
| 
      
 177 
     | 
    
         
            +
              end  
         
     | 
| 
       455 
178 
     | 
    
         | 
| 
       456 
179 
     | 
    
         
             
              def mouse(action, event)
         
     | 
| 
       457 
180 
     | 
    
         | 
| 
       458 
181 
     | 
    
         
             
                doc = @doc
         
     | 
| 
       459 
182 
     | 
    
         | 
| 
       460 
     | 
    
         
            -
                @doc.root.xpath("//*[@ 
     | 
| 
      
 183 
     | 
    
         
            +
                @doc.root.xpath("//*[@on#{action}]").each do |x|
         
     | 
| 
       461 
184 
     | 
    
         | 
| 
       462 
185 
     | 
    
         
             
                  #puts 'x.class: ' + x.inspect if @debug
         
     | 
| 
       463 
186 
     | 
    
         
             
                  if x.obj and x.obj.contains? event.x, event.y then
         
     | 
| 
       464 
     | 
    
         
            -
                     
     | 
| 
      
 187 
     | 
    
         
            +
                    
         
     | 
| 
      
 188 
     | 
    
         
            +
                      
         
     | 
| 
      
 189 
     | 
    
         
            +
                    if not x.active? then
         
     | 
| 
      
 190 
     | 
    
         
            +
                      x.active = true
         
     | 
| 
      
 191 
     | 
    
         
            +
                    elsif action == :mouseenter
         
     | 
| 
      
 192 
     | 
    
         
            +
                      next
         
     | 
| 
      
 193 
     | 
    
         
            +
                    end
         
     | 
| 
      
 194 
     | 
    
         
            +
                              
         
     | 
| 
      
 195 
     | 
    
         
            +
                    if block_given? then
         
     | 
| 
      
 196 
     | 
    
         
            +
                      valid = yield(x)
         
     | 
| 
      
 197 
     | 
    
         
            +
                      statement = x.method(('on' + action.to_s).to_sym).call()
         
     | 
| 
      
 198 
     | 
    
         
            +
                      puts 'statement: ' + statement.inspect if @debug
         
     | 
| 
      
 199 
     | 
    
         
            +
                      eval statement if valid
         
     | 
| 
      
 200 
     | 
    
         
            +
                    else
         
     | 
| 
      
 201 
     | 
    
         
            +
                      statement = x.method(('on' + action.to_s).to_sym).call()
         
     | 
| 
      
 202 
     | 
    
         
            +
                      puts 'statement: ' + statement.inspect if @debug
         
     | 
| 
      
 203 
     | 
    
         
            +
                      eval statement
         
     | 
| 
      
 204 
     | 
    
         
            +
                    end
         
     | 
| 
      
 205 
     | 
    
         
            +
                    
         
     | 
| 
      
 206 
     | 
    
         
            +
                  else
         
     | 
| 
      
 207 
     | 
    
         
            +
                    
         
     | 
| 
      
 208 
     | 
    
         
            +
                    if x.active? then
         
     | 
| 
      
 209 
     | 
    
         
            +
                      x.active = false
         
     | 
| 
      
 210 
     | 
    
         
            +
                      onleave
         
     | 
| 
      
 211 
     | 
    
         
            +
                    end
         
     | 
| 
       465 
212 
     | 
    
         
             
                  end
         
     | 
| 
       466 
213 
     | 
    
         | 
| 
       467 
214 
     | 
    
         
             
                end
         
     | 
| 
       468 
215 
     | 
    
         | 
| 
       469 
216 
     | 
    
         
             
              end
         
     | 
| 
      
 217 
     | 
    
         
            +
              
         
     | 
| 
      
 218 
     | 
    
         
            +
              def onleave()
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
                @doc.root.xpath("//*[@onmouseleave]").each do |x|
         
     | 
| 
      
 221 
     | 
    
         
            +
                  puts 'onleave'.info if @debug
         
     | 
| 
      
 222 
     | 
    
         
            +
                  eval x.method(:onmouseleave).call()
         
     | 
| 
      
 223 
     | 
    
         
            +
                end
         
     | 
| 
      
 224 
     | 
    
         
            +
             
     | 
| 
      
 225 
     | 
    
         
            +
              end    
         
     | 
| 
      
 226 
     | 
    
         
            +
                
         
     | 
| 
       470 
227 
     | 
    
         
             
            end
         
     | 
| 
       471 
228 
     | 
    
         | 
| 
       472 
229 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: r2dsvg
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - James Robertson
         
     | 
| 
         @@ -11,31 +11,31 @@ cert_chain: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            - |
         
     | 
| 
       12 
12 
     | 
    
         
             
              -----BEGIN CERTIFICATE-----
         
     | 
| 
       13 
13 
     | 
    
         
             
              MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
         
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
               
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
               
     | 
| 
       25 
     | 
    
         
            -
               
     | 
| 
       26 
     | 
    
         
            -
               
     | 
| 
      
 14 
     | 
    
         
            +
              YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwNDMwMTkyMTE0WhcN
         
     | 
| 
      
 15 
     | 
    
         
            +
              MjEwNDMwMTkyMTE0WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
         
     | 
| 
      
 16 
     | 
    
         
            +
              cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC0pOK2
         
     | 
| 
      
 17 
     | 
    
         
            +
              4cEo9eTgZjcf6hCWPhfzB8ylmXTwD3lS6OIzBDsEt3xCkJo8XnTi5d/nsPujrS0p
         
     | 
| 
      
 18 
     | 
    
         
            +
              +UyMbXmvMg930CR1RVfNIiyxvIxns4pG5nqCWNfYVybIptl+TTmVDu68H7Y2IcVa
         
     | 
| 
      
 19 
     | 
    
         
            +
              UWTATtB6lVnzm9xJAOwUB1gdR4dQ4qYQtzRUIbSfBpRKzz7xzlIAMtUTNpO+VsIM
         
     | 
| 
      
 20 
     | 
    
         
            +
              T7PjVDuS3Q3t9yEsWMjHJiK4HjA/cYFpv2gb3uu6Nte6DB9tzAjDkyaDiyiBe0Zf
         
     | 
| 
      
 21 
     | 
    
         
            +
              Po6GiicAktTdU8KPGCz095AvuEntMiogfU5+J+h+5UQ06s6f8i50MCjyTCpQRBOf
         
     | 
| 
      
 22 
     | 
    
         
            +
              Y8emglgF5mwOSbtiZmKYNeC1iWmUjLWhSAM5i1CedJliM84loqDvIM7JohPrPe0W
         
     | 
| 
      
 23 
     | 
    
         
            +
              iVI4roGY3cNJujprtu48mSz4bQ7K2YYNwPUC51lwu/HOfW88nyA73enk1GucaWCv
         
     | 
| 
      
 24 
     | 
    
         
            +
              wlpQ3/o5DAAdHxyU58Cn5+IccHJB29JpsqCy3ziNGDEoP5oXcu4/JZHjYWkCAwEA
         
     | 
| 
      
 25 
     | 
    
         
            +
              AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUSLKMrYPy
         
     | 
| 
      
 26 
     | 
    
         
            +
              3XTqc2K7Hr0Oh0oqmlgwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
         
     | 
| 
       27 
27 
     | 
    
         
             
              c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
         
     | 
| 
       28 
     | 
    
         
            -
               
     | 
| 
       29 
     | 
    
         
            -
               
     | 
| 
       30 
     | 
    
         
            -
               
     | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
       32 
     | 
    
         
            -
               
     | 
| 
       33 
     | 
    
         
            -
               
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
       35 
     | 
    
         
            -
               
     | 
| 
       36 
     | 
    
         
            -
               
     | 
| 
      
 28 
     | 
    
         
            +
              BgkqhkiG9w0BAQsFAAOCAYEAF94p0W/kawz6zAaPBAQYPK80pchIt5YmKgiHH/Ek
         
     | 
| 
      
 29 
     | 
    
         
            +
              Vn7iww/aiHorCuAAW/2YPls4goVrSIMvHuV16P0qK1j3ylyyGoKnOn3PbpRrjHZu
         
     | 
| 
      
 30 
     | 
    
         
            +
              3O9io3fqbVE2wo4kw8FKYEnv/vFFx53cIotYKhiyW5VKACM0AaolFtf2QBnLGuBN
         
     | 
| 
      
 31 
     | 
    
         
            +
              6ete9dSMYppBMlf6Ah/EV3PfV6UV/2Pt51fASwU4DBwSsA1aPlvG9KjOq0UQfDHD
         
     | 
| 
      
 32 
     | 
    
         
            +
              hiK5JelQEUxYRumvheEeAwKnIT8ir+Axt1ld93m7xwtNbDPu21fkGfJ6xFz8Ntme
         
     | 
| 
      
 33 
     | 
    
         
            +
              Aca1IyhjpPV4IbGYIxNwH0xfeSBgJvp+XBqdcb52k34kdaJa3gsPl+1B4YksolOP
         
     | 
| 
      
 34 
     | 
    
         
            +
              OD+mqzrShSSZRfL7bhBqXYELKZS5tayICrtujMxstwDGaDLwNVcN/CydQjAD6G+V
         
     | 
| 
      
 35 
     | 
    
         
            +
              2z9cm0kGX/0pBfn8cMKC0JgNNNONx3uqiCAhaBEN35C8dqBjua/CK4rMoKEB7XQq
         
     | 
| 
      
 36 
     | 
    
         
            +
              OAk+mR2SqyWecmZhdnsnm86T
         
     | 
| 
       37 
37 
     | 
    
         
             
              -----END CERTIFICATE-----
         
     | 
| 
       38 
     | 
    
         
            -
            date:  
     | 
| 
      
 38 
     | 
    
         
            +
            date: 2020-06-07 00:00:00.000000000 Z
         
     | 
| 
       39 
39 
     | 
    
         
             
            dependencies:
         
     | 
| 
       40 
40 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       41 
41 
     | 
    
         
             
              name: svgle
         
     | 
| 
         @@ -46,7 +46,7 @@ dependencies: 
     | 
|
| 
       46 
46 
     | 
    
         
             
                    version: '0.4'
         
     | 
| 
       47 
47 
     | 
    
         
             
                - - ">="
         
     | 
| 
       48 
48 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       49 
     | 
    
         
            -
                    version: 0.4. 
     | 
| 
      
 49 
     | 
    
         
            +
                    version: 0.4.6
         
     | 
| 
       50 
50 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       51 
51 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       52 
52 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -56,47 +56,67 @@ dependencies: 
     | 
|
| 
       56 
56 
     | 
    
         
             
                    version: '0.4'
         
     | 
| 
       57 
57 
     | 
    
         
             
                - - ">="
         
     | 
| 
       58 
58 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       59 
     | 
    
         
            -
                    version: 0.4. 
     | 
| 
      
 59 
     | 
    
         
            +
                    version: 0.4.6
         
     | 
| 
      
 60 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 61 
     | 
    
         
            +
              name: onedrb
         
     | 
| 
      
 62 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 63 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 64 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 65 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 66 
     | 
    
         
            +
                    version: 0.1.0
         
     | 
| 
      
 67 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 68 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 69 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
      
 70 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 71 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 72 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 73 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 74 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 75 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 76 
     | 
    
         
            +
                    version: 0.1.0
         
     | 
| 
      
 77 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 78 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 79 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
       60 
80 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       61 
81 
     | 
    
         
             
              name: ruby2d
         
     | 
| 
       62 
82 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       63 
83 
     | 
    
         
             
                requirements:
         
     | 
| 
       64 
84 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       65 
85 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       66 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 86 
     | 
    
         
            +
                    version: '0.9'
         
     | 
| 
       67 
87 
     | 
    
         
             
                - - ">="
         
     | 
| 
       68 
88 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       69 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 89 
     | 
    
         
            +
                    version: 0.9.4
         
     | 
| 
       70 
90 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       71 
91 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       72 
92 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       73 
93 
     | 
    
         
             
                requirements:
         
     | 
| 
       74 
94 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       75 
95 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       76 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0.9'
         
     | 
| 
       77 
97 
     | 
    
         
             
                - - ">="
         
     | 
| 
       78 
98 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       79 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 99 
     | 
    
         
            +
                    version: 0.9.4
         
     | 
| 
       80 
100 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       81 
101 
     | 
    
         
             
              name: dom_render
         
     | 
| 
       82 
102 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       83 
103 
     | 
    
         
             
                requirements:
         
     | 
| 
       84 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       85 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       86 
     | 
    
         
            -
                    version: '0.3'
         
     | 
| 
       87 
104 
     | 
    
         
             
                - - ">="
         
     | 
| 
       88 
105 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       89 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 106 
     | 
    
         
            +
                    version: 0.4.0
         
     | 
| 
      
 107 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 108 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 109 
     | 
    
         
            +
                    version: '0.4'
         
     | 
| 
       90 
110 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       91 
111 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       92 
112 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       93 
113 
     | 
    
         
             
                requirements:
         
     | 
| 
       94 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       95 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       96 
     | 
    
         
            -
                    version: '0.3'
         
     | 
| 
       97 
114 
     | 
    
         
             
                - - ">="
         
     | 
| 
       98 
115 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       99 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 116 
     | 
    
         
            +
                    version: 0.4.0
         
     | 
| 
      
 117 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 118 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 119 
     | 
    
         
            +
                    version: '0.4'
         
     | 
| 
       100 
120 
     | 
    
         
             
            description: 
         
     | 
| 
       101 
121 
     | 
    
         
             
            email: james@jamesrobertson.eu
         
     | 
| 
       102 
122 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -123,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       123 
143 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       124 
144 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       125 
145 
     | 
    
         
             
            requirements: []
         
     | 
| 
       126 
     | 
    
         
            -
            rubygems_version: 3.0. 
     | 
| 
      
 146 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       127 
147 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       128 
148 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       129 
149 
     | 
    
         
             
            summary: Experimental gem to render SVG within a Ruby2D application.
         
     | 
    
        metadata.gz.sig
    CHANGED
    
    | 
         Binary file 
     |