"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "app/assets/javascripts/discourse/mixins/pan-events.js.es6" between
discourse-2.2.0.tar.gz and discourse-2.2.1.tar.gz

About: Discourse is a "next-generation" forum platform for community discussions.

pan-events.js.es6  (discourse-2.2.0):pan-events.js.es6  (discourse-2.2.1)
skipping to change at line 15 skipping to change at line 15
export const SWIPE_VELOCITY = 40; export const SWIPE_VELOCITY = 40;
export const SWIPE_DISTANCE_THRESHOLD = 50; export const SWIPE_DISTANCE_THRESHOLD = 50;
export const SWIPE_VELOCITY_THRESHOLD = 0.1; export const SWIPE_VELOCITY_THRESHOLD = 0.1;
export default Ember.Mixin.create({ export default Ember.Mixin.create({
//velocity is pixels per ms //velocity is pixels per ms
_panState: null, _panState: null,
didInsertElement() { didInsertElement() {
this._super(...arguments); this._super(...arguments);
this.addTouchListeners(this.$());
if (this.site.mobileView) {
if ("onpointerdown" in document.documentElement) {
this.$()
.on("pointerdown", e => this._panStart(e))
.on("pointermove", e => this._panMove(e, e))
.on("pointerup", e => this._panMove(e, e))
.on("pointercancel", e => this._panMove(e, e));
} else if ("ontouchstart" in document.documentElement) {
this.$()
.on("touchstart", e => this._panStart(e.touches[0]))
.on("touchmove", e => {
const touchEvent = e.touches[0];
touchEvent.type = "pointermove";
this._panMove(touchEvent, e);
})
.on("touchend", e => this._panMove({ type: "pointerup" }, e))
.on("touchcancel", e => this._panMove({ type: "pointercancel" }, e));
}
}
}, },
willDestroyElement() { willDestroyElement() {
this._super(...arguments); this._super(...arguments);
this.removeTouchListeners(this.$());
},
addTouchListeners($element) {
if (this.site.mobileView) {
$element
.on("touchstart", e => this._panStart(e.touches[0]))
.on("touchmove", e => {
const touchEvent = e.touches[0];
touchEvent.type = "pointermove";
this._panMove(touchEvent, e);
})
.on("touchend", e => this._panMove({ type: "pointerup" }, e))
.on("touchcancel", e => this._panMove({ type: "pointercancel" }, e));
}
},
removeTouchListeners($element) {
if (this.site.mobileView) { if (this.site.mobileView) {
this.$() $element
.off("pointerdown")
.off("pointerup")
.off("pointermove")
.off("pointercancel")
.off("touchstart") .off("touchstart")
.off("touchmove") .off("touchmove")
.off("touchend") .off("touchend")
.off("touchcancel"); .off("touchcancel");
} }
}, },
_calculateDirection(oldState, deltaX, deltaY) { _calculateDirection(oldState, deltaX, deltaY) {
if (oldState.start || !oldState.direction) { if (oldState.start || !oldState.direction) {
if (Math.abs(deltaX) > Math.abs(deltaY)) { if (Math.abs(deltaX) > Math.abs(deltaY)) {
 End of changes. 4 change blocks. 
25 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)