File: svg_rule.rb

package info (click to toggle)
ruby-rubyvis 0.6.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,808 kB
  • ctags: 679
  • sloc: ruby: 11,114; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Rubyvis
  module SvgScene
    def self.rule(scenes)
      #e=scenes._g.elements[1]
      e=scenes._g.get_element(1)
      scenes.each_with_index do |s,i|
        next unless s.visible
        stroke=s.stroke_style
        next if(stroke.opacity==0.0)
        e=SvgScene.expect(e,'line', {
          "shape-rendering"=> s.antialias ? nil : "crispEdges",
          "pointer-events"=> s.events,
          "cursor"=> s.cursor,
          "x1"=> s.left,
          "y1"=> s.top,
          'x2'=> s.left+s.width,
          'y2'=>s.top+s.height,
          "stroke"=> stroke.color,
          "stroke-opacity"=> stroke.opacity,
          "stroke-dasharray"=> s.stroke_dasharray,
          "stroke-width"=> s.line_width / self.scale
        })

        e=SvgScene.append(e,scenes,i)

      end
      e
    end
  end
end