mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-10 20:09:57 +00:00
Prevent geospatial plugin exception when geomap contains empty geolayer widget (#8484)
* Prevent exception when geomap contains empty geolayer widget * Convert testcase widget into testcase tiddler
This commit is contained in:
parent
5094096a87
commit
9a4aafdb41
@ -0,0 +1,19 @@
|
||||
title: $:/plugins/tiddlywiki/geospatial/tests/widgets/geomap-empty-layer
|
||||
description: Map using geolayer without json and lat/long attributes
|
||||
import: $:/plugins/tiddlywiki/geospatial
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Narrative
|
||||
|
||||
Verify exception reported in [[8452|https://github.com/TiddlyWiki/TiddlyWiki5/issues/8452]] is not thrown when the geolayer widget has no attributes
|
||||
+
|
||||
title: Output
|
||||
|
||||
<$geomap startPosition="bounds">
|
||||
<$geolayer/>
|
||||
</$geomap>
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p><div style="width:100%;height:600px;"></div></p>
|
@ -262,11 +262,13 @@ GeomapWidget.prototype.refreshMap = function() {
|
||||
var bounds = null;
|
||||
$tw.utils.each(this.renderedLayers,function(layer) {
|
||||
var featureBounds = layer.layer.getBounds();
|
||||
if(featureBounds.isValid()) {
|
||||
if(bounds) {
|
||||
bounds.extend(featureBounds);
|
||||
} else {
|
||||
bounds = featureBounds;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(bounds) {
|
||||
this.map.fitBounds(bounds);
|
||||
|
Loading…
Reference in New Issue
Block a user