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

Commit

Permalink
Add CoreResizable support.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Dec 3, 2014
1 parent 8150164 commit d41f5c0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"polymer": "Polymer/polymer#master",
"core-selector": "Polymer/core-selector#master",
"core-style": "Polymer/core-style#master",
"core-transition": "Polymer/core-transition#master"
"core-transition": "Polymer/core-transition#master",
"core-resizable": "Polymer/core-resizable#master"
}
}
25 changes: 23 additions & 2 deletions core-animated-pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link href="../core-selector/core-selector.html" rel="import">
<link href="../core-resizable/core-resizable.html" rel="import">

<link href="transitions/hero-transition.html" rel="import">
<link href="transitions/cross-fade.html" rel="import">
Expand Down Expand Up @@ -245,7 +246,7 @@

<script>

Polymer({
Polymer(Polymer.mixin({

eventDelegates: {
'core-transitionend': 'transitionEnd'
Expand Down Expand Up @@ -283,6 +284,14 @@
this.transitioning = [];
},

attached: function() {
this.resizerAttachedHandler();
},

detached: function() {
this.resizerDetachedHandler();
},

transitionsChanged: function() {
this._transitions = this.transitions.split(' ');
},
Expand Down Expand Up @@ -416,6 +425,7 @@
if (this.hasAttribute('no-transition') || !this._transitionElements || !this._transitionElements.length) {
this.applySelection(oldItem, false);
this.applySelection(this.selectedItem, true);
this.notifyResize();
return;
}

Expand All @@ -425,11 +435,22 @@
Polymer.flush();
Polymer.endOfMicrotask(function() {
self.applyTransition(oldItem, self.selectedItem);
self.notifyResize();
});
}
},

resizerShouldNotify: function(el) {
// Only notify descendents of selected item
while (el != this) {
if (el == this.selectedItem) {
return true;
}
el = el.parentElement;
}
}

});
}, Polymer.CoreResizer));

</script>

Expand Down

0 comments on commit d41f5c0

Please sign in to comment.