loleaflet: ensure visible element before getting bounds
Change-Id: Iae66d8d52f4d97b61d861586e5a008c18d15e39d
This commit is contained in:
parent
f3700400e6
commit
a759a01c7d
2 changed files with 3 additions and 2 deletions
|
@ -129,6 +129,7 @@ L.AnnotationManager = L.Class.extend({
|
|||
if (this._selected.annotation) {
|
||||
point = L.point(topRight.x, this._map._docLayer._twipsToPixels(this._selected.annotation._data.anchorPos.min).y);
|
||||
this._selected.annotation.setLatLng(this._map.unproject(point));
|
||||
this._selected.annotation.show();
|
||||
bounds = this._selected.annotation.getBounds();
|
||||
bounds.extend(bounds.min.subtract([0, this.options.marginY]));
|
||||
bounds.extend(bounds.getBottomLeft().add([0, this.options.marginY]));
|
||||
|
@ -143,6 +144,7 @@ L.AnnotationManager = L.Class.extend({
|
|||
point = L.point(topRight.x, this._map._docLayer._twipsToPixels(annotation._data.anchorPos.min).y);
|
||||
latlng = this._map.unproject(point);
|
||||
annotation.setLatLng(latlng);
|
||||
annotation.show();
|
||||
bounds = annotation.getBounds();
|
||||
foundBounds = null;
|
||||
for (var itBounds in layouts) {
|
||||
|
@ -180,7 +182,6 @@ L.AnnotationManager = L.Class.extend({
|
|||
}
|
||||
|
||||
annotation.setLatLng(latlng);
|
||||
annotation.show();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -126,9 +126,9 @@ L.ImpressTileLayer = L.TileLayer.extend({
|
|||
annotation = annotations[index];
|
||||
if (index >= this._topAnnotation) {
|
||||
annotation.setLatLng(bounds ? this._map.layerPointToLatLng(bounds.getBottomLeft()) : this._map.layerPointToLatLng(topRight));
|
||||
annotation.show();
|
||||
bounds = annotation.getBounds();
|
||||
bounds.extend(L.point(bounds.max.x, bounds.max.y + this.options.marginY));
|
||||
annotation.show();
|
||||
} else {
|
||||
annotation.hide();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue