Class: Hokusai::HoverEvent

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

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

Constructor Details

This class inherits a constructor from Hokusai::MouseEvent

Instance Method Details

#bubbleObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'ui/src/hokusai/events/mouse.rb', line 141

def bubble
  while block = captures.pop
    block.emit(name, self)

    cursor = block.node.meta.get_prop(:cursor)&.to_sym

    if !state.set && cursor == :manual
      state.set = true
    end

    if !state.set && cursor && cursor != :manual
      Hokusai.set_mouse_cursor(cursor)
      state.set = true
    end

    break if stopped
  end

  if !state.nil? && !state.set
    Hokusai.set_mouse_cursor(:default)
  end
end

#capture(block, _) ⇒ Object



137
138
139
# File 'ui/src/hokusai/events/mouse.rb', line 137

def capture(block, _)
  captures << block
end