Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segment Dragging will out of waveform. #547

Open
jason30704 opened this issue Sep 9, 2024 · 5 comments
Open

Segment Dragging will out of waveform. #547

jason30704 opened this issue Sep 9, 2024 · 5 comments

Comments

@jason30704
Copy link

Hello,
When enableSegmentDragging(true) is set, segment will not detect whether endTime is out of range.

1.mp4
@jason30704
Copy link
Author

I'm not sure if this is an issue or not.
I can achieve almost complete functionality by trying the method below.

image

However, overlay does not stop perfectly like startMarker and endMarker.

1.mp4

@chrisn
Copy link
Member

chrisn commented Sep 10, 2024

Yes, it's inconsistent. You can drag a segment so that it ends after the right edge of the waveform view, but dragging the segment marker is limited to the width of the waveform view.

@chrisn
Copy link
Member

chrisn commented Sep 10, 2024

The code in Peaks.js that handles this is a bit complex, and takes into account the pixel position of the markers, not just their time position.

We could make the behaviour consistent (e.g, by allowing markers to be dragged beyond the visible window). But is this really a problem in practice?

@jason30704
Copy link
Author

jason30704 commented Sep 11, 2024

Thanks for reply.
From a user's perspective, I think it's strange that a segment would exceed the scope of a wave.
In practice, there really isn’t much of a problem.

@chrisn
Copy link
Member

chrisn commented Sep 11, 2024

So, there are three separate changes we could make:

  1. Allow point and segment handles to be dragged beyond the limit of the waveform view.
  2. Limit point and segment dragging to within the waveform duration.
  3. Limit point and segment times to within the waveform duration when calling peaks.points.add(), peaks.segments.add(), peaks.points.update(), and peaks.segments.update().

I'm hesitant about 2 and 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants