Module: TagLayout::InColumnsThenRows

Defined in:
app/models/tag_layout/in_columns_then_rows.rb

Overview

Lays out the tags so that they are column then row ordered.

Class Method Summary collapse

Class Method Details

.directionObject



5
6
7
# File 'app/models/tag_layout/in_columns_then_rows.rb', line 5

def self.direction
  'column then row'
end

.tag2_index(row, column, scale, _height, _width) ⇒ Object

Returns the tag index for the secondary tag e.g. 4 tags in group, A1 = 1, B1 = 3, A2 = 2, B2 = 4



25
26
27
# File 'app/models/tag_layout/in_columns_then_rows.rb', line 25

def self.tag2_index(row, column, scale, _height, _width)
  (column % scale) + ((row % scale) * scale)
end

.tag_index(row, column, scale, height, _width) ⇒ Object

Returns the tag index for the primary tag That is the one laid out in columns with four copies of each



17
18
19
20
21
# File 'app/models/tag_layout/in_columns_then_rows.rb', line 17

def self.tag_index(row, column, scale, height, _width)
  tag_col = (column / scale)
  tag_row = (row / scale)
  tag_row + (height / scale * tag_col)
end

.well_order_scopeObject

We don’t rely on well sorting, so lets not worry about it.



11
12
13
# File 'app/models/tag_layout/in_columns_then_rows.rb', line 11

def self.well_order_scope
  :all
end