Skip to content

Commit

Permalink
fix: Interactivity for sliders outside bounds (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
CatchABus authored Jul 30, 2024
1 parent 2efdb22 commit a2d51c5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/SliderBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,20 @@ export class SliderBase extends ProgressBar
protected createSlider(sliderData: Container | string): Container
{
const slider = getView(sliderData);

slider.eventMode = 'none';
const onPointerDown = (event: FederatedPointerEvent) =>
{
// This is needed to do proper calculations in update method calls
if (this.bg)
{
event.currentTarget = this.bg;
}
this.startUpdate(event);
};

slider.eventMode = 'static';
slider.on('pointerdown', onPointerDown)
.on('pointerup', this.endUpdate, this)
.on('pointerupoutside', this.endUpdate, this);
slider.x = slider.width / 2;

const container = new Container();
Expand Down

0 comments on commit a2d51c5

Please sign in to comment.