PR #1954 improvements.
Inverted the direction of move-by-wheel, so that scrolling down will move you forward through the photos or documents overview. Added an accumulation of the scroll amount so that you don't zoom or skip photos each time a (possibly very frequent) wheel event fires.
This commit is contained in:
		
							parent
							
								
									e623d05e37
								
							
						
					
					
						commit
						a7b692e8ed
					
				
					 2 changed files with 21 additions and 12 deletions
				
			
		| 
						 | 
					@ -1890,20 +1890,27 @@ void MediaView::keyPressEvent(QKeyEvent *e) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MediaView::wheelEvent(QWheelEvent *e) {
 | 
					void MediaView::wheelEvent(QWheelEvent *e) {
 | 
				
			||||||
	if (e->delta() < 0) {
 | 
						constexpr auto step = static_cast<int>(QWheelEvent::DefaultDeltasPerStep);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_verticalWheelDelta += e->angleDelta().y();
 | 
				
			||||||
 | 
						while (qAbs(_verticalWheelDelta) >= step) {
 | 
				
			||||||
 | 
							if (_verticalWheelDelta < 0) {
 | 
				
			||||||
 | 
								_verticalWheelDelta += step;
 | 
				
			||||||
			if (e->modifiers().testFlag(Qt::ControlModifier)) {
 | 
								if (e->modifiers().testFlag(Qt::ControlModifier)) {
 | 
				
			||||||
				zoomOut();
 | 
									zoomOut();
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				if (e->source() == Qt::MouseEventNotSynthesized) {
 | 
									if (e->source() == Qt::MouseEventNotSynthesized) {
 | 
				
			||||||
				moveToNext(-1);
 | 
										moveToNext(1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
 | 
								_verticalWheelDelta -= step;
 | 
				
			||||||
			if (e->modifiers().testFlag(Qt::ControlModifier)) {
 | 
								if (e->modifiers().testFlag(Qt::ControlModifier)) {
 | 
				
			||||||
				zoomIn();
 | 
									zoomIn();
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				if (e->source() == Qt::MouseEventNotSynthesized) {
 | 
									if (e->source() == Qt::MouseEventNotSynthesized) {
 | 
				
			||||||
				moveToNext(1);
 | 
										moveToNext(-1);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -322,6 +322,8 @@ private:
 | 
				
			||||||
	typedef QMap<OverState, anim::fvalue> ShowingOpacities;
 | 
						typedef QMap<OverState, anim::fvalue> ShowingOpacities;
 | 
				
			||||||
	ShowingOpacities _animOpacities;
 | 
						ShowingOpacities _animOpacities;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int _verticalWheelDelta = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void updateOverRect(OverState state);
 | 
						void updateOverRect(OverState state);
 | 
				
			||||||
	bool updateOverState(OverState newState);
 | 
						bool updateOverState(OverState newState);
 | 
				
			||||||
	float64 overLevel(OverState control) const;
 | 
						float64 overLevel(OverState control) const;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue