Skip to content

Commit

Permalink
Fix: Region update event (#3496)
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-byassee authored Jan 17, 2024
1 parent 104af0e commit 7a9d9b2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/plugins/regions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type RegionEvents = {
/** Before the region is removed */
remove: []
/** When the region's parameters are being updated */
update: []
update: [side?: 'start' | 'end']
/** When dragging or resizing is finished */
'update-end': []
/** On play */
Expand Down Expand Up @@ -270,7 +270,7 @@ class SingleRegion extends EventEmitter<RegionEvents> {
this.end = newEnd

this.renderPosition()
this.emit('update')
this.emit('update', side)
}
}

Expand Down Expand Up @@ -502,8 +502,11 @@ class RegionsPlugin extends BasePlugin<RegionsPluginEvents, RegionsPluginOptions
this.regions.push(region)

const regionSubscriptions = [
region.on('update', () => {
this.adjustScroll(region)
region.on('update', (side) => {
// Undefined side indicates that we are dragging not resizing
if (!side) {
this.adjustScroll(region)
}
}),

region.on('update-end', () => {
Expand Down

0 comments on commit 7a9d9b2

Please sign in to comment.