re-draw on update and apply opacity

This commit is contained in:
Jakob Ketterl 2019-09-19 16:24:04 +02:00
parent ecbae5af2d
commit cf273021ab

View File

@ -5,6 +5,7 @@ AprsMarker.prototype = new google.maps.OverlayView();
AprsMarker.prototype.draw = function() {
var div = this.div;
var overlay = this.overlay;
if (!div || !overlay) return;
if (this.symbol) {
var tableId = this.symbol.table == '/' ? 0 : 1;
@ -32,6 +33,12 @@ AprsMarker.prototype.draw = function() {
overlay.style.display = 'none';
}
if (this.opacity) {
div.style.opacity = this.opacity;
} else {
div.style.opacity = null;
}
var point = this.getProjection().fromLatLngToDivPixel(this.position);
if (point) {
@ -40,6 +47,11 @@ AprsMarker.prototype.draw = function() {
}
};
AprsMarker.prototype.setOptions = function(options) {
google.maps.OverlayView.prototype.setOptions.apply(this, arguments);
this.draw();
};
AprsMarker.prototype.onAdd = function() {
var div = this.div = document.createElement('div');
@ -65,7 +77,7 @@ AprsMarker.prototype.onAdd = function() {
var panes = this.getPanes();
panes.overlayImage.appendChild(div);
}
};
AprsMarker.prototype.remove = function() {
if (this.div) {
@ -76,4 +88,4 @@ AprsMarker.prototype.remove = function() {
AprsMarker.prototype.getAnchorPoint = function() {
return new google.maps.Point(0, -12);
}
};