Module: Situated::PositionAndSize

Included in:
Element, Viewport
Defined in:
lib/source/redshift/situated.rb

Instance Method Summary collapse

Instance Method Details

#height ⇒ Object

call-seq:

situated.height -> integer

returns the height of the situated in pixels as an integer. height is the amount of vertical space the content requires plus top padding, bottom padding, top border, and bottom border, if any

For example, situated = Document where situated is an element whose content is 200px tall with a top padding of 20px, bottom padding of 10px and a top border of 1px

situated.height #=> 231 (200 + 20 + 10 + 1)



27
28
29
# File 'lib/source/redshift/situated.rb', line 27

def height
  self.size[:y]
end

#left ⇒ Object



69
70
71
# File 'lib/source/redshift/situated.rb', line 69

def left
  self.position[:y]
end

#scroll_height ⇒ Object



57
58
59
# File 'lib/source/redshift/situated.rb', line 57

def scroll_height
  self.scroll_size[:y]
end

#scroll_left ⇒ Object



53
54
55
# File 'lib/source/redshift/situated.rb', line 53

def scroll_left
  self.scroll[:x]
end

#scroll_top ⇒ Object



49
50
51
# File 'lib/source/redshift/situated.rb', line 49

def scroll_top
  self.scroll[:y]
end

#scroll_width ⇒ Object



61
62
63
# File 'lib/source/redshift/situated.rb', line 61

def scroll_width
  self.scroll_size[:x]
end

#top ⇒ Object



65
66
67
# File 'lib/source/redshift/situated.rb', line 65

def top
  self.position[:x]
end

#width ⇒ Object

call-seq:

situated.width -> integer

returns the width of the situated in pixels as an integer width is the amount of horizontal space the content requires plus left padding, right padding, left border, and right border, if any

For example, situated = Document where situated is an element whose content is 200px wide with a left padding of 20px, right padding of 10px and a left border of 1px

situated.width #=> 231 (200 + 20 + 10 + 1)



45
46
47
# File 'lib/source/redshift/situated.rb', line 45

def width
  self.size[:x]
end