Class: Hokusai::Blocks::Dynamic
Instance Attribute Summary
#node, #provides, #publisher
Instance Method Summary
collapse
#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
#before_updated ⇒ Object
9
10
11
12
13
|
# File 'ui/src/hokusai/blocks/dynamic.rb', line 9
def before_updated
width, height = compute_size
emit("size_updated", width, height)
end
|
#compute_size ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'ui/src/hokusai/blocks/dynamic.rb', line 19
def compute_size
h = 0.0
w = 0.0
children.each do |block|
h += block.node.meta.get_prop?(:height)&.to_f || 0.0
w += block.node.meta.get_prop?(:width)&.to_f || 0.0
end
[w, h]
end
|
#on_mounted ⇒ Object
15
16
17
|
# File 'ui/src/hokusai/blocks/dynamic.rb', line 15
def on_mounted
compute_size
end
|
#render(canvas) {|canvas| ... } ⇒ Object
31
32
33
34
35
36
|
# File 'ui/src/hokusai/blocks/dynamic.rb', line 31
def render(canvas)
canvas.vertical = true
canvas.reverse = (reverse == true || reverse == "true")
yield canvas
end
|