Skip to content

Latest commit

 

History

History
152 lines (128 loc) · 3.95 KB

File metadata and controls

152 lines (128 loc) · 3.95 KB

⚠️ This document is aim for older versions (from 2.3.0 to 2.5.3). Document for new version is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md

GroundOverlay class

This class extends BaseClass.

Contents


Overview

Create one GroundOverlay

var bounds = [
  {"lat": 40.712216, "lng": -74.22655},
  {"lat": 40.773941, "lng": -74.12544}
];
var mapDiv = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(mapDiv, {
  camera: {
    target: bounds
  }
});

// Add ground overlay
var groundOverlay = map.addGroundOverlay({
  'url': "../images/newark_nj_1922.jpg",
  'bounds': bounds,
  'opacity': 0.5
});


Listen CLICK event

In order to listen the GROUND_OVERLAY_CLICK event, you need to specify the clickable option. You can get the latitude/longitude pair of clicked position.

var bounds = [
  {"lat": 40.712216, "lng": -74.22655},
  {"lat": 40.773941, "lng": -74.12544}
];

// Add ground overlay
var groundOverlay = map.addGroundOverlay({
  'url': "../images/newark_nj_1922.jpg",
  'bounds': bounds,
  'opacity': 0.5,
  'clickable': true  // default = false
});

// Catch the GROUND_OVERLAY_CLICK event
groundOverlay.on(plugin.google.maps.event.GROUND_OVERLAY_CLICK, function (latLng) {
  ...
});


API Reference

Create

map.addGroundOverlay() Add a ground overlay.

Methods

setBounds() Change the bounds of the GroundOverlay.
getBounds() Return the current center position.
setBearing() Change the bearing of the ground overlay.
getBearing() Return the current bearing value.
setImage() Change the image of the ground overlay
setOpacity() Change the opacity of the ground overlay
getOpacity() Return the current opacity.
setClickable() Change click-ability of the ground overlay.
getClickable() Return true if the ground overlay is clickable.
setVisible() Change visibility of the ground overlay.
getVisible() Return true if the ground overlay is visible.
setZIndex() Change the ground overlay zIndex order.
getZIndex() Return the current ground overlay zIndex.
remove() Remove the ground overlay.

Events

GROUND_OVERLAY_CLICK Arguments: LatLng
This event is fired when you click on a ground overlay.