mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:22:44 +00:00 
			
		
		
		
	PDFViewer: Enable panning with middle mouse button
Enable the use of the middle mouse button for panning in PDFViewer.
This commit is contained in:
		
							parent
							
								
									3af71c406d
								
							
						
					
					
						commit
						56bec4968c
					
				
					 2 changed files with 28 additions and 0 deletions
				
			
		|  | @ -113,6 +113,29 @@ void PDFViewer::mousewheel_event(GUI::MouseEvent& event) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void PDFViewer::mousedown_event(GUI::MouseEvent& event) | ||||
| { | ||||
|     if (event.button() == GUI::MouseButton::Middle) { | ||||
|         m_pan_starting_position = to_content_position(event.position()); | ||||
|         set_override_cursor(Gfx::StandardCursor::Drag); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void PDFViewer::mouseup_event(GUI::MouseEvent&) | ||||
| { | ||||
|     set_override_cursor(Gfx::StandardCursor::None); | ||||
| } | ||||
| 
 | ||||
| void PDFViewer::mousemove_event(GUI::MouseEvent& event) | ||||
| { | ||||
|     if (event.buttons() & GUI::MouseButton::Middle) { | ||||
|         auto delta = to_content_position(event.position()) - m_pan_starting_position; | ||||
|         horizontal_scrollbar().decrease_slider_by(delta.x()); | ||||
|         vertical_scrollbar().decrease_slider_by(delta.y()); | ||||
|         update(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void PDFViewer::timer_event(Core::TimerEvent&) | ||||
| { | ||||
|     // Clear the bitmap vector of all pages except the current page
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Marcus Nilsson
						Marcus Nilsson