Timeline is now draggable
This commit is contained in:
parent
56910a8c58
commit
9aef7bb460
19
dist/iwmlib.pixi.js
vendored
19
dist/iwmlib.pixi.js
vendored
@ -3444,7 +3444,6 @@
|
|||||||
// stack!
|
// stack!
|
||||||
const distanceToTop = this.container.y;
|
const distanceToTop = this.container.y;
|
||||||
const distanceToBottom = this.opts.maxHeight - this.container.y - this.__initHeight;
|
const distanceToBottom = this.opts.maxHeight - this.container.y - this.__initHeight;
|
||||||
|
|
||||||
if (distanceToTop > 0) {
|
if (distanceToTop > 0) {
|
||||||
throwProps.y.end = 0;
|
throwProps.y.end = 0;
|
||||||
} else if (distanceToBottom > 0) {
|
} else if (distanceToBottom > 0) {
|
||||||
@ -12325,6 +12324,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* global ThrowPropsPlugin */
|
||||||
|
|
||||||
class Ticks {
|
class Ticks {
|
||||||
get reservedPrefixes() {
|
get reservedPrefixes() {
|
||||||
return ['decade', 'year', 'month', 'day', 'hour', 'minute', 'second']
|
return ['decade', 'year', 'month', 'day', 'hour', 'minute', 'second']
|
||||||
@ -12983,9 +12984,9 @@
|
|||||||
this.killTweens();
|
this.killTweens();
|
||||||
this.deltas = [];
|
this.deltas = [];
|
||||||
this.validScroll();
|
this.validScroll();
|
||||||
if (typeof ThrowPropsPlugin != 'undefined') {
|
// if (typeof ThrowPropsPlugin != 'undefined') {
|
||||||
ThrowPropsPlugin.track(this, 'delta');
|
// ThrowPropsPlugin.track(this, 'delta')
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
onMove(event, interaction) {
|
onMove(event, interaction) {
|
||||||
@ -13005,10 +13006,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onEnd(event, interaction) {
|
onEnd(event, interaction) {
|
||||||
if (typeof ThrowPropsPlugin != 'undefined') {
|
// if (typeof ThrowPropsPlugin != 'undefined') {
|
||||||
let vel = ThrowPropsPlugin.getVelocity(this, 'delta');
|
// let vel = ThrowPropsPlugin.getVelocity(this, 'delta')
|
||||||
ThrowPropsPlugin.untrack(this);
|
// ThrowPropsPlugin.untrack(this)
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.killTweens();
|
this.killTweens();
|
||||||
this.redraw();
|
this.redraw();
|
||||||
@ -13022,7 +13023,7 @@
|
|||||||
this.autoScroll = true;
|
this.autoScroll = true;
|
||||||
let anchor = interaction.current.mean();
|
let anchor = interaction.current.mean();
|
||||||
this.keepInBounds(delta, anchor);
|
this.keepInBounds(delta, anchor);
|
||||||
|
console.log("onEnd", delta);
|
||||||
for (let key of interaction.ended.keys()) {
|
for (let key of interaction.ended.keys()) {
|
||||||
if (interaction.isDoubleTap(key)) {
|
if (interaction.isDoubleTap(key)) {
|
||||||
this.onDoubleTap(event, interaction, key);
|
this.onDoubleTap(event, interaction, key);
|
||||||
|
@ -506,7 +506,6 @@ export default class ButtonGroup extends PIXI.Container {
|
|||||||
// stack!
|
// stack!
|
||||||
const distanceToTop = this.container.y
|
const distanceToTop = this.container.y
|
||||||
const distanceToBottom = this.opts.maxHeight - this.container.y - this.__initHeight
|
const distanceToBottom = this.opts.maxHeight - this.container.y - this.__initHeight
|
||||||
|
|
||||||
if (distanceToTop > 0) {
|
if (distanceToTop > 0) {
|
||||||
throwProps.y.end = 0
|
throwProps.y.end = 0
|
||||||
} else if (distanceToBottom > 0) {
|
} else if (distanceToBottom > 0) {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-unused-vars */
|
||||||
import Events from '../events.js'
|
import Events from '../events.js'
|
||||||
import { AbstractScatter } from '../scatter.js'
|
import { AbstractScatter } from '../scatter.js'
|
||||||
import { Angle, Points, Polygon } from '../utils.js'
|
import { Angle, Points, Polygon } from '../utils.js'
|
||||||
@ -333,8 +334,6 @@ export class DisplayObjectScatter extends AbstractScatter {
|
|||||||
roundPixel(value) {
|
roundPixel(value) {
|
||||||
// UO: Should be obsolete because Renderer supports roundPixels by default
|
// UO: Should be obsolete because Renderer supports roundPixels by default
|
||||||
return value
|
return value
|
||||||
let res = this.renderer.resolution
|
|
||||||
return Math.round(value * res) / res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get container() {
|
get container() {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-unused-vars */
|
||||||
import { Cycle, Colors, Dates, isEmpty } from '../utils.js'
|
import { Cycle, Colors, Dates, isEmpty } from '../utils.js'
|
||||||
import { Capabilities } from '../capabilities.js'
|
import { Capabilities } from '../capabilities.js'
|
||||||
import { BitmapLabeledGraphics, FontInfo } from './labeledgraphics.js'
|
import { BitmapLabeledGraphics, FontInfo } from './labeledgraphics.js'
|
||||||
@ -495,6 +496,7 @@ export default class Timeline extends BitmapLabeledGraphics {
|
|||||||
this.minZoom = 1
|
this.minZoom = 1
|
||||||
this.maxZoom = 12000
|
this.maxZoom = 12000
|
||||||
this.scroll = 0
|
this.scroll = 0
|
||||||
|
this.draggable = false
|
||||||
this.deltas = []
|
this.deltas = []
|
||||||
this.labelDates = []
|
this.labelDates = []
|
||||||
this.colorRanges = []
|
this.colorRanges = []
|
||||||
@ -761,9 +763,9 @@ export default class Timeline extends BitmapLabeledGraphics {
|
|||||||
this.killTweens()
|
this.killTweens()
|
||||||
this.deltas = []
|
this.deltas = []
|
||||||
this.validScroll()
|
this.validScroll()
|
||||||
if (typeof ThrowPropsPlugin != 'undefined') {
|
// if (typeof ThrowPropsPlugin != 'undefined') {
|
||||||
ThrowPropsPlugin.track(this, 'delta')
|
// ThrowPropsPlugin.track(this, 'delta')
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
onMove(event, interaction) {
|
onMove(event, interaction) {
|
||||||
@ -772,6 +774,9 @@ export default class Timeline extends BitmapLabeledGraphics {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.scroll += delta.x
|
this.scroll += delta.x
|
||||||
|
if (this.draggable) {
|
||||||
|
this.y += delta.y
|
||||||
|
}
|
||||||
while (this.deltas.length > 10) {
|
while (this.deltas.length > 10) {
|
||||||
this.deltas.pop(0)
|
this.deltas.pop(0)
|
||||||
}
|
}
|
||||||
@ -783,11 +788,10 @@ export default class Timeline extends BitmapLabeledGraphics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onEnd(event, interaction) {
|
onEnd(event, interaction) {
|
||||||
if (typeof ThrowPropsPlugin != 'undefined') {
|
// if (typeof ThrowPropsPlugin != 'undefined') {
|
||||||
let vel = ThrowPropsPlugin.getVelocity(this, 'delta')
|
// let vel = ThrowPropsPlugin.getVelocity(this, 'delta')
|
||||||
ThrowPropsPlugin.untrack(this)
|
// ThrowPropsPlugin.untrack(this)
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.killTweens()
|
this.killTweens()
|
||||||
this.redraw()
|
this.redraw()
|
||||||
let delta = 0
|
let delta = 0
|
||||||
@ -800,7 +804,6 @@ export default class Timeline extends BitmapLabeledGraphics {
|
|||||||
this.autoScroll = true
|
this.autoScroll = true
|
||||||
let anchor = interaction.current.mean()
|
let anchor = interaction.current.mean()
|
||||||
this.keepInBounds(delta, anchor)
|
this.keepInBounds(delta, anchor)
|
||||||
|
|
||||||
for (let key of interaction.ended.keys()) {
|
for (let key of interaction.ended.keys()) {
|
||||||
if (interaction.isDoubleTap(key)) {
|
if (interaction.isDoubleTap(key)) {
|
||||||
this.onDoubleTap(event, interaction, key)
|
this.onDoubleTap(event, interaction, key)
|
||||||
|
Loading…
Reference in New Issue
Block a user