diff --git a/platforms/ios/DevApp.xcodeproj/project.pbxproj b/platforms/ios/DevApp.xcodeproj/project.pbxproj index b428f8218..8730aac4b 100644 --- a/platforms/ios/DevApp.xcodeproj/project.pbxproj +++ b/platforms/ios/DevApp.xcodeproj/project.pbxproj @@ -69,6 +69,7 @@ A046F7401A74DFDA004678D8 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D85846C38A094BD7AE0421C1 /* OpenGLES.framework */; }; A046F7411A74DFDA004678D8 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3943BDD383F0494ABF86A8D1 /* QuartzCore.framework */; }; A046F7421A74DFDA004678D8 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CE5F4C8A9E143DD88320223 /* SystemConfiguration.framework */; }; + A07514851AAEDE5500068A7D /* MyTouchableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A07514841AAEDE5500068A7D /* MyTouchableView.m */; }; A0A6C8B519DE8B61006FA408 /* CDVLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 2642A164D871458CAA0E7CD2 /* CDVLogger.m */; }; A0B15AF119D406AE00CECFE9 /* plugin.xml in Resources */ = {isa = PBXBuildFile; fileRef = A0B15AF019D406AD00CECFE9 /* plugin.xml */; }; A0C8C25419D11E8B00E46F7E /* MyPluginScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = A0C8C25319D11E8B00E46F7E /* MyPluginScrollView.m */; }; @@ -188,6 +189,8 @@ 8D1107310486CEB800E47090 /* DevApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "DevApp-Info.plist"; path = "../DevApp-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 94B42436A54042BB8390247A /* HttpRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HttpRequest.h; path = plugin.http.request/HttpRequest/HttpRequest.h; sourceTree = ""; }; 9D0482B04E60450894AB403B /* libz.dylib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + A07514841AAEDE5500068A7D /* MyTouchableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MyTouchableView.m; path = ../../../../src/ios/GoogleMaps/MyTouchableView.m; sourceTree = ""; }; + A07514871AAEDF8F00068A7D /* MyTouchableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MyTouchableView.h; path = ../../../../src/ios/GoogleMaps/MyTouchableView.h; sourceTree = ""; }; A0B15AF019D406AD00CECFE9 /* plugin.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = plugin.xml; path = ../../plugin.xml; sourceTree = ""; }; A0C8C25219D11E8B00E46F7E /* MyPluginScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MyPluginScrollView.h; path = ../../../../src/ios/GoogleMaps/MyPluginScrollView.h; sourceTree = ""; }; A0C8C25319D11E8B00E46F7E /* MyPluginScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MyPluginScrollView.m; path = ../../../../src/ios/GoogleMaps/MyPluginScrollView.m; sourceTree = ""; }; @@ -349,6 +352,7 @@ 307C750510C5A3420062BCA9 /* Plugins */ = { isa = PBXGroup; children = ( + A07514871AAEDF8F00068A7D /* MyTouchableView.h */, 6904C34219D0F1A3008FFD15 /* Circle.h */, 6904C34319D0F1A3008FFD15 /* Circle.m */, 6904C34419D0F1A3008FFD15 /* External.h */, @@ -395,6 +399,7 @@ 5210F5E958CC4FCFA68923E4 /* R9HTTPRequest.h */, A0C8C25519D120FC00E46F7E /* MyPluginLayerDebugView.h */, A0C8C25619D120FC00E46F7E /* MyPluginLayerDebugView.m */, + A07514841AAEDE5500068A7D /* MyTouchableView.m */, ); name = Plugins; path = DevApp/Plugins; @@ -624,6 +629,7 @@ 6904C37019D0F1A3008FFD15 /* MyPluginLayer.m in Sources */, 6904C37219D0F1A3008FFD15 /* NSData+Base64.m in Sources */, 6904C36A19D0F1A3008FFD15 /* GoogleMaps.m in Sources */, + A07514851AAEDE5500068A7D /* MyTouchableView.m in Sources */, 6904C36E19D0F1A3008FFD15 /* Map.m in Sources */, 6904C37719D0F1A3008FFD15 /* TBXML.m in Sources */, C92E8F2094FE418B921242FD /* BSD-LICENSE in Sources */, diff --git a/src/android/plugin/google/maps/MyPluginLayout.java b/src/android/plugin/google/maps/MyPluginLayout.java index 8c5888b9c..f206aab4a 100644 --- a/src/android/plugin/google/maps/MyPluginLayout.java +++ b/src/android/plugin/google/maps/MyPluginLayout.java @@ -14,6 +14,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Point; import android.graphics.RectF; import android.os.Build; import android.os.Build.VERSION; @@ -26,6 +27,10 @@ import android.widget.LinearLayout; import android.widget.ScrollView; +import com.google.android.gms.maps.MapView; +import com.google.android.gms.maps.Projection; +import com.google.android.gms.maps.model.LatLng; + @SuppressWarnings("deprecation") public class MyPluginLayout extends FrameLayout { private CordovaWebView webView; @@ -34,10 +39,9 @@ public class MyPluginLayout extends FrameLayout { private Context context; private FrontLayerLayout frontLayer; private ScrollView scrollView = null; - private FrameLayout scrollFrameLayout = null; + private TouchableWrapper scrollFrameLayout = null; private View backgroundView = null; - private TouchableWrapper touchableWrapper; - private ViewGroup myView = null; + private MapView myView = null; private boolean isScrolling = false; private ViewGroup.LayoutParams orgLayoutParams = null; private boolean isDebug = false; @@ -67,14 +71,14 @@ public MyPluginLayout(CordovaWebView webView, Activity activity) { backgroundView.setHorizontalScrollBarEnabled(false); backgroundView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 9999)); - scrollFrameLayout = new FrameLayout(this.context); + scrollFrameLayout = new TouchableWrapper(this.context); scrollFrameLayout.addView(backgroundView); scrollFrameLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); scrollView.setHorizontalScrollBarEnabled(false); scrollView.setVerticalScrollBarEnabled(false); - this.touchableWrapper = new TouchableWrapper(this.context); + //this.touchableWrapper = new TouchableWrapper(this.context); } @@ -180,7 +184,6 @@ public void detachMyView() { frontLayer.removeView(webView); scrollFrameLayout.removeView(myView); - myView.removeView(this.touchableWrapper); this.removeView(this.scrollView); this.scrollView.removeView(scrollFrameLayout); @@ -193,19 +196,19 @@ public void detachMyView() { mActivity.getWindow().getDecorView().requestFocus(); } - public void attachMyView(ViewGroup pluginView) { + public void attachMyView(MapView mapView) { scrollView.setHorizontalScrollBarEnabled(false); scrollView.setVerticalScrollBarEnabled(false); scrollView.scrollTo(webView.getScrollX(), webView.getScrollY()); - if (myView == pluginView) { + if (myView == mapView) { return; } else { this.detachMyView(); } //backgroundView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, (int) (webView.getContentHeight() * webView.getScale() + webView.getHeight()))); - myView = pluginView; + myView = mapView; ViewGroup.LayoutParams lParams = myView.getLayoutParams(); orgLayoutParams = null; if (lParams != null) { @@ -215,8 +218,7 @@ public void attachMyView(ViewGroup pluginView) { scrollView.addView(scrollFrameLayout); this.addView(scrollView); - pluginView.addView(this.touchableWrapper); - scrollFrameLayout.addView(pluginView); + scrollFrameLayout.addView(mapView); frontLayer.addView(webView); this.addView(frontLayer); @@ -247,7 +249,7 @@ public void inValidate() { this.frontLayer.invalidate(); } - + private class FrontLayerLayout extends FrameLayout { public FrontLayerLayout(Context context) { @@ -255,6 +257,10 @@ public FrontLayerLayout(Context context) { this.setWillNotDraw(false); } + /** + * True if the touch event should be received by MapView. + * False, the event is received by WebView. + */ @Override public boolean onInterceptTouchEvent(MotionEvent event) { if (isClickable == false || myView == null || myView.getVisibility() != View.VISIBLE) { @@ -338,6 +344,44 @@ public TouchableWrapper(Context context) { super(context); } + @Override + public boolean onInterceptTouchEvent(MotionEvent event) { + if (isClickable == false || myView == null || myView.getVisibility() != View.VISIBLE) { + webView.requestFocus(View.FOCUS_DOWN); + return false; + } + String eventName = null; + switch(event.getAction()) { + case MotionEvent.ACTION_DOWN: + eventName = "touchstart"; + break; + case MotionEvent.ACTION_MOVE: + eventName = "touchmove"; + break; + case MotionEvent.ACTION_UP: + eventName = "touchend"; + break; + case MotionEvent.ACTION_CANCEL: + eventName = "touchcancel"; + break; + case MotionEvent.ACTION_OUTSIDE: + eventName = "touchleave"; + break; + default: + break; + } + int x = (int)event.getX() - myView.getLeft(); + int y = (int)event.getY() - myView.getTop(); + Projection projection = myView.getMap().getProjection(); + Point point = new Point(x, y); + LatLng latLng = projection.fromScreenLocation(point); + webView.loadUrl( + String.format("javascript:plugin.google.maps.Map._onTouchEvent('%s', [%d, %d], new window.plugin.google.maps.LatLng(%f, %f));", + eventName, x, y, latLng.latitude, latLng.longitude)); + + return false; + } + @Override public boolean dispatchTouchEvent(MotionEvent event) { int action = event.getAction(); diff --git a/src/ios/GoogleMaps/GoogleMaps.m b/src/ios/GoogleMaps/GoogleMaps.m index 81323456d..834a86c10 100644 --- a/src/ios/GoogleMaps/GoogleMaps.m +++ b/src/ios/GoogleMaps/GoogleMaps.m @@ -30,6 +30,8 @@ - (void)pluginInitialize self.webView.scrollView.delegate = self; [self.pluginScrollView setContentSize:CGSizeMake(320, 960) ]; + self.pluginLayer.touchableView = self.pluginScrollView.touchableView; + //[self.webView removeFromSuperview]; self.pluginLayer.webView = self.webView; [self.pluginLayer addSubview:self.pluginScrollView]; diff --git a/src/ios/GoogleMaps/GoogleMapsViewController.h b/src/ios/GoogleMaps/GoogleMapsViewController.h index 4347ca747..68725be02 100644 --- a/src/ios/GoogleMaps/GoogleMapsViewController.h +++ b/src/ios/GoogleMaps/GoogleMapsViewController.h @@ -12,7 +12,7 @@ #import "PluginUtil.h" #import "NSData+Base64.h" -@interface GoogleMapsViewController : UIViewController +@interface GoogleMapsViewController : UIViewController @property (nonatomic, strong) GMSMapView* map; @property (nonatomic, strong) UIWebView* webView; @@ -37,4 +37,7 @@ - (void)removeObjectForKey: (NSString *)key; - (BOOL)didTapMyLocationButtonForMapView:(GMSMapView *)mapView; + +- (void) didChangeActiveBuilding: (GMSIndoorBuilding *)building; +- (void) didChangeActiveLevel: (GMSIndoorLevel *)level; @end \ No newline at end of file diff --git a/src/ios/GoogleMaps/GoogleMapsViewController.m b/src/ios/GoogleMaps/GoogleMapsViewController.m index 338037601..5f31a6ddd 100644 --- a/src/ios/GoogleMaps/GoogleMapsViewController.m +++ b/src/ios/GoogleMaps/GoogleMapsViewController.m @@ -84,6 +84,9 @@ - (void)viewDidLoad //self.map.autoresizingMask = UIViewAutoresizingNone; self.map.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + //indoor display + self.map.indoorDisplay.delegate = self; + BOOL isEnabled = NO; //controls @@ -647,6 +650,43 @@ -(UIImage *)loadImageFromGoogleMap:(NSString *)fileName { } +- (void) didChangeActiveBuilding: (GMSIndoorBuilding *)building { + //Notify to the JS + NSString* jsString = @"javascript:plugin.google.maps.Map._onMapEvent('indoor_building_focused')"; + [self.webView stringByEvaluatingJavaScriptFromString:jsString]; +} + +- (void) didChangeActiveLevel: (GMSIndoorLevel *)activeLevel { + + GMSIndoorBuilding *building = self.map.indoorDisplay.activeBuilding; + + NSMutableDictionary *result = [NSMutableDictionary dictionary]; + + NSUInteger activeLevelIndex = [building.levels indexOfObject:activeLevel]; + [result setObject:[NSNumber numberWithInteger:activeLevelIndex] forKey:@"activeLevelIndex"]; + [result setObject:[NSNumber numberWithInteger:building.defaultLevelIndex] forKey:@"defaultLevelIndex"]; + + GMSIndoorLevel *level; + NSMutableDictionary *levelInfo; + NSMutableArray *levels = [NSMutableArray array]; + for (level in building.levels) { + levelInfo = [NSMutableDictionary dictionary]; + + [levelInfo setObject:[NSString stringWithString:level.name] forKey:@"name"]; + [levelInfo setObject:[NSString stringWithString:level.shortName] forKey:@"shortName"]; + [levels addObject:levelInfo]; + } + [result setObject:levels forKey:@"levels"]; + + NSError *error; + NSData *data = [NSJSONSerialization dataWithJSONObject:result options:NSJSONWritingPrettyPrinted error:&error]; + + NSString *JSONstring = [[NSString alloc] initWithData:data + encoding:NSUTF8StringEncoding]; + NSString *jsString = [NSString stringWithFormat:@"javascript:plugin.google.maps.Map._onMapEvent('indoor_level_activated', %@)", JSONstring]; + + [self.webView stringByEvaluatingJavaScriptFromString:jsString]; +} diff --git a/src/ios/GoogleMaps/Map.h b/src/ios/GoogleMaps/Map.h index 6e58c3c31..a588f651d 100644 --- a/src/ios/GoogleMaps/Map.h +++ b/src/ios/GoogleMaps/Map.h @@ -29,4 +29,5 @@ - (void)setAllGesturesEnabled:(CDVInvokedUrlCommand*)command; - (void)setPadding:(CDVInvokedUrlCommand*)command; - (void)panBy:(CDVInvokedUrlCommand*)command; +- (void)getFocusedBuilding:(CDVInvokedUrlCommand*)command; @end diff --git a/src/ios/GoogleMaps/Map.m b/src/ios/GoogleMaps/Map.m index 29e456d9c..99e5bc872 100644 --- a/src/ios/GoogleMaps/Map.m +++ b/src/ios/GoogleMaps/Map.m @@ -458,4 +458,35 @@ - (void)setPadding:(CDVInvokedUrlCommand *)command { [self.mapCtrl.map setPadding:padding]; } + +- (void)getFocusedBuilding:(CDVInvokedUrlCommand*)command { + GMSIndoorBuilding *building = self.mapCtrl.map.indoorDisplay.activeBuilding; + if (building != nil) { + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + } + GMSIndoorLevel *activeLevel = self.mapCtrl.map.indoorDisplay.activeLevel; + + NSMutableDictionary *result = [NSMutableDictionary dictionary]; + + NSUInteger activeLevelIndex = [building.levels indexOfObject:activeLevel]; + [result setObject:[NSNumber numberWithInteger:activeLevelIndex] forKey:@"activeLevelIndex"]; + [result setObject:[NSNumber numberWithInteger:building.defaultLevelIndex] forKey:@"defaultLevelIndex"]; + + GMSIndoorLevel *level; + NSMutableDictionary *levelInfo; + NSMutableArray *levels = [NSMutableArray array]; + for (level in building.levels) { + levelInfo = [NSMutableDictionary dictionary]; + + [levelInfo setObject:[NSString stringWithString:level.name] forKey:@"name"]; + [levelInfo setObject:[NSString stringWithString:level.shortName] forKey:@"shortName"]; + [levels addObject:levelInfo]; + } + [result setObject:levels forKey:@"levels"]; + + + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} @end diff --git a/src/ios/GoogleMaps/MyPluginLayer.h b/src/ios/GoogleMaps/MyPluginLayer.h index 268652a10..018a0a5a4 100644 --- a/src/ios/GoogleMaps/MyPluginLayer.h +++ b/src/ios/GoogleMaps/MyPluginLayer.h @@ -8,12 +8,14 @@ #import #import +#import "MyTouchableView.h"; #import "GoogleMapsViewController.h" @interface MyPluginLayer : UIView @property (nonatomic) UIWebView *webView; @property (nonatomic) GoogleMapsViewController* mapCtrl; +@property (nonatomic) MyTouchableView* touchableView; @property (nonatomic) NSDictionary *embedRect; @property (nonatomic) BOOL debuggable; @property (nonatomic) BOOL clickable; diff --git a/src/ios/GoogleMaps/MyPluginLayer.m b/src/ios/GoogleMaps/MyPluginLayer.m index 6c4e26b6b..242c16467 100644 --- a/src/ios/GoogleMaps/MyPluginLayer.m +++ b/src/ios/GoogleMaps/MyPluginLayer.m @@ -92,7 +92,12 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { return nil; } } - return hitView; + + self.touchableView.mapCtrl = self.mapCtrl; + + //NSLog(@"hitClass = %@", hitView); + return self.touchableView; + //return hitView; } return [super hitTest:point withEvent:event]; @@ -139,5 +144,4 @@ - (void)drawRect:(CGRect)rect CGContextFillRect(context, rectangle); } - @end diff --git a/src/ios/GoogleMaps/MyPluginScrollView.h b/src/ios/GoogleMaps/MyPluginScrollView.h index 81285561b..b5d96ed50 100644 --- a/src/ios/GoogleMaps/MyPluginScrollView.h +++ b/src/ios/GoogleMaps/MyPluginScrollView.h @@ -7,10 +7,12 @@ // #import +#import "MyTouchableView.h" #import "MyPluginLayerDebugView.h" @interface MyPluginScrollView : UIScrollView @property (nonatomic) MyPluginLayerDebugView *debugView; +@property (nonatomic) MyTouchableView *touchableView; - (void)attachView:(UIView *)view; - (void)dettachView; @end diff --git a/src/ios/GoogleMaps/MyPluginScrollView.m b/src/ios/GoogleMaps/MyPluginScrollView.m index 80cb8e59b..bfc65569c 100644 --- a/src/ios/GoogleMaps/MyPluginScrollView.m +++ b/src/ios/GoogleMaps/MyPluginScrollView.m @@ -16,15 +16,18 @@ - (id)initWithFrame:(CGRect)aRect { self = [super initWithFrame:aRect]; self.debugView = [[MyPluginLayerDebugView alloc] initWithFrame:aRect]; + self.touchableView = [[MyTouchableView alloc] initWithFrame:aRect]; return self; } - (void)attachView:(UIView *)view { myView = view; + [myView addSubview:self.touchableView]; [self addSubview:view]; [self addSubview:self.debugView]; } - (void)dettachView { + [self.touchableView removeFromSuperview]; [myView removeFromSuperview]; [self.debugView removeFromSuperview]; } diff --git a/src/ios/GoogleMaps/MyTouchableView.h b/src/ios/GoogleMaps/MyTouchableView.h new file mode 100644 index 000000000..a8a660898 --- /dev/null +++ b/src/ios/GoogleMaps/MyTouchableView.h @@ -0,0 +1,17 @@ +// +// MyTouchableView.h +// DevApp +// +// Created by Masashi Katsumata on 3/10/15. +// +// + +#import +#import +#import "GoogleMapsViewController.h" + +@interface MyTouchableView : UIView + +@property (nonatomic) GoogleMapsViewController* mapCtrl; +- (id)initWithFrame:(CGRect)aRect; +@end diff --git a/src/ios/GoogleMaps/MyTouchableView.m b/src/ios/GoogleMaps/MyTouchableView.m new file mode 100644 index 000000000..64ec00f9f --- /dev/null +++ b/src/ios/GoogleMaps/MyTouchableView.m @@ -0,0 +1,62 @@ +// +// MyTouchableView.m +// DevApp +// +// Created by Masashi Katsumata on 3/10/15. +// +// + + +#import "MyTouchableView.h" + +@implementation MyTouchableView + +- (id)initWithFrame:(CGRect)aRect +{ + self = [super initWithFrame:aRect]; + return self; +} + + +/** + http://abi.exdream.com/post/2010/03/18/iPhone-How-to-pass-touch-events-from-UIScrollView-to-the-parent-UIViewController.aspx + */ +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + UITouch *touch = [touches anyObject]; + CGPoint point = [touch locationInView:self]; + + + NSLog(@"touchBegan : %f, %f", point.x, point.y); + + [self.mapCtrl.view touchesEnded:touches withEvent:event]; +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +{ + UITouch *touch = [touches anyObject]; + CGPoint point = [touch locationInView:self]; + + + NSLog(@"touchesMoved : %f, %f", point.x, point.y); + [self.mapCtrl.view touchesEnded:touches withEvent:event]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + UITouch *touch = [touches anyObject]; + CGPoint point = [touch locationInView:self]; + + NSLog(@"touchesEnded : %f, %f", point.x, point.y); + [self.mapCtrl.view touchesEnded:touches withEvent:event]; +} +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + UITouch *touch = [touches anyObject]; + CGPoint point = [touch locationInView:self]; + + NSLog(@"touchesCancelled : %f, %f", point.x, point.y); + [self.mapCtrl.view touchesEnded:touches withEvent:event]; +} + +@end diff --git a/www/googlemaps-cdv-plugin.js b/www/googlemaps-cdv-plugin.js index 99f47e725..625e4ef97 100644 --- a/www/googlemaps-cdv-plugin.js +++ b/www/googlemaps-cdv-plugin.js @@ -222,6 +222,12 @@ App.prototype._onKmlEvent = function(eventName, kmlLayerId, result, options) { } }; +/** + * Callback from Native + */ +App.prototype._onTouchEvent = function(eventName, point, latLng) { + this.trigger(eventName, point, latLng); +}; /** * Callback from Native */ @@ -250,7 +256,7 @@ App.prototype._onMyLocationChange = function(params) { */ App.prototype._onCameraEvent = function(eventName, params) { var cameraPosition = new CameraPosition(params); - this.trigger(eventName, cameraPosition, this); + this.trigger(eventName, cameraPosition); }; diff --git a/www/index.html b/www/index.html index 3e7b26fa2..16806e1ac 100644 --- a/www/index.html +++ b/www/index.html @@ -1,51 +1,43 @@ - - - - - - Hello World - - - - - - -
-
- Map1 - Map2
- -
-
- - \ No newline at end of file + + + + Google Maps Plugin for Cordova + + + + + + +
+ + diff --git a/www/js/example.js b/www/js/example.js index d1b3cfbd6..c382deae0 100644 --- a/www/js/example.js +++ b/www/js/example.js @@ -29,8 +29,14 @@ $(document).on("deviceready", function() { map.on(plugin.google.maps.event.MAP_READY, onMapReady); }); +$("body").on("touchstart", function() { + console.log("touchstart on body"); +}); +$("body").on("touchend", function() { + console.log("touchend on body"); +}); function onMapReady() { - loadPage("welcome"); + loadPage("test"); } function loadPage(tmplName, params) { @@ -44,6 +50,21 @@ function loadPage(tmplName, params) { map.off(); +map.on("touchstart", function(point, latLng) { + console.log("touchstart, " + point + " / " + latLng); +}); +map.on("touchend", function(point, latLng) { + console.log("touchend, " + point + " / " + latLng); +}); +map.on("touchleave", function(point, latLng) { + console.log("touchleave, " + point + " / " + latLng); +}); +map.on("touchmove", function(point, latLng) { + console.log("touchmove, " + point + " / " + latLng); +}); +map.on("touchcancel", function(point, latLng) { + console.log("touchcancel, " + point + " / " + latLng); +}); prettyPrint(); // Execute the code diff --git a/www/pages/test.html b/www/pages/test.html index e0864403a..28b9f4871 100644 --- a/www/pages/test.html +++ b/www/pages/test.html @@ -1,10 +1,4 @@ \ No newline at end of file