mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
fix coordinate search with / symbol (#10879)
This commit is contained in:
@@ -214,6 +214,14 @@ export function dmsMatcher(q, _localeCode = undefined) {
|
||||
return [isNegLat, isNegLng];
|
||||
}
|
||||
},
|
||||
// D/D ex: 46.112785/72.921033
|
||||
{
|
||||
condition: /^\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
|
||||
parser: function(q) {
|
||||
const match = this.condition.exec(q);
|
||||
return [+match[1], +match[2]];
|
||||
}
|
||||
},
|
||||
// zoom/x/y ex: 2/1.23/34.44
|
||||
{
|
||||
condition: /^\s*(\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('iD.units', function() {
|
||||
expect(result[2]).to.eql(2);
|
||||
});
|
||||
it('parses x/y coordinate', () => {
|
||||
var result = iD.dmsMatcher('-1.23/34.44');
|
||||
var result = iD.dmsMatcher('-1.23/34.44', 'de');
|
||||
expect(result[0]).to.be.closeTo(-1.23, 0.00001);
|
||||
expect(result[1]).to.be.closeTo(34.44, 0.00001);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user