Revision: 15619 http://sourceforge.net/p/skim-app/code/15619 Author: hofman Date: 2025-07-08 14:34:19 +0000 (Tue, 08 Jul 2025) Log Message: ----------- get mouse location when getting drag event
Modified Paths: -------------- trunk/SKPDFView.m Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2025-07-07 22:10:55 UTC (rev 15618) +++ trunk/SKPDFView.m 2025-07-08 14:34:19 UTC (rev 15619) @@ -4033,8 +4033,9 @@ // Old (current) annotation location and click point relative to it NSRect originalBounds = [currentAnnotation bounds]; BOOL isLine = [currentAnnotation isLine]; - NSPoint initialPoint = NSZeroPoint; - PDFPage *page = [self pageAndPoint:&initialPoint forEvent:theEvent nearest:YES]; + NSPoint mousePoint = [theEvent locationInView:self]; + PDFPage *page = [self pageForPoint:mousePoint nearest:YES]; + NSPoint initialPoint = [self convertPoint:mousePoint toPage:page]; SKNoteType noteType = annotationMode; BOOL shouldAddAnnotation = currentAnnotation == nil; NSPoint originalStartPoint = NSZeroPoint; @@ -4098,31 +4099,32 @@ [self beginNewUndoGroupIfNeeded]; draggedAnnotation = YES; } - lastMouseEvent = theEvent; - if (resizeHandle == 0) - [[[self scrollView] contentView] autoscroll:theEvent]; + mousePoint = [theEvent locationInView:self]; + if (resizeHandle == 0) { + lastMouseEvent = theEvent; + [[[self scrollView] contentView] autoscroll:lastMouseEvent]; + } } else if ([theEvent type] == NSEventTypePeriodic) { if (currentAnnotation == nil || [[[self scrollView] contentView] autoscroll:lastMouseEvent] == NO) continue; } BOOL shiftDown = ([theEvent modifierFlags] & NSEventModifierFlagShift) != 0; - NSPoint point = [lastMouseEvent locationInView:self]; if (resizeHandle == 0) - page = [self pageForPoint:point nearest:YES]; - point = SKSubstractPoints([self convertPoint:point toPage:page], initialPoint); + page = [self pageForPoint:mousePoint nearest:YES]; + NSPoint draggedPoint = SKSubstractPoints([self convertPoint:mousePoint toPage:page], initialPoint); if (resizeHandle == 0) { - [self moveAnnotationToPoint:point onPage:page]; + [self moveAnnotationToPoint:draggedPoint onPage:page]; } else if (isLine) { - [self dragLineAnnotationStartPoint:(resizeHandle & SKMinXEdgeMask) != 0 by:point originalStartPoint:originalStartPoint originalEndPoint:originalEndPoint shiftDown:shiftDown]; + [self dragLineAnnotationStartPoint:(resizeHandle & SKMinXEdgeMask) != 0 by:draggedPoint originalStartPoint:originalStartPoint originalEndPoint:originalEndPoint shiftDown:shiftDown]; } else { if (shouldAddAnnotation) { - SKRectEdges currentResizeHandle = (point.x < 0.0 ? SKMinXEdgeMask : SKMaxXEdgeMask) | (point.y <= 0.0 ? SKMinYEdgeMask : SKMaxYEdgeMask); + SKRectEdges currentResizeHandle = (draggedPoint.x < 0.0 ? SKMinXEdgeMask : SKMaxXEdgeMask) | (draggedPoint.y <= 0.0 ? SKMinYEdgeMask : SKMaxYEdgeMask); if (currentResizeHandle != resizeHandle) { resizeHandle = currentResizeHandle; [self setCursorForAreaOfInterest:SKAreaOfInterestForResizeHandle(resizeHandle, page)]; } } - [self dragAnnotationResizeHandle:resizeHandle by:point originalBounds:originalBounds originalPaths:originalPaths margin:margin shiftDown:shiftDown]; + [self dragAnnotationResizeHandle:resizeHandle by:draggedPoint originalBounds:originalBounds originalPaths:originalPaths margin:margin shiftDown:shiftDown]; } [[highlightLayerController layer] setNeedsDisplay]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit