Skip to content

Commit

Permalink
Added Gesture Events dependency, fixed listener bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam committed Apr 26, 2018
1 parent 1d79c19 commit 8c0c59c
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions iron-swipeable-pages.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<link rel="import" href="../bower_components/polymer/polymer-element.html">
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../polymer/lib/mixins/gesture-event-listeners.html">

<link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html">
<link rel="import" href="../iron-selector/iron-selectable.html">
Expand All @@ -11,14 +12,14 @@
display: block;
overflow-x: hidden;
}
:host > ::slotted > * {
:host > ::slotted(*) {
position: absolute;
width: 100%;
height: 100%;
overflow-y: auto;
will-change: left, transform;
}
:host > ::slotted > :not(.iron-selected):not(.iron-swiping) {
:host > ::slotted(:not(.iron-selected):not(.iron-swiping)) {
left: -100% !important;
}
</style>
Expand All @@ -36,7 +37,7 @@
* @polymer
* @extends {Polymer.Element}
*/
class IronSwipeablePages extends Polymer.mixinBehaviors([Polymer.IronResizableBehavior, Polymer.IronSelectableBehavior], Polymer.Element) {
class IronSwipeablePages extends Polymer.GestureEventListeners(Polymer.mixinBehaviors([Polymer.IronResizableBehavior, Polymer.IronSelectableBehavior], Polymer.Element)) {
/**
* String providing the tag name to register the element under.
*/
Expand Down Expand Up @@ -186,11 +187,11 @@
connectedCallback() {
super.connectedCallback();

this.addEventListener('iron-resize', e => _onResize);
this.addEventListener('iron-items-changed', e => _onItemsChanged);
this.addEventListener('iron-deselect', e => _onIronDeselectItem);
this.addEventListener('iron-select', e => _onIronSelectItem);
this.addEventListener('track', e => _onTrack);
this.addEventListener('iron-resize', e => this._onResize(e));
this.addEventListener('iron-items-changed', e => this._onItemsChanged(e));
this.addEventListener('iron-deselect', e => this._onIronDeselectItem(e));
this.addEventListener('iron-select', e => this._onIronSelectItem(e));
Polymer.Gestures.addListener(this, 'track', e => this._onTrack(e));
}

/**
Expand All @@ -200,11 +201,11 @@
disconnectedCallback() {
super.disconnectedCallback();

this.removeEventListener('iron-resize', e => _onResize);
this.removeEventListener('iron-items-changed', e => _onItemsChanged);
this.removeEventListener('iron-deselect', e => _onIronDeselectItem);
this.removeEventListener('iron-select', e => _onIronSelectItem);
this.removeEventListener('track', e => _onTrack);
this.removeEventListener('iron-resize', e => this._onResize(e));
this.removeEventListener('iron-items-changed', e => this._onItemsChanged(e));
this.removeEventListener('iron-deselect', e => this._onIronDeselectItem(e));
this.removeEventListener('iron-select', e => this._onIronSelectItem(e));
this.removeEventListener('track', e => this._onTrack(e));
}

/**
Expand Down

0 comments on commit 8c0c59c

Please sign in to comment.