Skip to content

Commit

Permalink
#62 An alternative to configuring delay values. Slide left was not ok…
Browse files Browse the repository at this point in the history
… on iOS
  • Loading branch information
EddyVerbruggen committed Oct 20, 2015
1 parent bbcea2b commit 941cad3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="com.telerik.plugins.nativepagetransitions"
version="0.5.0">
version="0.5.1">

<name>Native Page Transitions</name>

Expand Down
16 changes: 7 additions & 9 deletions src/ios/NativePageTransitions.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,8 @@ - (void) slide:(CDVInvokedUrlCommand*)command {
CGImageRelease(tempImage);
}

if ([direction isEqualToString:@"left"] || [direction isEqualToString:@"up"]) {
[self.transitionView.superview insertSubview:_screenShotImageView belowSubview:self.transitionView];
} else {
[self.transitionView.superview insertSubview:_screenShotImageView aboveSubview:self.transitionView];
}

[self.transitionView.superview insertSubview:_screenShotImageView aboveSubview:self.transitionView];

// Make a cropped version of the screenshot with only the top and/or bottom piece. Only for left/right slides atm.
if ([direction isEqualToString:@"left"] || [direction isEqualToString:@"right"]) {
if (fixedPixelsTop > 0) {
Expand Down Expand Up @@ -153,7 +149,6 @@ - (void) slide:(CDVInvokedUrlCommand*)command {
if (delay < 0) {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
} else {
[self performSlideTransition];
}
Expand All @@ -166,7 +161,7 @@ - (void) performSlideTransition {
NSTimeInterval duration = [[args objectForKey:@"duration"] doubleValue];
// duration/delay is passed in ms, but needs to be in sec here
duration = duration / 1000;
CGFloat lowerLayerAlpha = 0.4f; // TODO consider passing in
CGFloat lowerLayerAlpha = 0.4f;
NSTimeInterval delay = [[args objectForKey:@"iosdelay"] doubleValue]; // pass in -1 for manual (requires you to call executePendingTransition)
if (delay < 0) {
delay = 0;
Expand Down Expand Up @@ -215,6 +210,10 @@ - (void) performSlideTransition {
delay:delay
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
if ([direction isEqualToString:@"left"] || [direction isEqualToString:@"up"]) {
// the screenshot was on top of the webview to hide any page changes, but now we need the webview on top again
[self.transitionView.superview bringSubviewToFront:self.transitionView];
}
[_screenShotImageView setFrame:CGRectMake(transitionToX/screenshotSlowdownFactor, transitionToY, width, height)];
}
completion:^(BOOL finished) {
Expand Down Expand Up @@ -291,7 +290,6 @@ - (void) flip:(CDVInvokedUrlCommand*)command {
if (delay < 0) {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
} else {
[self performFlipTransition];
}
Expand Down

0 comments on commit 941cad3

Please sign in to comment.