JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script src="http://www.bdcc.co.uk/Gmaps/LatLngToOSGB.js"></script>
<div id="control"></div>
<div id="mapRoute"></div>

CSS

html, body, #mapRoute {
    height: 100%;
    width: 100%;
    margin: 0px;
    padding: 0px
}

JavaScript

var mapRoute;

var rtPoints;
var centerMAP = new google.maps.LatLng(-7.402438, 110.446957);

function gLatLngFromEN(e, n) {
    var ogbLL = NEtoLL(e, n);
    var pc = OGBToWGS84(ogbLL.lat, ogbLL.lon, 0);
    return new google.maps.LatLng(pc.lat, pc.lon);
}

function routeMap() {

    mapRoute = new google.maps.Map(document.getElementById('mapRoute'), {
        center: centerMAP,
        zoom: 14,
        mapTypeId: google.maps.MapTypeId.SATELLITE
    });
    mapRoute.setCenter(gLatLngFromEN(469000, 169000), 13);

    var rtPoints = new Array();
    rtPoints.push(gLatLngFromEN(468000, 168000));
    rtPoints.push(gLatLngFromEN(468000, 170000));
    rtPoints.push(gLatLngFromEN(470000, 170000));
    rtPoints.push(gLatLngFromEN(470000, 168000));
    var rtPoly = new google.maps.Polyline({
        path: rtPoints,
        strokeColor: "#0000FF",
        strokeWeight: 3,
        map: mapRoute
    });
    var container = document.createElement("div");
    container.style.fontFamily = 'Arial';
    container.style.fontSize = 'XX-Small';

    var ptr = document.createElement("INPUT");
    ptr.style.width = "100px";
    ptr.type = "Text";
    ptr.readOnly = true;
    ptr.id = "distPtr";
    container.appendChild(ptr);

    document.getElementById("control").appendChild(container);


    google.maps.event.addListener(mapRoute, 'mousemove', function (point) {
        document.getElementById('distPtr').value = Math.round(bdccGeoDistanceToPolyMtrs(rtPoly, point.latLng));
    });

}

google.maps.event.addDomListener(window, 'load', routeMap);

		
// Code to find the distance in metres between a lat/lng point and a polyline of lat/lng points
// All in WGS84. Free for any use.
//
// Bill Chadwick 2007
// updated to Google Maps API v3, Lawrence Ross 2014
		
		// Construct a bdccGeo from its latitude and longitude in degrees
		function bdccGeo(lat, lon) 
		{
			var theta = (lon * Math.PI / 180.0);
			var rlat = bdccGeoGeocentricLatitude(lat * Math.PI / 180.0);
			var c =...