From a15c569cbab5d377be1e3caf14d670ca439ae35f Mon Sep 17 00:00:00 2001 From: Yotam Berkowitz Date: Fri, 31 Jan 2020 16:31:38 +0200 Subject: [PATCH 1/2] fix: pinch to zoom out in close pinch (#171) --- lib/timeline/Range.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/timeline/Range.js b/lib/timeline/Range.js index 704c68bd4e..e92dea2697 100644 --- a/lib/timeline/Range.js +++ b/lib/timeline/Range.js @@ -672,6 +672,7 @@ export default class Range extends Component { this.props.touch.end = this.end; this.props.touch.allowDragging = true; this.props.touch.center = null; + this.props.touch.centerDate = null; this.scaleOffset = 0; this.deltaDifference = 0; // Disable the browser default handling of this event. @@ -694,12 +695,12 @@ export default class Range extends Component { if (!this.props.touch.center) { this.props.touch.center = this.getPointer(event.center, this.body.dom.center); + this.props.touch.centerDate = this._pointerToDate(this.props.touch.center); } this.stopRolling(); - const scale = 1 / (event.scale + this.scaleOffset); - const centerDate = this._pointerToDate(this.props.touch.center); + const centerDate = this.props.touch.centerDate; const hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); const hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, centerDate); @@ -712,7 +713,7 @@ export default class Range extends Component { // snapping times away from hidden zones this.startToFront = 1 - scale <= 0; // used to do the right auto correction with periodic hidden times this.endToFront = scale - 1 <= 0; // used to do the right auto correction with periodic hidden times - + const safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true); const safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true); if (safeStart != newStart || safeEnd != newEnd) { @@ -722,7 +723,7 @@ export default class Range extends Component { newStart = safeStart; newEnd = safeEnd; } - + const options = { animation: false, byUser: true, From 78b446a516f4e3c0d8628f29cd22f98af4aa011d Mon Sep 17 00:00:00 2001 From: Yotam Berkowitz Date: Fri, 31 Jan 2020 16:34:42 +0200 Subject: [PATCH 2/2] Update Range.js --- lib/timeline/Range.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/timeline/Range.js b/lib/timeline/Range.js index e92dea2697..54e385509a 100644 --- a/lib/timeline/Range.js +++ b/lib/timeline/Range.js @@ -713,7 +713,7 @@ export default class Range extends Component { // snapping times away from hidden zones this.startToFront = 1 - scale <= 0; // used to do the right auto correction with periodic hidden times this.endToFront = scale - 1 <= 0; // used to do the right auto correction with periodic hidden times - + const safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true); const safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true); if (safeStart != newStart || safeEnd != newEnd) { @@ -723,7 +723,7 @@ export default class Range extends Component { newStart = safeStart; newEnd = safeEnd; } - + const options = { animation: false, byUser: true,