Class: Hokusai::Blocks::Hblock

Inherits:
Hokusai::Block show all
Defined in:
ui/src/hokusai/blocks/hblock.rb

Instance Attribute Summary

Attributes inherited from Hokusai::Block

#node, #provides, #publisher

Instance Method Summary collapse

Methods inherited from Hokusai::Block

#children, #children?, compile, computed, computed!, #draw, #draw_with, #dump, #emit, #initialize, inject, inject!, #method_missing, mount, #on_resize, provide, provides, style, styles_get, template, template_from_file, template_get, #update, use, uses

Constructor Details

This class inherits a constructor from Hokusai::Block

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hokusai::Block

Instance Method Details

#render(canvas) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'ui/src/hokusai/blocks/hblock.rb', line 14

def render(canvas)
  canvas.vertical = false
  canvas.reverse = reverse

  if background.nil? && outline.nil?
    yield canvas
  else
    draw do
      rect(canvas.x, canvas.y, canvas.width, canvas.height) do |command|
        command.color = background if background
        command.outline = outline if outline
        command.outline_color = outline_color if outline_color
        command.round = rounding.to_f if rounding
        command.padding = padding
        canvas = command.trim_canvas(canvas)
      end
    end

    yield canvas
  end
end