javalent / obsidian-leaflet

Adds interactive maps to Obsidian.md using Leaflet.js
481 stars 29 forks source link

[Regression]: Can't center a map on custom coordinates #373

Closed Sirs0ri closed 1 year ago

Sirs0ri commented 1 year ago

The bug tracker is ONLY used for reporting bugs.

Version Check

Obsidian: 1.1.16 Installer: 1.1.9 OS: Win10 Leaflet: 5.5.5

Since 5.5.5 and the fix for #362 The plugin ignores custom coordinates, such as these:

```leaflet
id: test
lat: 0
long: 0
```

The fix (commit deff0a810ca5416e885feace4b0bebc62eeb5128) changed the logic checking for missing coordinates from a falsy-check of the original value to an negated isNaN() check. Due to the negation, the defaults will be used if the submitted value is not NaN, ie if it is a valid number.

What is the expected behavior?

The map created with the above snippet should be centered around the coordinates [0, 0]

What is the current behavior?

The map is centered around my default coordinates, as defined in the settings.

What are the A-to-Z Steps to Reproduce your Bug?

  1. Add the code snippet listed in the general description into any note.

Error Codes

Screenshots and Video