Fix circle radius if L.CRS.Simple has inverted x axis (#9414)

Co-authored-by: Jerry Lin <jerrylin2488@gmail.com>
Co-authored-by: Aaron Sharif <aaronsharif62@gmail.com>
Co-authored-by: Florian Bischof <design.falke@gmail.com>
This commit is contained in:
Beren Akpinar
2025-03-01 03:34:00 -05:00
committed by GitHub
parent cb315e4527
commit d1d4d17a53
2 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,5 @@
import {expect} from 'chai';
import {Circle, Map} from 'leaflet';
import {Circle, Map, Util, CRS, Transformation} from 'leaflet';
import {createContainer, removeMapContainer} from '../../SpecHelper.js';
describe('Circle', () => {
@ -47,4 +47,22 @@ describe('Circle', () => {
expect(bounds.getNorthEast()).nearLatLng([50.00179, 30.00279]);
});
});
describe('CRS Simple', () => {
it('returns a positive radius if the x axis of L.CRS.Simple is inverted', () => {
map.remove();
const crs = Util.extend(CRS.Simple, {
transformation: new Transformation(-1, 0, -1, 0),
});
map = new Map(container, {
crs
});
map.setView([0, 0], 4);
const circle = new Circle([0, 0], {radius: 200}).addTo(map);
expect(circle._radius).to.eql(3200);
});
});
});