1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-21 03:39:43 +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:
btheado 2024-08-30 09:21:46 -04:00 committed by GitHub
parent 5094096a87
commit 9a4aafdb41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 4 deletions

View File

@ -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>

View File

@ -262,10 +262,12 @@ GeomapWidget.prototype.refreshMap = function() {
var bounds = null;
$tw.utils.each(this.renderedLayers,function(layer) {
var featureBounds = layer.layer.getBounds();
if(bounds) {
bounds.extend(featureBounds);
} else {
bounds = featureBounds;
if(featureBounds.isValid()) {
if(bounds) {
bounds.extend(featureBounds);
} else {
bounds = featureBounds;
}
}
});
if(bounds) {