Class: Crimson::RightResizer

Inherits:
Resizer show all
Defined in:
lib/crimson/widgets/right_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

#initializeRightResizer

Returns a new instance of RightResizer.



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

def initialize
  super('ew-resize')

  style.width = '5px'
  style.height = '100%'
  style.position = 'absolute'
  style.top = 0
  style.right = 0
end

Instance Method Details

#on_mousemove(data) ⇒ Object



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

def on_mousemove(data)
  parent.style.width = "#{data.clientX - parent.style.left.delete_suffix('px').to_i - data.movementX}px"
  parent.commit!
end