'use strict';

var google = global.google;

function onAdd() {
    var panes = this.getPanes();

    panes.overlayLayer.appendChild(this.el);
}

function positionOverlayByDimensions(projectedLatLng) {
    var offsetHeight = this.el.offsetHeight,
        offsetWidth = this.el.offsetWidth;

    this.el.style.top = projectedLatLng.y - offsetHeight + 'px';
    this.el.style.left = projectedLatLng.x - Math.floor(offsetWidth / 2) + 'px';
}

function draw() {
    var projection = this.getProjection(),
        projectedLatLng = projection.fromLatLngToDivPixel(this.point);

    positionOverlayByDimensions.call(this, projectedLatLng);
}

function BaseOverlay(options) {
    var point = options.point;

    this.el = options.el;
    this.point = new google.maps.LatLng(point.lat, point.lng);

    this.el.style.position = 'absolute';
}

BaseOverlay.prototype = Object.create(google.maps.OverlayView.prototype);
BaseOverlay.prototype.constructor = BaseOverlay;

BaseOverlay.prototype.onAdd = onAdd;
BaseOverlay.prototype.draw = draw;

module.exports = BaseOverlay;

@@ -41,109 +41,8 @@
 e;%0A%0A
-function onAdd() %7B%0A    var panes = this.getPanes();%0A%0A    panes.overlayLayer.appendChild(this.el);%0A%7D%0A%0A
 func
@@ -524,24 +524,125 @@
 LatLng);%0A%7D%0A%0A
+function onAdd() %7B%0A    var panes = this.getPanes();%0A%0A    panes.overlayLayer.appendChild(this.el);%0A%7D%0A%0A
 function Bas

Put private methods on top.