-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Grid Support #168
Add Grid Support #168
Conversation
Thanks, I will take a look :) |
@@ -349,7 +383,12 @@ | |||
/** | |||
* The height of the list. This is referred as the viewport in the context of list. | |||
*/ | |||
_viewportSize: 0, | |||
_viewportHeight: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/sub +1 |
width: 100%; | ||
}; | ||
|
||
:host([grid]) #items > ::content > * { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace :host([grid]) #items > ::content > *
for #items > ::content > *
. Even for the !grid
case, setting margin in the item isn't allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha! I'll add that in.
@kevinpschaaf would you mind taking a look at this PR? |
In doing more testing I discovered that it also seems that adding and removing items from the list is not properly recomputing the height of the items list. Will investigate further. |
I have broken out my commits into a smaller series that you can look at (they can be squashed later). I fixed all broken tests and have fixed all issues (that I was aware of) related to resize and item addition/deletion/reassignment. I will go add some tests for this to cover all of the cases that I tested. Let me know what you think: @blasten @kevinpschaaf |
@jshcrowthe are you also on Polymer slack? |
Thanks! |
@blasten This has been updated to account for the merged PR's. |
This seems to have stagnated a little bit, is there anything I can do to help move this forward? |
Thanks I will take a look |
I have added in a unit test suite that is based off of |
@blasten: Any word on this? |
@jshcrowthe excited to see someone looking at the grid functionality! Took a look at how your update works, and saw one thing I wondered your thoughts on. When positioning horizontally there is a much higher chance of "requiring" sub-pixel positioning to be "correct" to the layout. However, when you translate3d at that level (i.e. translate3d(100.5px, 0px, 0px)) the element you are positioning acquires a marked blur on its contents. It's a little hard to notice in the demo you've posted, but if you manually edit the sub-pixel out of the transform by comparison it becomes apparent. Here I've done just that to the item on the left: What are your thoughts on using |
@Westbrook - I'd be fine with that. Probably would want to keep track of the delta in pixels to properly compute the height. But I'd support that. We could also just |
Great job @jshcrowthe. I updated the demo, but so far this is looking awesome! |
@blasten - Thanks for the nice demo, that rocks! @Westbrook - I retract my last comment we probably could just |
@jshcrowthe that makes sense. My local version hasn't had any issues with Speaking of which, is there a way for me to support the addition of that to this PR? |
@@ -187,7 +187,7 @@ | |||
<div class="photoContainer"> | |||
<div class="photoContent" tabindex$="[[tabIndex]]"> | |||
<iron-image sizing="cover" | |||
src="//farm[[photo.farm]].staticflickr.com/[[photo.server]]/[[photo.id]]_[[photo.secret]].jpg"> | |||
src="//farm[[photo.farm]].staticflickr.com/[[photo.server]]/[[photo.id]]_[[photo.secret]]_n.jpg"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Showed this demo to a friend (@spacerockzero) who pointed out we weren't using the Size Suffixes. Just adding this saved us 1.3mb
on initial render.
} else { | ||
this.translate3d(0, y + 'px', 0, this._physicalItems[pidx]); | ||
} | ||
|
||
if (this._shouldRenderNextRow(this.grid ? vidx : pidx)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jshcrowthe question: why were you using the vidx instead of pidx in grid mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question!
When iterating through the list from the beginning the value of pidx
accurately represents the row breaks in grid mode. However based on the size of the screen the row breaks (as computed by pidx
) can occur at the wrong points in the actual list itself. This can result in stacked items. By computing based on vidx
we ensure that we are always attempting to move to the next row at the proper "row breaks."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense. sweet!
thanks @jshcrowthe for your contribution! |
oh wow! yes! nice job @jshcrowthe ! :) |
Thanks for the merge! Hope this helps! |
PR per comments in #167
@blasten Here you go!