Error While Scrolling and Region Creation
See original GitHub issueIve been having an issue when zoomed in and trying to scroll by grabbing the scrollbar. Each time I try to scroll it creates a new region. I want it to only create a region when clicking in the canvas area, not when trying to scroll.
I have found within the region enableDragSelection there is an eventDown click event is firing for both clicking in the waveform area and clicking on the scrollbar. I then determined when clicking on the scrollbar the tag type is Wave and when clicking within the waveform area the tag type is Canvas.
So I created a method within enableDragSelection called isCanvas
`isCanvas: function (evt) {
if ( evt.target.tagName == 'CANVAS' ) {
return true;
}
return false;
}`
I then added in an if to check when its NOT the canvas just return out of the eventDown method
`if (!my.wavesurfer.Region.isCanvas(e)) { return; }`
Is there a better way to handle this oddity? Or is it a wanted feature?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Ok cool, I can check
e.target.childElementCount
and if it’s greater than zero, ignore theeventDown
. Will submit a PR shortly, after testing.Unfortunately this doesn’t solve the issue. When clicking ahead of the cursor, the event tagname is “CANVAS”, but when clicking behind the cursor, the tagname is “WAVE”. However, the two wave nodes (the actual waveform and the scrollbar) are slightly different. So I can use these differences to maybe pinpoint when the user clicks the scrollbar and prevent it from doing anything.