Module: Dieses::Application::Pen::Draw::Elements
- Included in:
- Dieses::Application::Pen::Draw
- Defined in:
- lib/dieses/application/pen.rb
Instance Method Summary collapse
- #cline(*tags, angle:, style: Undefined) ⇒ Object
- #hline(*tags, length: Undefined, style: Undefined) ⇒ Object
- #rect(*tags, width:, height:, style: Undefined) ⇒ Object
- #square(*tags, width:, style: Undefined) ⇒ Object
- #vline(*tags, length: Undefined, style: Undefined) ⇒ Object
Instance Method Details
#cline(*tags, angle:, style: Undefined) ⇒ Object
74 75 76 |
# File 'lib/dieses/application/pen.rb', line 74 def cline(*, angle:, style: Undefined) add perfect.intersect(Geometry::Equation.slant_from_direction(point: pos, angle: -angle)), , style end |
#hline(*tags, length: Undefined, style: Undefined) ⇒ Object
64 65 66 67 |
# File 'lib/dieses/application/pen.rb', line 64 def hline(*, length: Undefined, style: Undefined) length = Undefined.equal?(length) ? perfect.width : ruler.measure(length) add Geometry::Line.new(pos, pos.translate(x: length)), , style end |
#rect(*tags, width:, height:, style: Undefined) ⇒ Object
78 79 80 81 82 |
# File 'lib/dieses/application/pen.rb', line 78 def rect(*, width:, height:, style: Undefined) width, height = ruler.measure(width), ruler.measure(height) style = { fill: 'none' }.merge Undefined.default(style, EMPTY_HASH).to_h add Geometry::Rect.new(width, height, position: pos), , style end |
#square(*tags, width:, style: Undefined) ⇒ Object
84 85 86 |
# File 'lib/dieses/application/pen.rb', line 84 def square(*, width:, style: Undefined) rect(, width: width, height: width, style: style) end |
#vline(*tags, length: Undefined, style: Undefined) ⇒ Object
69 70 71 72 |
# File 'lib/dieses/application/pen.rb', line 69 def vline(*, length: Undefined, style: Undefined) length = Undefined.equal?(length) ? perfect.height : ruler.measure(length) add Geometry::Line.new(pos, pos.translate(y: length)), , style end |