Skip to content

Commit 324891d

Browse files
vlt1Tobia Di Pisa
authored andcommitted
Fix #4055 ZoomToMaxExtent button switch CRS (#4135) (#4137)
* Changed zoomToInitialExtent to use current CRS * Updated tests to use different projections (cherry picked from commit c4a96ae)
1 parent d5ef014 commit 324891d

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

web/client/components/buttons/ZoomToMaxExtentButton.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class ZoomToMaxExtentButton extends React.Component {
120120
// zooming to the initial extent based on initial map configuration
121121
var mapConfig = this.props.mapInitialConfig;
122122
let bbox = mapUtils.getBbox(mapConfig.center, mapConfig.zoom, this.props.mapConfig.size);
123-
this.props.changeMapView(mapConfig.center, mapConfig.zoom, bbox, this.props.mapConfig.size, null, mapConfig.projection);
123+
this.props.changeMapView(mapConfig.center, mapConfig.zoom, bbox, this.props.mapConfig.size, null, this.props.mapConfig.projection);
124124
};
125125
}
126126

web/client/components/buttons/__tests__/ZoomToMaxExtentButton-test.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe('This test for ZoomToMaxExtentButton', () => {
145145

146146
it('test zoom to initial extent', () => {
147147

148-
let genericTest = function(btnType) {
148+
let genericTest = function(btnType, projection) {
149149
let actions = {
150150
changeMapView: (c, z, mb, ms) => {
151151
return {c, z, mb, ms};
@@ -160,7 +160,8 @@ describe('This test for ZoomToMaxExtentButton', () => {
160160
size: {
161161
height: 100,
162162
width: 100
163-
}
163+
},
164+
projection: projection
164165
}}
165166
mapInitialConfig={{
166167
zoom: 10,
@@ -194,10 +195,12 @@ describe('This test for ZoomToMaxExtentButton', () => {
194195
expect(actionsSpy.calls[0].arguments[2]).toNotExist();
195196
expect(actionsSpy.calls[0].arguments[3]).toExist();
196197
expect(actionsSpy.calls[0].arguments[4]).toNotExist();
197-
expect(actionsSpy.calls[0].arguments[5]).toExist();
198+
expect(actionsSpy.calls[0].arguments[5]).toEqual(projection);
198199
};
199200

200-
genericTest("normal");
201-
genericTest("image");
201+
genericTest("normal", "EPSG:900913");
202+
genericTest("normal", "EPSG:4326");
203+
genericTest("image", "EPSG:900913");
204+
genericTest("image", "EPSG:4326");
202205
});
203206
});

0 commit comments

Comments
 (0)