Revision: 12335 http://sourceforge.net/p/skim-app/code/12335 Author: hofman Date: 2021-05-19 14:13:02 +0000 (Wed, 19 May 2021) Log Message: ----------- use NSKeyValueObservingOptionInitial instead of explicitly calling observation method
Modified Paths: -------------- trunk/SKFontWell.m trunk/SKPDFView.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2021-05-15 09:55:53 UTC (rev 12334) +++ trunk/SKFontWell.m 2021-05-19 14:13:02 UTC (rev 12335) @@ -338,8 +338,7 @@ else if ([bindingName isEqualToString:FONTSIZE_KEY]) context = &SKFontWellFontSizeObservationContext; - [observableController addObserver:self forKeyPath:keyPath options:0 context:context]; - [self observeValueForKeyPath:keyPath ofObject:observableController change:nil context:context]; + [observableController addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionInitial context:context]; } else { [super bind:bindingName toObject:observableController withKeyPath:keyPath options:options]; } Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2021-05-15 09:55:53 UTC (rev 12334) +++ trunk/SKPDFView.m 2021-05-19 14:13:02 UTC (rev 12335) @@ -428,9 +428,9 @@ NSRect visibleRect = [self visibleContentRect]; NSView *docView = [self documentView]; BOOL hasLinkToolTips = (toolMode == SKTextToolMode || toolMode == SKMoveToolMode || toolMode == SKNoteToolMode); - BOOL hasWindow = [[self window] isVisible]; NSPoint mouseLoc = [docView convertPointFromScreen:[NSEvent mouseLocation]]; - BOOL isInside = NO; + BOOL mouseInView = [[self window] isVisible] && NSMouseInRect(mouseLoc, [docView visibleRect], [docView isFlipped]); + PDFAnnotation *hoverAnnotation = nil; for (PDFPage *page in [self visiblePages]) { for (PDFAnnotation *annotation in [page annotations]) { @@ -440,9 +440,9 @@ rect = [self convertRect:rect toView:docView]; NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:annotation, SKAnnotationKey, nil]; NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp; - if (hasWindow && NSPointInRect(mouseLoc, rect)) { + if (mouseInView && NSMouseInRect(mouseLoc, rect, [docView isFlipped])) { options |= NSTrackingAssumeInside; - isInside = YES; + hoverAnnotation = annotation; } NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:rect options:options owner:self userInfo:userInfo]; [docView addTrackingArea:area]; @@ -453,8 +453,12 @@ } } - if (hasWindow && isInside == NO && [[[SKImageToolTipWindow sharedToolTipWindow] currentImageContext] isKindOfClass:[PDFAnnotation class]]) - [[SKImageToolTipWindow sharedToolTipWindow] fadeOut]; + if (mouseInView && hoverAnnotation != [[SKImageToolTipWindow sharedToolTipWindow] currentImageContext]) { + if (hoverAnnotation) + [[SKImageToolTipWindow sharedToolTipWindow] showForImageContext:hoverAnnotation scale:[self scaleFactor] atPoint:NSZeroPoint]; + else + [[SKImageToolTipWindow sharedToolTipWindow] fadeOut]; + } } } 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