Class: Archimate::Svg::Extents

Inherits:
Struct
  • Object
show all
Defined in:
lib/archimate/svg/extents.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#max_xObject

Returns the value of attribute max_x

Returns:

  • (Object)

    the current value of max_x



5
6
7
# File 'lib/archimate/svg/extents.rb', line 5

def max_x
  @max_x
end

#max_yObject

Returns the value of attribute max_y

Returns:

  • (Object)

    the current value of max_y



5
6
7
# File 'lib/archimate/svg/extents.rb', line 5

def max_y
  @max_y
end

#min_xObject

Returns the value of attribute min_x

Returns:

  • (Object)

    the current value of min_x



5
6
7
# File 'lib/archimate/svg/extents.rb', line 5

def min_x
  @min_x
end

#min_yObject

Returns the value of attribute min_y

Returns:

  • (Object)

    the current value of min_y



5
6
7
# File 'lib/archimate/svg/extents.rb', line 5

def min_y
  @min_y
end

Instance Method Details

#expand(byval) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/archimate/svg/extents.rb', line 6

def expand(byval)
  self.min_x ||= 0
  self.max_x ||= 0
  self.min_y ||= 0
  self.max_y ||= 0
  self.min_x -= byval
  self.max_x += byval
  self.min_y -= byval
  self.max_y += byval
  self
end

#heightObject



22
23
24
# File 'lib/archimate/svg/extents.rb', line 22

def height
  max_y - min_y
end

#widthObject



18
19
20
# File 'lib/archimate/svg/extents.rb', line 18

def width
  max_x - min_x
end