Class: Crimson::BottomResizer

Inherits:
Resizer show all
Defined in:
lib/crimson/widgets/bottom_resizer.rb

Instance Attribute Summary

Attributes inherited from Resizer

#cursor

Attributes inherited from Object

#added_children, #event_handlers, #id, #node, #removed_children, #tag

Attributes inherited from Model

#local, #observers, #revision_number, #revisions

Instance Method Summary collapse

Methods inherited from Resizer

#disable, #enable, #on_mousedown, #on_mouseup

Methods inherited from Object

#==, #add, #breadth_each, #children, #commit_tree!, #eql?, #find_descendant, #hash, #hidden?, #hide, #inspect, #move, #on, #on_event, #parent, #parent=, #postordered_each, #preordered_each, #remove, #root, #show, #shown?, #siblings, #to_s, #un

Methods inherited from Model

#add_observer, #apply_changes!, #changed?, #changes, #commit!, #master, #modify, #new_changes, #notify_observers, #reload!, #remove_observer, #rollback!

Constructor Details

#initializeBottomResizer

Returns a new instance of BottomResizer.



7
8
9
10
11
12
13
14
15
# File 'lib/crimson/widgets/bottom_resizer.rb', line 7

def initialize
  super('ns-resize')

  style.width = '100%'
  style.height = '5px'
  style.position = 'absolute'
  style.bottom = 0
  style.left = 0
end

Instance Method Details

#on_mousemove(data) ⇒ Object



17
18
19
20
# File 'lib/crimson/widgets/bottom_resizer.rb', line 17

def on_mousemove(data)
    parent.style.height = "#{data.clientY - parent.style.top.delete_suffix('px').to_i - data.movementY}px"
    parent.commit!
end