class Crimson::Desktop
Public Class Methods
new()
click to toggle source
Calls superclass method
Crimson::Object::new
# File lib/crimson/widgets/desktop.rb, line 8 def initialize super(:div) self.style = { "height": '100vh', "width": '100vw', "max-height": '100vh', "max-width": '100vw', "overflow": 'hidden', "position": 'fixed', "left": "0px", "top": "0px" } self.ondragover = 'event.preventDefault();' self.ondrop = 'event.preventDefault();' on('drop', method(:on_drop)) end
Public Instance Methods
create_window(*args)
click to toggle source
# File lib/crimson/widgets/desktop.rb, line 38 def create_window(*args) window = Crimson::Window.new(*args) add(window) window end
on_drop(data)
click to toggle source
# File lib/crimson/widgets/desktop.rb, line 28 def on_drop(data) window = find_descendant(data.target.to_sym).parent unless window.nil? window.style.left = "#{data.clientX + window.offset.left}px" window.style.top = "#{data.clientY + window.offset.top}px" window.commit! end end