Closed vivekd95 closed 1 year ago
Hi @NinjaCoderDotCom, thanks for asking this question.
A segments.dragstart
event is emitted when you start dragging a segment (either the whole segment, if you have "enable segment dragging" ticked, or the start or end of a segment). A segments.dragend
event is emitted when you stop dragging.
Between the segments.dragstart
and segments.dragend
events, you will get segments.dragged
event with each mouse movement.
These events are emitted for the segment you are dragging (the segment
value in the event).
v3.0.0-beta.9 changes the behaviour when you have "compress" mode active. Now, when you drag a segment such that it moves an adjacent segment, you will get a segments.dragged
event for both segments (the one you are dragging, and the adjacent segment).
I hope this makes sense. What problem are you having in your code?
Hi @chrisn Thank you for helping me out regarding the both of events. I think through this explanation now most of my doubts and problems will be solved.
Hi @chrisn I have one more doubt that how can I identify whether whole segment is being dragged or just start/end is being changed?
The events currently don't give you that information, the events are the same when dragging the whole segment, and when just dragging the start or end. The startMarker
flag in the event is always false
when dragging the whole segment.
@chrisn The startMarker flag is also false if you drag and drop the endtime of segment. I need something from which I can know that if I am dragging the whole segment or just resizing it by changing the starting and ending time.
We can add an option to the events to indicate that, e.g.,
this._peaks.emit('segments.dragged', {
segment: this._segment,
startMarker: false,
marker: true,
evt: event.evt
});
where marker
is true
when resizing (i.e., either the start marker or end marker is being dragged) and false
when dragging the whole segment.
Yeah, that will be very good to identify between both events. When can we except the release of new version along with this change?
Yes, v3.0.0-beta.10 is now available in npm.
Is it OK it close this issue?
Hi, I am trying to check when does your dragend and dragstart event fires. So, the dragend event is also fired when I drag the starting of segment, co-incide it with the previous segment and release it. Same is happening if I drag the ending of the segment, matching it with the next segment and releasing it. According to me, these events should not fire together like this. Also, when you drag and drop the segment then sometimes dragstart is getting fired sometime dragend. In this case, either both of them should get fired or neither of them should.
Screenshot 1: Zoomview with settings![ss1](https://user-images.githubusercontent.com/107407402/236740709-69e29ca7-84cb-497e-aefa-c4824786b147.png)
Screenshot 2: Dragging a segment's start and co-inciding it with the previous segment's end![ss2](https://user-images.githubusercontent.com/107407402/236741193-6fde83ba-b02e-4ff5-adac-a90b0a3d2470.png)
Screenshot 3: Screenshot of console showing both events getting fired (along the screenshot of code sample).
![ss3](https://user-images.githubusercontent.com/107407402/236741212-f0736e8c-4ffd-4619-ba44-6b383a551bff.png)
Do correct me if I am mistaken. P.S- Tested it on v3.0.0-beta.8