Skip to content

Commit

Permalink
fixed double tap to download cover image issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyofr authored and yoyofr committed Mar 25, 2015
1 parent c1c77ae commit 2d1d385
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 0 additions & 2 deletions modizer/Classes/ModizMusicPlayer.mm
Expand Up @@ -1109,8 +1109,6 @@ -(id) initMusicPlayer {

//restore EQ settings
[EQViewController restoreEQSettings];



[self iPhoneDrv_Init];

Expand Down
2 changes: 1 addition & 1 deletion modizer/Classes/WB_BookmarksViewController.mm
Expand Up @@ -80,7 +80,7 @@ -(void) loadBuiltinBookmarks {
[self addbuiltinURL:@"http://modarchive.org/" name:@"MOD Archive"];
[self addbuiltinURL:@"http://sndh.atari.org/sndh/browser/index.php?dir=sndh_lf%2F" name:@"Atari ST SNDH Archive"];
[self addbuiltinURL:@"http://2a03.free.fr/" name:@"2A03"];
[self addbuiltinURL:@"http://vgm.mdscene.net/" name:@"VGM Rips (Arcade, Computers, Consoles)"];
[self addbuiltinURL:@"http://vgmrips.net/packs/" name:@"VGM Rips (Arcade, Computers, Consoles)"];
[self addbuiltinURL:@"http://snesmusic.org/v2/" name:@"SNES Music"];
[self addbuiltinURL:@"http://snesmusic.org/pmh/" name:@"Portable Music History"];
[self addbuiltinURL:@"http://project2612.org/" name:@"Megadrive/Genesis Music"];
Expand Down
16 changes: 11 additions & 5 deletions modizer/Classes/WebBrowser.mm
Expand Up @@ -793,18 +793,22 @@ -(void) doubleTap :(UITapGestureRecognizer*) sender {
// <If tag is IMG, then get image URL and start saving>
int scrollPositionY = [[self.webView stringByEvaluatingJavaScriptFromString:@"window.pageYOffset"] intValue];
int scrollPositionX = [[self.webView stringByEvaluatingJavaScriptFromString:@"window.pageXOffset"] intValue];
int displayWidth = [[self.webView stringByEvaluatingJavaScriptFromString:@"window.outerWidth"] intValue];
int displayWidth = [[self.webView stringByEvaluatingJavaScriptFromString:@"window.innerWidth"] intValue];
CGFloat scale = webView.frame.size.width / displayWidth;
CGPoint pt = [sender locationInView:self.webView];
pt.x *= scale;
pt.y *= scale;
pt.x += scrollPositionX;
pt.y += scrollPositionY;
// NSLog(@"scale:%f displayWidth: %d,x:%f y:%f sx:%f sy:%f",scale,displayWidth, pt.x,pt.y,scrollPositionX,scrollPositionY);
NSString *js = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).tagName", pt.x, pt.y];
NSString *tagName = [self.webView stringByEvaluatingJavaScriptFromString:js];
NSString *imgURL = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).src", pt.x, pt.y];
NSString *urlToSave = [self.webView stringByEvaluatingJavaScriptFromString:imgURL];

// NSLog(@"tagName: %@",tagName);
// NSLog(@"urg: %@",urlToSave);

if ([tagName compare:@"IMG" options:NSCaseInsensitiveSearch]==NSOrderedSame) {
found_img=0;

Expand Down Expand Up @@ -839,9 +843,6 @@ - (void)viewDidLoad {

bookmarksVC=nil;

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
doubleTap.numberOfTouchesRequired = 2;
[self.webView addGestureRecognizer:doubleTap];

self.hidesBottomBarWhenPushed = YES;

Expand Down Expand Up @@ -875,8 +876,13 @@ - (void)viewDidLoad {

[self loadHome];
[super viewDidLoad];

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
doubleTap.numberOfTouchesRequired = 2;
[self.webView addGestureRecognizer:doubleTap];


end_time=clock();
end_time=clock();
#ifdef LOAD_PROFILE
NSLog(@"webbro : %d",end_time-start_time);
#endif
Expand Down
6 changes: 3 additions & 3 deletions modizer/Resources/en.lproj/MainWindow.xib
Expand Up @@ -27,7 +27,7 @@
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="1237346308.jpg" id="110">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -744,7 +744,7 @@
<view clipsSubviews="YES" contentMode="scaleToFill" id="388" userLabel="Vol win">
<rect key="frame" x="0.0" y="416" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</view>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="00:00" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" id="27" userLabel="Elpased time">
<rect key="frame" x="2" y="21" width="45" height="20"/>
Expand Down Expand Up @@ -1398,7 +1398,7 @@ Internet accesses to the Modland, HVSC &amp; ASMA libraries are provided as an a
<dataDetectorType key="dataDetectorTypes" link="YES"/>
</textView>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<toolbarItems/>
Expand Down

0 comments on commit 2d1d385

Please sign in to comment.