From 8c0c59c0e98f43448ec7fe407b9a992313adea8c Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 26 Apr 2018 12:35:11 +1000 Subject: [PATCH] Added Gesture Events dependency, fixed listener bugs. --- iron-swipeable-pages.html | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/iron-swipeable-pages.html b/iron-swipeable-pages.html index 62eabbf..cfa1ea1 100644 --- a/iron-swipeable-pages.html +++ b/iron-swipeable-pages.html @@ -1,4 +1,5 @@ - + + @@ -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; } @@ -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. */ @@ -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)); } /** @@ -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)); } /**