Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_handleTrackStart = ({ x, y }) => {
this.dragging = true;
if (this.timer !== null) {
clearTimeout(this.timer);
}
this.startTranslate = this._getOffset(this.circular ? this.current + 1 : this.current);
this.startTime = new Date().getTime();
this.transitionDuration = 0;
Gestures.addListener(document.documentElement, 'track', this._handleGlobalTrack);
// Avoid to disable document scroll
Gestures.setTouchAction(document.documentElement, null);
};
afterNextRender(this, () => {
Gestures.addListener(this, 'down', this._handleHoverStart);
Gestures.addListener(this, 'up', this._handleHoverEnd);
this.addEventListener('touchmove', this._handleTouchmove);
});
}
connectedCallback() {
super.connectedCallback();
this._childrenObserver = new FlattenedNodesObserver(this, this._handleChildrenChanged);
this._render();
Gestures.addListener(this, 'track', this._handleTrack);
Gestures.setTouchAction(this, 'auto');
}
private attachTrackHandlers() {
this.detachTrackHandlers();
const bar = this.trackBar!;
addListener(bar, 'up', this.upHandler);
addListener(bar, 'down', this.downHandler);
addListener(bar, 'track', this.trackHandler);
this.addEventListener('keydown', this.keyHandler);
}
disconnectedCallback() {
Gestures.addListener(this, 'down', this._handleHoverStart);
Gestures.addListener(this, 'up', this._handleHoverEnd);
this.removeEventListener('touchmove', this._handleTouchmove);
}
connectedCallback() {
super.connectedCallback();
window.addEventListener('_formReset', this._handleReset, true);
Gestures.addListener(this.$.body, 'track', this._handleTrack);
this.$.slot.addEventListener('click', this.show);
this.$.mask.addEventListener('click', this.hide);
this.$.cancel.addEventListener('click', this.hide);
this.$.confirm.addEventListener('click', this.confirm);
}
connectedCallback() {
super.connectedCallback();
Gestures.addListener(this.$.handle, 'track', this._handleTrack);
window.addEventListener('_formReset', this.handleReset, true);
}
private attachTrackHandlers() {
this.detachTrackHandlers();
const bar = this.trackBar!;
addListener(bar, 'up', this.upHandler);
addListener(bar, 'down', this.downHandler);
addListener(bar, 'track', this.trackHandler);
this.addEventListener('keydown', this.keyHandler);
}
private attachTrackHandlers() {
this.detachTrackHandlers();
const bar = this.trackBar!;
addListener(bar, 'up', this.upHandler);
addListener(bar, 'down', this.downHandler);
addListener(bar, 'track', this.trackHandler);
this.addEventListener('keydown', this.keyHandler);
}