Skip to content

Commit

Permalink
Ensure compatability between TimelinePlugin and RegionsPlugin (#3363)
Browse files Browse the repository at this point in the history
* Remove pointer events from TimelinePlugin wrapper. Use canvases div as RegionsPlugin draggable target.

* Revert wrapper to private

* Revert addition of part attribute

---------

Co-authored-by: Alexander Diaz <dadiel@Alexanders-MacBook-Pro.local>
  • Loading branch information
alexgdiaz98 and Alexander Diaz authored Dec 2, 2023
1 parent 1a15a02 commit b95a111
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/regions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,8 @@ class RegionsPlugin extends BasePlugin<RegionsPluginEvents, RegionsPluginOptions
* Returns a function to disable the drag selection.
*/
public enableDragSelection(options: Omit<RegionParams, 'start' | 'end'>): () => void {
const wrapper = this.wavesurfer?.getWrapper()?.querySelector('div')
if (!wrapper) return () => undefined
const wrapper = this.wavesurfer?.getWrapper()?.querySelector('div.canvases')
if (!wrapper || !(wrapper instanceof HTMLElement)) return () => undefined

const initialSize = 5
let region: Region | null = null
Expand Down
1 change: 1 addition & 0 deletions src/plugins/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class TimelinePlugin extends BasePlugin<TimelinePluginEvents, TimelinePluginOpti
private initTimelineWrapper(): HTMLElement {
const div = document.createElement('div')
div.setAttribute('part', 'timeline')
div.setAttribute('style', 'pointer-events: none;')
return div
}

Expand Down

0 comments on commit b95a111

Please sign in to comment.