Skip to content
This repository has been archived by the owner on Aug 2, 2018. It is now read-only.

Support right-to-left and other orientations #38

Closed
tomalec opened this issue Jul 16, 2015 · 7 comments
Closed

Support right-to-left and other orientations #38

tomalec opened this issue Jul 16, 2015 · 7 comments

Comments

@tomalec
Copy link
Member

tomalec commented Jul 16, 2015

Currently we do support following directions of packing

  • "rightDown" - find place on right, if none go down /
    horizontal layers left-to-right
  • "downRight" - find place bellow, if none go right /
    horizontal layers left-to-right

It would be nice to support at least left-to-right direction: for RTL languages, though layouts, for compatibility with bootstrap/flexbox/flexgrid demos (Juicy/juicy-tile-grid#13) ;)
Bottom up seems awkward, but why don't we support it as well.

@tomalec
Copy link
Member Author

tomalec commented Jul 16, 2015

After brief investigation it seems, that even if we could add new sorters might be cool, and gives opportunity to provide very weird orders. It only chooses slot to pack, and then place a rectangle in same x,y as slot, so conceptually in top left corner.

Then I think it makes no point of changing packing algorithm, as from it's point of view positions, angle, direction, and interpretation of X & Y axes does not matter, and we should not mess the code and increase performance costs.

The think we would like to achieve is completely visual issue, so we can rotate, mirror, flip the axes as we would like.

Therefore I would

  • 1. leave current "downRight" and "rightDown" sorters separated in Packer as they are, as choosing between them is cheap, however I would rename them to
    1. "horizontal", "vertical",
    2. "xTy", "yTx", or
    3. "x_then_y","y_then_x" (Package, and Rectangle uses only abstract x,y
  • 2. implement additional property:
    1. flag "leftToRight": true,
    2. string property "horizontalDirection": "RTL"||"LTR"
  • 3. implement additional property:
    1. flag "bottomUp": true,
    2. string property "verticalDirection": "BU"||"UTB"

WDYT @miyconst? Any opinion on name to choose?

@tomalec
Copy link
Member Author

tomalec commented Jul 16, 2015

I've added experimental support for .leftToRight and .bottomUp to the gh-pages branch

tomalec added a commit to Juicy/juicy-tile-grid that referenced this issue Jul 16, 2015
@miyconst
Copy link

I like the first variant of all points.

  1. "direction": String ("horizontal", "vertical").
  2. "leftToRight": Boolean.
  3. "bottomToTop": Boolean.

@tomalec
Copy link
Member Author

tomalec commented Jul 17, 2015

With "horizontal", "vertical" the question is which is which ;),

I would say, that current default is "horizontal" as it lays horizontal layers, and grow in horizontal direction first.

@miyconst
Copy link

Agree.

miyconst pushed a commit to Juicy/juicy-tile-editor that referenced this issue Jul 18, 2015
Update demo page, fix direction value.
Juicy/juicy-tile-list#38
tomalec added a commit to Juicy/juicy-tile-grid that referenced this issue Jul 20, 2015
tomalec added a commit to Juicy/juicy-tile-grid that referenced this issue Jul 20, 2015
miyconst pushed a commit to Juicy/juicy-tile-editor that referenced this issue Jul 20, 2015
@miyconst
Copy link

A bug found:

This is how page looks with "rightToLeft": false:
left-to-right

And this is how the same page and setup looks with "rightToLeft": true:
right-to-left

@tomalec
Copy link
Member Author

tomalec commented Jul 21, 2015

It seems to be a bug in juicy-tile-grid only, so I created an issue there Juicy/juicy-tile-grid#14

@tomalec tomalec closed this as completed Jul 21, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants