Revision: 14521
http://sourceforge.net/p/skim-app/code/14521
Author: hofman
Date: 2024-10-05 23:03:07 +0000 (Sat, 05 Oct 2024)
Log Message:
-----------
Pass view to animate to transition controller method rather than setting it as
a property
Modified Paths:
--------------
trunk/SKPresentationView.m
trunk/SKTransitionController.h
trunk/SKTransitionController.m
Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m 2024-10-05 16:45:59 UTC (rev 14520)
+++ trunk/SKPresentationView.m 2024-10-05 23:03:07 UTC (rev 14521)
@@ -163,14 +163,6 @@
- (BOOL)autoScales { return YES; }
-- (void)setTransitionController:(SKTransitionController
*)newTransitionController {
- if (newTransitionController != transitionController) {
- [transitionController setView:nil];
- transitionController = newTransitionController;
- [transitionController setView:self];
- }
-}
-
#pragma mark Action
- (NSRect)pageRect {
@@ -190,7 +182,7 @@
if ([transitionController pageTransitions] == nil &&
([[transitionController transition] style] == SKNoTransition ||
equalStrings([page label], [toPage label])))
return NO;
- [transitionController animateForRect:[self pageRect] atIndex:idx
forward:forward change:^{
+ [transitionController animateView:self forRect:[self pageRect] atIndex:idx
forward:forward change:^{
[self setPage:toPage];
return [self pageRect];
}];
Modified: trunk/SKTransitionController.h
===================================================================
--- trunk/SKTransitionController.h 2024-10-05 16:45:59 UTC (rev 14520)
+++ trunk/SKTransitionController.h 2024-10-05 23:03:07 UTC (rev 14521)
@@ -44,7 +44,6 @@
@interface SKTransitionController : NSObject {
SKTransitionView *transitionView;
- __weak NSView *view;
BOOL animating;
BOOL shouldScale;
@@ -52,13 +51,12 @@
NSArray<NSDictionary<NSString *, id> *> *pageTransitions;
}
-@property (nonatomic, nullable, weak) NSView *view;
@property (nonatomic, nullable, strong) SKTransitionInfo *transition;
@property (nonatomic, nullable, copy) NSArray<NSDictionary<NSString *, id> *>
*pageTransitions;
@property (nonatomic) BOOL shouldScale;
-- (void)animateForRect:(NSRect)rect atIndex:(NSUInteger)anIndex
forward:(BOOL)forward change:(NSRect (^)(void))change;
+- (void)animateView:(NSView *)view forRect:(NSRect)rect
atIndex:(NSUInteger)anIndex forward:(BOOL)forward change:(NSRect
(^)(void))change;
@end
Modified: trunk/SKTransitionController.m
===================================================================
--- trunk/SKTransitionController.m 2024-10-05 16:45:59 UTC (rev 14520)
+++ trunk/SKTransitionController.m 2024-10-05 23:03:07 UTC (rev 14521)
@@ -70,7 +70,7 @@
@implementation SKTransitionController
-@synthesize view, transition, pageTransitions, shouldScale;
+@synthesize transition, pageTransitions, shouldScale;
static inline CGRect scaleRect(NSRect rect, CGFloat scale) {
return CGRectMake(scale * NSMinX(rect), scale * NSMinY(rect), scale *
NSWidth(rect), scale * NSHeight(rect));
@@ -154,7 +154,7 @@
return transitionFilter;
}
-- (CIImage *)currentImageForRect:(NSRect)rect scale:(CGFloat *)scalePtr {
+- (CIImage *)currentImageForRect:(NSRect)rect inView:(NSView *)view
scale:(CGFloat *)scalePtr {
NSRect bounds = [view bounds];
NSBitmapImageRep *contentBitmap = [view bitmapImageRepCachingDisplay];
CIImage *tmpImage = [[CIImage alloc] initWithBitmapImageRep:contentBitmap];
@@ -171,7 +171,7 @@
return image;
}
-- (void)animateForRect:(NSRect)rect atIndex:(NSUInteger)idx
forward:(BOOL)forward change:(NSRect (^)(void))change {
+- (void)animateView:(NSView *)view forRect:(NSRect)rect
atIndex:(NSUInteger)idx forward:(BOOL)forward change:(NSRect (^)(void))change {
if (animating) {
change();
return;
@@ -191,13 +191,13 @@
animating = YES;
- CIImage *initialImage = [self currentImageForRect:rect scale:NULL];
+ CIImage *initialImage = [self currentImageForRect:rect inView:view
scale:NULL];
NSRect toRect = change();
NSRect bounds = [view bounds];
CGFloat imageScale = 1.0;
- CIImage *finalImage = [self currentImageForRect:toRect
scale:&imageScale];
+ CIImage *finalImage = [self currentImageForRect:toRect inView:view
scale:&imageScale];
CGRect cgRect =
CGRectIntegral(scaleRect(NSIntersectionRect(NSUnionRect(rect, toRect), bounds),
imageScale));
CGRect cgBounds = scaleRect(bounds, imageScale);
CGRect extent = [currentTransition shouldRestrict] ? cgRect : cgBounds;
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