Class: Hokusai::ClickEvent

Inherits:
MouseEvent show all
Defined in:
ui/src/hokusai/events/mouse.rb

Instance Attribute Summary

Attributes inherited from MouseEvent

#input, #state

Attributes inherited from Event

#bubbles, #captures, #stopped

Instance Method Summary collapse

Methods inherited from MouseEvent

#delta, #initialize, #left, #middle, #mouse, #pos, #right, #scroll, #scroll_delta, #to_json

Methods inherited from Event

#bubble, #matches, name, #name, #stop, #to_json

Constructor Details

This class inherits a constructor from Hokusai::MouseEvent

Instance Method Details

#capture(block, canvas) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
# File 'ui/src/hokusai/events/mouse.rb', line 87

def capture(block, canvas)
  if left[:clicked] && clicked(canvas)
    block.node.meta.focus

    if matches(block)
      captures << block
    end
  elsif left[:clicked]
    block.node.meta.blur
  end
end

#clicked(canvas) ⇒ Object



99
100
101
# File 'ui/src/hokusai/events/mouse.rb', line 99

def clicked(canvas)
  LibHokusai.hoku_input_is_clicked(input.raw, canvas.to_hoku_rect)
end