Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Implement vertical gridlist #62

Merged
merged 29 commits into from Aug 25, 2015
Merged

Conversation

NiGhTTraX
Copy link
Contributor

Vertical gridlist

In order to make the grid to support both vertical and horizontal directions we will modify its current implementation by adding new concepts #indexes and #lanes.

Insert the image

  • Modify rows prop to itemsPerLane, we no longer need a rows option
    If specified, itemsPerLane, will represent the #lanes
  • Pass a custom option direction to identify the direction of the grid.
    By default will be horizontal. direction can be horizontal (default) or vertical
  • Fix failing unit tests
  • Add the fixtures for vertical grid as presented below

Item per lane 2

Image
2_items_per_lane

Fixture

itemsPerLane2: [
  {w: 1, h: 1, x: 0, y: 0},
  {w: 1, h: 1, x: 1, y: 0},
  {w: 1, h: 2, x: 0, y: 1},
  {w: 1, h: 1, x: 1, y: 1},
  {w: 1, h: 2, x: 1, y: 2},
  {w: 1, h: 1, x: 0, y: 3},
  {w: 0, h: 1, x: 0, y: 4},
  {w: 1, h: 1, x: 0, y: 5},
  {w: 1, h: 1, x: 1, y: 5},
  {w: 2, h: 2, x: 0, y: 6},
  {w: 2, h: 1, x: 0, y: 8},
]

Resize flow from 2 lanes => 3 lanes and from 3 lanes => 4 lanes
image2

Item per lane 3

Image
3_items_per_lane

Fixture

itemsPerLane3: [
  {w: 1, h: 1, x: 0, y: 0},
  {w: 1, h: 1, x: 1, y: 0},
  {w: 1, h: 1, x: 2, y: 0},
  {w: 2, h: 1, x: 0, y: 1},
  {w: 1, h: 1, x: 2, y: 1},
  {w: 0, h: 1, x: 0, y: 2},
  {w: 1, h: 2, x: 0, y: 3},
  {w: 1, h: 1, x: 1, y: 3},
  {w: 1, h: 1, x: 2, y: 3},
  {w: 1, h: 1, x: 1, y: 4},
  {w: 1, h: 1, x: 2, y: 4},
  {w: 2, h: 1, x: 0, y: 5},
  {w: 1, h: 2, x: 2, y: 5},
  {w: 1, h: 1, x: 0, y: 6},
  {w: 1, h: 1, x: 1, y: 6},
  {w: 2, h: 2, x: 0, y: 7},
  {w: 1, h: 2, x: 2, y: 7}
]

Resize flow from 3 lanes => 2 lanes and from 3 lanes => 4 lanes

image3

Item per lane 4

Image
4_items_per_lane

Fixture

itemsPerLane4: [
  {w: 2, h: 1, x: 0, y: 0},
  {w: 1, h: 1, x: 2, y: 0},
  {w: 1, h: 2, x: 3, y: 0},
  {w: 2, h: 2, x: 0, y: 1},
  {w: 1, h: 2, x: 2, y: 1},
  {w: 1, h: 1, x: 3, y: 2},
  {w: 0, h: 1, x: 0, y: 3},
  {w: 2, h: 1, x: 0, y: 4},
  {w: 1, h: 1, x: 2, y: 4},
  {w: 1, h: 1, x: 3, y: 4},
  {w: 1, h: 2, x: 0, y: 5},
  {w: 1, h: 1, x: 1, y: 5},
  {w: 2, h: 1, x: 2, y: 5},
  {w: 2, h: 1, x: 1, y: 6},
  {w: 1, h: 1, x: 3, y: 6}
]

Resize flow from 4 lanes => 5 lanes and from 4 lanes => 3 lanes

image4


  • Test that items are correctly positioned withing the grid when direction = vertical
  • Write the code which will position the items for vertical direction, ensure that unit test passed.
  • Further Todos
    • tests
      • Write tests for collisions
      • Write tests for item resize
      • Write tests for grid changes
      • Write tests for horizontal "timelines"
    • implementation
      • adapt _tryToResolveCollisionsLocally and _pullItemsToLeft for vertical grid
      • refactor _adjustHeightOfItems to both directions

#lanes are rows or columns based on the direction. Lanes represent the fixed dimension of the grid.

#indexes = represent the variable dimension of the grid.

grid[index][lane]

@andrei-picus-hs andrei-picus-hs self-assigned this Aug 5, 2015
@andrei-picus-hs
Copy link
Contributor

@skidding care to take a look?

@@ -212,10 +216,7 @@ divided by the number of grid rows.

- Their README reads Ducksboard is no longer active in their development. There
are a few notable forks but it's hard to assert their [reliability.](https://github.com/dustmoo/gridster.js/issues)
- gridster works vertically and our design is horizontal. We instigated a

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still worth noting that GridList (now) supports both vertical and horizontal, while Gridster just vertical. Unless it now supports both axis.

@ovidiu-chereches-hs
Copy link

LGTM

@@ -12,8 +12,6 @@ body {
left: 0;
right: 10px;
bottom: 0;
overflow-x: auto;
overflow-y: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • You can add auto for both x and y

@catalinmiron
Copy link
Contributor Author

@NiGhTTraX I found a collision bug or is this the desired behaviour ?
grid_collisions_bug

L.E: I'm using fixtures.verticalGridDemo

@ovidiuch
Copy link
Contributor

👍

@andrei-picus-hs
Copy link
Contributor

@catalinmiron fixed.

@catalinmiron
Copy link
Contributor Author

@andrei-picus-hs 🌟 LGTM
grid_collisions_are_working

andrei-picus-hs added a commit that referenced this pull request Aug 25, 2015
@andrei-picus-hs andrei-picus-hs merged commit 6575da0 into master Aug 25, 2015
@andrei-picus-hs andrei-picus-hs deleted the 62-implement-vertical-gridlist branch August 25, 2015 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants