Skip to content

Commit

Permalink
Improve recycler APIs used by dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Moore committed Sep 4, 2015
1 parent 8ce89db commit 7025be1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/mm-item-recycler/mm-item-recycler.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ found here: https://github.com/Polymer/core-list
value: "2d",
},
_gpuAssignedOnce: String,
xScroll: {
type: String,
value: "all",
reflectToAttribute: true,
},
scope: {
type: Object,
value: null,
Expand Down Expand Up @@ -677,10 +682,13 @@ found here: https://github.com/Polymer/core-list


getHeightAtIndex: function () {
var recycled = null;
if (this.itemHeight) {
return this._recycler.getHeightAtIndex.apply(this._recycler, arguments);
} else {
return null;
// especially relevant when measurements are available before mutation observer fires
recycled = Polymer.dom(this.$.middle).querySelector(".recycler-panel");
return recycled && recycled.offsetHeight || null;
}
},
});
Expand Down
8 changes: 7 additions & 1 deletion src/mm-item-recycler/mm-item-recycler.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@

:host {
display: block;
overflow: auto;
}

:host([x-scroll="none"]) #constrainer {
max-width: 100%;
}

#pane {
width: 100%;
height: 100%;
overflow: auto;
overflow-x: inherit;
overflow-y: inherit;
}

#constrainer {
Expand Down
4 changes: 1 addition & 3 deletions src/shared/behaviors/positionable-dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@

// if it's an item-recycler, we need to have NO horizontal scrolling
if (this.$.itemRecycler) {
this.$.itemRecycler.$.constrainer.style.width = panelWidth;
this.$.itemRecycler.$.pane.style.overflowY = "auto";
this.$.itemRecycler.$.pane.style.overflowX = "hidden";
this.$.itemRecycler.xScroll = "none";
}

panelRect.toCSS(this.panel,true);
Expand Down

0 comments on commit 7025be1

Please sign in to comment.