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

Method HitTest

src/tracks/ui/TimeShiftHandle.cpp:89–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89UIHandlePtr TimeShiftHandle::HitTest
90(std::weak_ptr<TimeShiftHandle> &holder,
91 const wxMouseState &state, const wxRect &rect,
92 const std::shared_ptr<Track> &pTrack)
93{
94 /// method that tells us if the mouse event landed on a
95 /// time-slider that allows us to time shift the sequence.
96 /// (Those are the two "grips" drawn at left and right edges for multi tool mode.)
97
98 // Perhaps we should delegate this to TrackArtist as only TrackArtist
99 // knows what the real sizes are??
100
101 // The drag Handle width includes border, width and a little extra margin.
102 const int adjustedDragHandleWidth = 14;
103 // The hotspot for the cursor isn't at its centre. Adjust for this.
104 const int hotspotOffset = 5;
105
106 // We are doing an approximate test here - is the mouse in the right or left border?
107 if (!(state.m_x + hotspotOffset < rect.x + adjustedDragHandleWidth ||
108 state.m_x + hotspotOffset >= rect.x + rect.width - adjustedDragHandleWidth))
109 return {};
110
111 return HitAnywhere( holder, pTrack, true );
112}
113
114TimeShiftHandle::~TimeShiftHandle()
115{

Callers 1

ClickMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected