Class: Scarpe::WebviewLine
- Inherits:
-
WebviewWidget
- Object
- Shoes::Linkable
- WebviewWidget
- Scarpe::WebviewLine
- Defined in:
- lib/scarpe/wv/line.rb
Constant Summary
Constants included from Shoes::Log
Shoes::Log::DEFAULT_COMPONENT, Shoes::Log::DEFAULT_DEBUG_LOG_CONFIG, Shoes::Log::DEFAULT_LOG_CONFIG
Instance Attribute Summary
Attributes inherited from WebviewWidget
#children, #parent, #shoes_linkable_id
Attributes inherited from Shoes::Linkable
Instance Method Summary collapse
- #element ⇒ Object
-
#initialize(properties) ⇒ WebviewLine
constructor
A new instance of WebviewLine.
- #line_style ⇒ Object protected
- #style ⇒ Object protected
Methods inherited from WebviewWidget
#add_child, #bind, #destroy_self, display_class_for, #handler_js_code, #html_element, #html_id, #inspect, #needs_update!, #promise_update, #properties_changed, #remove_child, #rgb_to_hex, #set_parent, #to_html
Methods included from Shoes::Log
configure_logger, #log_init, logger
Methods inherited from Shoes::Linkable
#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_shoes_event
Constructor Details
#initialize(properties) ⇒ WebviewLine
Returns a new instance of WebviewLine.
5 6 7 |
# File 'lib/scarpe/wv/line.rb', line 5 def initialize(properties) super(properties) end |
Instance Method Details
#element ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/scarpe/wv/line.rb', line 9 def element HTML.render do |h| h.div(id: html_id, style: style) do h.svg(width: @x2, height: @y2) do h.line(x1: @left, y1: @top, x2: @x2, y2: @y2, style: line_style) end end end end |
#line_style ⇒ Object (protected)
28 29 30 31 32 33 |
# File 'lib/scarpe/wv/line.rb', line 28 def line_style { stroke: @draw_context["stroke"], "stroke-width": "4", } end |
#style ⇒ Object (protected)
21 22 23 24 25 26 |
# File 'lib/scarpe/wv/line.rb', line 21 def style super.merge({ left: "#{@left}px", top: "#{@top}px", }) end |