Skip to content

Commit

Permalink
#28 Slide transparency
Browse files Browse the repository at this point in the history
- compatibility with google maps plugin fixed
  • Loading branch information
EddyVerbruggen committed Jan 15, 2015
1 parent 5acc18d commit bc350f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 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.2.9">
version="0.2.10">

<name>Native Page Transitions</name>

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

if ([direction isEqualToString:@"left"] || [direction isEqualToString:@"up"]) {
[UIApplication.sharedApplication.keyWindow.subviews.lastObject insertSubview:_screenShotImageView belowSubview:self.webView];
[self.webView.superview insertSubview:_screenShotImageView belowSubview:self.webView];
} else {
[UIApplication.sharedApplication.keyWindow.subviews.lastObject insertSubview:_screenShotImageView aboveSubview:self.webView];
[self.webView.superview insertSubview:_screenShotImageView aboveSubview:self.webView];
}

// Make a cropped version of the screenshot with only the top and/or bottom piece. Only for left/right slides atm.
Expand All @@ -111,9 +111,7 @@ - (void) slide:(CDVInvokedUrlCommand*)command {
_screenShotImageViewTop = [[UIImageView alloc]initWithFrame:rect2];
[_screenShotImageViewTop setImage:[UIImage imageWithCGImage:tempImage]];
CGImageRelease(tempImage);
[UIApplication.sharedApplication.keyWindow.subviews.lastObject
insertSubview:_screenShotImageViewTop
aboveSubview:([direction isEqualToString:@"left"] ? self.webView : self.screenShotImageView)];
[self.webView.superview insertSubview:_screenShotImageViewTop aboveSubview:([direction isEqualToString:@"left"] ? self.webView : self.screenShotImageView)];
}
if (fixedPixelsBottom > 0) {
CGRect rect = CGRectMake(0.0, (image.size.height-fixedPixelsBottom)*retinaFactor, image.size.width*retinaFactor, fixedPixelsBottom*retinaFactor);
Expand All @@ -122,9 +120,7 @@ - (void) slide:(CDVInvokedUrlCommand*)command {
_screenShotImageViewBottom = [[UIImageView alloc]initWithFrame:rect2];
[_screenShotImageViewBottom setImage:[UIImage imageWithCGImage:tempImage]];
CGImageRelease(tempImage);
[UIApplication.sharedApplication.keyWindow.subviews.lastObject
insertSubview:_screenShotImageViewBottom
aboveSubview:([direction isEqualToString:@"left"] ? self.webView : self.screenShotImageView)];
[self.webView.superview insertSubview:_screenShotImageViewBottom aboveSubview:([direction isEqualToString:@"left"] ? self.webView : self.screenShotImageView)];
}
}

Expand Down Expand Up @@ -248,7 +244,7 @@ - (void) drawer:(CDVInvokedUrlCommand*)command {
}
[_screenShotImageView setImage:image];
if ([action isEqualToString:@"open"]) {
[UIApplication.sharedApplication.keyWindow.subviews.lastObject insertSubview:_screenShotImageView aboveSubview:self.webView];
[self.webView.superview insertSubview:_screenShotImageView aboveSubview:self.webView];
} else {
// add a cool shadow here as well
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.webView.bounds];
Expand Down Expand Up @@ -282,7 +278,7 @@ - (void) drawer:(CDVInvokedUrlCommand*)command {

// position the webview above the screenshot just after the animation kicks in so no flash of the webview occurs
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay+50 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
[UIApplication.sharedApplication.keyWindow.subviews.lastObject bringSubviewToFront:self.webView];
[self.webView.superview bringSubviewToFront:self.webView];
});

[UIView animateWithDuration:duration
Expand Down Expand Up @@ -327,7 +323,7 @@ - (void) flip:(CDVInvokedUrlCommand*)command {

_screenShotImageView = [[UIImageView alloc]initWithFrame:[self.viewController.view.window frame]];
[_screenShotImageView setImage:image];
[UIApplication.sharedApplication.keyWindow.subviews.lastObject insertSubview:_screenShotImageView aboveSubview:self.webView];
[self.webView.superview insertSubview:_screenShotImageView aboveSubview:self.webView];

UIViewAnimationOptions animationOptions;
if ([direction isEqualToString:@"right"]) {
Expand Down Expand Up @@ -405,7 +401,7 @@ - (void) curl:(CDVInvokedUrlCommand*)command {

_screenShotImageView = [[UIImageView alloc]initWithFrame:[self.viewController.view.window frame]];
[_screenShotImageView setImage:image];
[UIApplication.sharedApplication.keyWindow.subviews.lastObject insertSubview:_screenShotImageView aboveSubview:self.webView];
[self.webView.superview insertSubview:_screenShotImageView aboveSubview:self.webView];

UIViewAnimationOptions animationOptions;
if ([direction isEqualToString:@"up"]) {
Expand Down

0 comments on commit bc350f8

Please sign in to comment.