mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-04 03:27:00 -05:00 
			
		
		
		
	When tapping on a link int he document, activate the link instead of turning the page
This commit is contained in:
		
							parent
							
								
									0c565d7fbe
								
							
						
					
					
						commit
						654cdf65a6
					
				@ -243,9 +243,16 @@ class GestureHandler(QObject):
 | 
			
		||||
        if self.close_open_menu():
 | 
			
		||||
            return
 | 
			
		||||
        view = self.parent()
 | 
			
		||||
        mf = view.document.mainFrame()
 | 
			
		||||
        r = mf.hitTestContent(tp.current_position.toPoint())
 | 
			
		||||
        if r.linkElement().isNull():
 | 
			
		||||
            threshold = view.width() / 3.0
 | 
			
		||||
            attr = 'previous' if tp.start_position.x() <= threshold else 'next'
 | 
			
		||||
            getattr(view, '%s_page'%attr)()
 | 
			
		||||
        else:
 | 
			
		||||
            for etype in (QEvent.MouseButtonPress, QEvent.MouseButtonRelease):
 | 
			
		||||
                ev = QMouseEvent(etype, tp.current_position.toPoint(), tp.current_screen_position.toPoint(), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
 | 
			
		||||
                QApplication.sendEvent(view, ev)
 | 
			
		||||
 | 
			
		||||
    def handle_tap_hold(self, action, tp):
 | 
			
		||||
        etype = {'start':QEvent.MouseButtonPress, 'update':QEvent.MouseMove, 'end':QEvent.MouseButtonRelease}[action]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user