JAVA BOUND

by septiane28

HTML

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Map Bounds Restriction</title>
    <style>
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var map;
      var BOUNDS = {
        north: -4.294978,
        south: -10.031569,
        west: 105.641410,
        east: 116.788851,
      };
      var SBY = {lat: -7.24917, lng: 112.75083}; //Koordinat SBY

      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: SBY,
          restriction: {
            latLngBounds: BOUNDS,
            strictBounds: false,
          },
          zoom: 7,
        });
      }
    </script>
    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap">
    </script>
  </body>
</html>