Revision: 14847
          http://sourceforge.net/p/skim-app/code/14847
Author:   hofman
Date:     2024-12-27 10:30:49 +0000 (Fri, 27 Dec 2024)
Log Message:
-----------
pass target rect of target page in animate method rather tghan returning from 
block

Modified Paths:
--------------
    trunk/SKPresentationView.m
    trunk/SKTransitionController.h
    trunk/SKTransitionController.m

Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m  2024-12-24 17:41:29 UTC (rev 14846)
+++ trunk/SKPresentationView.m  2024-12-27 10:30:49 UTC (rev 14847)
@@ -165,10 +165,10 @@
 
 #pragma mark Action
 
-- (NSRect)pageRect {
+- (NSRect)pageRect:(PDFPage *)aPage {
     NSRect bounds = [self bounds];
-    NSRect pageRect = [page boundsForBox:kPDFDisplayBoxCropBox];
-    if (([page rotation] % 180) != 0)
+    NSRect pageRect = [aPage boundsForBox:kPDFDisplayBoxCropBox];
+    if (([aPage rotation] % 180) != 0)
         pageRect = NSMakeRect(0.0, 0.0, NSHeight(pageRect), NSWidth(pageRect));
     CGFloat scale = [self autoScales] ? fmin(NSHeight(bounds) / 
NSHeight(pageRect), NSWidth(bounds) / NSWidth(pageRect)) : 1.0;
     return NSInsetRect(bounds, 0.5 * (NSWidth(bounds) - scale * 
NSWidth(pageRect)), 0.5 * (NSHeight(bounds) - scale * NSHeight(pageRect)));
@@ -182,10 +182,7 @@
     if ([transitionController pageTransitions] == nil &&
         ([[transitionController transition] style] == SKNoTransition || 
equalStrings([page label], [toPage label])))
         return NO;
-    [transitionController animateView:self forRect:[self pageRect] atIndex:idx 
forward:forward change:^{
-        [self setPage:toPage];
-        return [self pageRect];
-    }];
+    [transitionController animateView:self forRect:[self pageRect:page] 
toRect:[self pageRect:toPage] atIndex:idx forward:forward change:^{ [self 
setPage:toPage]; }];
     return YES;
 }
 

Modified: trunk/SKTransitionController.h
===================================================================
--- trunk/SKTransitionController.h      2024-12-24 17:41:29 UTC (rev 14846)
+++ trunk/SKTransitionController.h      2024-12-27 10:30:49 UTC (rev 14847)
@@ -56,7 +56,7 @@
 
 @property (nonatomic) BOOL shouldScale;
 
-- (void)animateView:(NSView *)view forRect:(NSRect)rect 
atIndex:(NSUInteger)anIndex forward:(BOOL)forward change:(NSRect 
(^)(void))change;
+- (void)animateView:(NSView *)view forRect:(NSRect)rect toRect:(NSRect)toRect 
atIndex:(NSUInteger)anIndex forward:(BOOL)forward change:(void (^)(void))change;
 
 @end
 

Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m      2024-12-24 17:41:29 UTC (rev 14846)
+++ trunk/SKTransitionController.m      2024-12-27 10:30:49 UTC (rev 14847)
@@ -171,7 +171,7 @@
     return image;
 }
 
-- (void)animateView:(NSView *)view forRect:(NSRect)rect 
atIndex:(NSUInteger)idx forward:(BOOL)forward change:(NSRect (^)(void))change {
+- (void)animateView:(NSView *)view forRect:(NSRect)rect toRect:(NSRect)toRect 
atIndex:(NSUInteger)idx forward:(BOOL)forward change:(void (^)(void))change {
     if (animating) {
         change();
         return;
@@ -191,7 +191,7 @@
         
         CIImage *initialImage = [self currentImageForRect:rect inView:view 
scale:NULL];
         
-        NSRect toRect = change();
+        change();
 
         NSRect bounds = [view bounds];
         CGFloat imageScale = 1.0;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to