Skip to content
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

Added support for entry and exit animations #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"polymer": "Polymer/polymer#^1.0.0",
"iron-media-query": "PolymerElements/iron-media-query#^1.0.0",
"paper-dialog-behavior": "PolymerElements/paper-dialog-behavior#^1.0.0",
"paper-header-panel": "PolymerElements/paper-header-panel#^1.0.0"
"paper-header-panel": "PolymerElements/paper-header-panel#^1.0.0",
"neon-animation": "PolymerElements/neon-animation#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
Expand Down
40 changes: 36 additions & 4 deletions paper-fullscreen-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</paper-fullscreen-dialog>

@element paper-fullscreen-dialog
@blurb Element providing a full-screen dialog with dismissive and confirmation actions
@blurb Element providing a full-screen dialog with dismissive and confirmation actions
@status alpha
@homepage https://github.com/bendavis78/paper-fullscreen-dialog
@demo demo/index.html
Expand All @@ -68,6 +68,7 @@
<link rel="import" href="../paper-dialog-behavior/paper-dialog-behavior.html">
<link rel="import" href="../paper-header-panel/paper-header-panel.html">
<link rel="import" href="../paper-styles/paper-styles.html">
<link rel="import" href="../neon-animation/neon-animation-runner-behavior.html">

<dom-module id="paper-fullscreen-dialog">
<style>
Expand Down Expand Up @@ -143,7 +144,7 @@
<div id="backdrop"></div>
<div id="overlay">
<paper-header-panel main id="headerPanel" class="no-padding" mode="{{mode}}">
<content select=".toolbar"></content>
<content select=".toolbar"></content>
<div id="scroller" class="flex">
<content select="*"></content>
</div>
Expand All @@ -163,7 +164,7 @@

properties: {
/**
* When the browser window size is larger than the `responsiveWidth`,
* When the browser window size is larger than the `responsiveWidth`,
* the dialog becomes a modal dialog with a backdrop.
*
* @attribute responsiveWidth
Expand All @@ -190,7 +191,14 @@
},
},

behaviors: [Polymer.PaperDialogBehavior],
behaviors: [
Polymer.PaperDialogBehavior,
Polymer.NeonAnimationRunnerBehavior
],

listeners: {
'neon-animation-finish': '_onNeonAnimationFinish'
},

attached: function() {
this.sizingTarget = this.$.scroller;
Expand All @@ -208,6 +216,30 @@
this._setOpened(false);
},

_renderOpened: function() {
this.cancelAnimation();
if (this.withBackdrop) {
this.backdropElement.open();
}
this.playAnimation('entry');
},

_renderClosed: function() {
this.cancelAnimation();
if (this.withBackdrop) {
this.backdropElement.close();
}
this.playAnimation('exit');
},

_onNeonAnimationFinish: function() {
if (this.opened) {
this._finishRenderOpened();
} else {
this._finishRenderClosed();
}
},

_computeMediaQuery: function(responsiveWidth) {
var mq = '(max-width: ' + responsiveWidth + ')';
return mq;
Expand Down