Merge pull request #2331 from fufesou/fix_remote_cursor_scrollbar
fix remote cursor, when "Scrollbar" is checked
This commit is contained in:
		
						commit
						f672e022de
					
				| @ -506,7 +506,6 @@ class CursorPaint extends StatelessWidget { | |||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     final m = Provider.of<CursorModel>(context); |     final m = Provider.of<CursorModel>(context); | ||||||
|     final c = Provider.of<CanvasModel>(context); |     final c = Provider.of<CanvasModel>(context); | ||||||
|     // final adjust = m.adjustForKeyboard(); |  | ||||||
|     double hotx = m.hotx; |     double hotx = m.hotx; | ||||||
|     double hoty = m.hoty; |     double hoty = m.hoty; | ||||||
|     if (m.image == null) { |     if (m.image == null) { | ||||||
| @ -515,20 +514,33 @@ class CursorPaint extends StatelessWidget { | |||||||
|         hoty = preDefaultCursor.image!.height / 2; |         hoty = preDefaultCursor.image!.height / 2; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     return zoomCursor.isTrue | 
 | ||||||
|         ? CustomPaint( |     double cx = c.x; | ||||||
|  |     double cy = c.y; | ||||||
|  |     if (c.scrollStyle == ScrollStyle.scrollbar) { | ||||||
|  |       final d = c.parent.target!.ffiModel.display; | ||||||
|  |       final imageWidth = d.width * c.scale; | ||||||
|  |       final imageHeight = d.height * c.scale; | ||||||
|  |       cx = -imageWidth * c.scrollX; | ||||||
|  |       cy = -imageHeight * c.scrollY; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     double x = (m.x - hotx) * c.scale + cx; | ||||||
|  |     double y = (m.y - hoty) * c.scale + cx; | ||||||
|  |     double scale = 1.0; | ||||||
|  |     if (zoomCursor.isTrue) { | ||||||
|  |       x = m.x - hotx + cx / c.scale; | ||||||
|  |       y = m.y - hoty + cy / c.scale; | ||||||
|  |       scale = c.scale; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return CustomPaint( | ||||||
|       painter: ImagePainter( |       painter: ImagePainter( | ||||||
|         image: m.image ?? preDefaultCursor.image, |         image: m.image ?? preDefaultCursor.image, | ||||||
|                 x: m.x - hotx + c.x / c.scale, |         x: x, | ||||||
|                 y: m.y - hoty + c.y / c.scale, |         y: y, | ||||||
|                 scale: c.scale), |         scale: scale, | ||||||
|           ) |       ), | ||||||
|         : CustomPaint( |  | ||||||
|             painter: ImagePainter( |  | ||||||
|                 image: m.image ?? preDefaultCursor.image, |  | ||||||
|                 x: (m.x - hotx) * c.scale + c.x, |  | ||||||
|                 y: (m.y - hoty) * c.scale + c.y, |  | ||||||
|                 scale: 1.0), |  | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user