class Glimmer::SWT::Custom::Shape::Arc
Public Instance Methods
background=(value)
click to toggle source
Calls superclass method
Glimmer::SWT::Custom::Shape#background=
# File lib/glimmer/swt/custom/shape/arc.rb, line 43 def background=(value) super(value) self.foreground = value end
parameter_names()
click to toggle source
# File lib/glimmer/swt/custom/shape/arc.rb, line 33 def parameter_names [:x, :y, :width, :height, :start_angle, :arc_angle] end
post_add_content()
click to toggle source
# File lib/glimmer/swt/custom/shape/arc.rb, line 37 def post_add_content @performing_post_add_content = true render @performing_post_add_content = false end
render(custom_parent_dom_element: nil, brand_new: false)
click to toggle source
# File lib/glimmer/swt/custom/shape/arc.rb, line 48 def render(custom_parent_dom_element: nil, brand_new: false) return unless @performing_post_add_content the_parent_element = Native(`document.getElementById(#{parent.id})`) params = { type: `Two.Types.svg` } two = Native(`new Two(#{params})`) two.appendTo(the_parent_element) x = @args[0] y = @args[1] width = @args[2] height = @args[3] start_angle = -1*@args[4] arc_angle = -1*@args[5] end_angle = start_angle + arc_angle rx = width / 2.0 ry = height / 2.0 cx = x + rx cy = y + ry arc = two.makeArcSegment(cx, cy, 0, ry, 2*`Math.PI`*(start_angle)/360.0, 2*`Math.PI`*(end_angle)/360.0); arc.fill = background.to_css unless background.nil? arc.stroke = foreground.to_css unless foreground.nil? two.update end