JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<div class="fluid-wrapper">
<div id="map-canvas"></div>
<canvas id="activity-reach"></canvas>
</div>
CSS
.fluid-wrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
height: 0;
}
#map-canvas, #activity-reach{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
}
#activity-reach{
z-index: 1;
pointer-events:none;
}
JavaScript
var mapReach = {
init: function(mapId, canvasId) {
var myLatlng = new google.maps.LatLng(30,0); // Add the coordinates
var mapOptions = {
zoom: 3,
minZoom: 1,
maxZoom: 17,
zoomControl:true,
zoomControlOptions: {
style:google.maps.ZoomControlStyle.DEFAULT
},
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: false,
mapTypeControl:false,
scaleControl:false,
streetViewControl:false,
overviewMapControl:false,
rotateControl:false
};
var mapStyles = [
{
"featureType": "landscape.natural",
"stylers": [
{ "visibility": "on" },
{ "color": "#08304b" }
]
},{
"featureType": "water",
"stylers": [
{ "color": "#011018" }
]
},{
"featureType": "administrative.country",
"elementType": "geometry",
"stylers": [
{ "visibility": "on" },
{ "weight": 0.5 },
{ "color": "#124b5e" }
]
},{
"featureType": "administrative",
"stylers": [
{ "weight": 0.1 },
{ "color": "#ffffff" },
{ "visibility": "on" }
]
},{
"featureType": "administrative.province",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "landscape.natural.terrain",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "poi",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "administrative.locality",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "road",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "administrative.neighborhood",
"stylers": [
{ "visibility": "off" }
]
}
];
this.map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); // Render our map within the empty div
this.map.setOptions({styles: mapStyles});
this.nodes = [];
this.$mapCanvas = $('#'+...