Added throwDaping instance variable to fix throw behavior

This commit is contained in:
Uwe Oestermeier 2019-05-14 09:57:28 +02:00
parent b07d76ce1d
commit 06e69d86b6

View File

@ -476,7 +476,7 @@ export class ColorRanges {
export default class Timeline extends BitmapLabeledGraphics {
constructor(width, height, { ticks = null,
baseLine = 0.5, showRange = true } = {}) {
baseLine = 0.5, showRange = true, throwDamping = 0.95 } = {}) {
super()
this.wantedWidth = width
this.wantedHeight = height
@ -507,6 +507,7 @@ export default class Timeline extends BitmapLabeledGraphics {
this.selection = null
this.autoScroll = false
this.direction = -1
this.throwDamping = throwDamping
this.timeticks = ticks || new TimeTicks(new DecadeTicks(),
new YearTicks(),
new MonthTicks(),
@ -884,7 +885,7 @@ export default class Timeline extends BitmapLabeledGraphics {
return
}
this.scroll += delta
delta *= 0.985
delta *= this.throwDamping
this.redraw()
if (Math.abs(delta) > 1 && this.autoScroll) {
setTimeout(() => this.keepInBounds(delta, anchor), 1000 / 100)