comparison view/Pane.cpp @ 966:e297b7d752f2

Prevent selection being dragged beyond start/end of content
author Chris Cannam
date Thu, 21 May 2015 14:06:20 +0100
parents 3fb91da7d98d
children faa8532e4f02
comparison
equal deleted inserted replaced
965:73b0dc7d6ec1 966:e297b7d752f2
386 386
387 bool 387 bool
388 Pane::selectionIsBeingEdited() const 388 Pane::selectionIsBeingEdited() const
389 { 389 {
390 if (!m_editingSelection.isEmpty()) { 390 if (!m_editingSelection.isEmpty()) {
391 if (m_mousePos != m_clickPos && 391 if (m_mousePos != m_clickPos &&
392 getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) { 392 getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) {
393 return true; 393 return true;
394 } 394 }
395 } 395 }
396 return false; 396 return false;
397 } 397 }
398 398
399 void 399 void
2109 } else { 2109 } else {
2110 min = snapFrameLeft; 2110 min = snapFrameLeft;
2111 max = snapFrameRight; 2111 max = snapFrameRight;
2112 } 2112 }
2113 2113
2114 sv_frame_t end = getModelsEndFrame();
2115 if (min > end) min = end;
2116 if (max > end) max = end;
2117
2114 if (m_manager) { 2118 if (m_manager) {
2115 m_manager->setInProgressSelection(Selection(alignToReference(min), 2119
2116 alignToReference(max)), 2120 Selection sel(alignToReference(min), alignToReference(max));
2117 !m_resizing && !m_ctrlPressed); 2121
2118 } 2122 bool exc;
2119 2123 bool same = (m_manager->haveInProgressSelection() &&
2120 edgeScrollMaybe(e->x()); 2124 m_manager->getInProgressSelection(exc) == sel);
2125
2126 m_manager->setInProgressSelection(sel, !m_resizing && !m_ctrlPressed);
2127
2128 if (!same) {
2129 edgeScrollMaybe(e->x());
2130 }
2131 }
2121 2132
2122 update(); 2133 update();
2123 2134
2124 if (min != max) { 2135 if (min != max) {
2125 m_playbackFrameMoveScheduled = false; 2136 m_playbackFrameMoveScheduled = false;