MCPcopy Create free account
hub / github.com/audacity/audacity / MoveDragPoint

Method MoveDragPoint

src/EnvelopeEditor.cpp:274–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274void EnvelopeEditor::MoveDragPoint(const wxMouseEvent & event, wxRect & r,
275 const ZoomInfo &zoomInfo, bool dB, double dBRange,
276 float zoomMin, float zoomMax)
277{
278 int clip_y = event.m_y - r.y;
279 if(clip_y < 0) clip_y = 0;
280 if(clip_y > r.height) clip_y = r.height;
281 double newVal = ValueOfPixel(clip_y, r.height, mUpper, dB, dBRange,
282 zoomMin, zoomMax);
283
284 // We no longer tolerate multiple envelope points at the same t.
285 // epsilon is less than the time offset of a single sample
286 // TODO: However because mTrackEpsilon assumes 200KHz this use
287 // of epsilon is a tad bogus. What we need to do instead is DELETE
288 // a duplicated point on a mouse up.
289 double newWhen = zoomInfo.PositionToTime(event.m_x, r.x) - mEnvelope.GetOffset();
290 mEnvelope.MoveDragPoint(newWhen, newVal);
291}
292
293bool EnvelopeEditor::HandleDragging(const wxMouseEvent & event, wxRect & r,
294 const ZoomInfo &zoomInfo, bool dB, double dBRange,

Callers

nothing calls this directly

Calls 3

ValueOfPixelFunction · 0.85
PositionToTimeMethod · 0.80
GetOffsetMethod · 0.45

Tested by

no test coverage detected