Skip to content

Commit 4b595ac

Browse files
Fix issue with MGRS BBox being overridden
- The "if" statements weren't quite right for the model validation, updated to only compare to current value if existing value isn't being updated. - Updated setLatLon to only be called if in latlon mode.
1 parent 70658f5 commit 4b595ac

File tree

1 file changed

+22
-12
lines changed
  • catalog/ui/catalog-ui-search/src/main/webapp/component/location-old

1 file changed

+22
-12
lines changed

catalog/ui/catalog-ui-search/src/main/webapp/component/location-old/location-old.js

+22-12
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,24 @@ define([
2424
var minimumBuffer = 0.000001;
2525

2626
function convertToValid(key, model){
27-
if (key.mapSouth !== undefined && (key.mapSouth >= key.mapNorth || key.mapSouth >= model.get('mapNorth'))){
27+
if (key.mapSouth !== undefined &&
28+
(key.mapSouth >= key.mapNorth ||
29+
(!key.mapNorth && key.mapSouth >= model.get('mapNorth')))){
2830
key.mapSouth = parseFloat((key.mapNorth || model.get('mapNorth'))) - minimumDifference;
2931
}
30-
if (key.mapEast !== undefined && (key.mapEast <= key.mapWest || key.mapEast <= model.get('mapWest'))){
32+
if (key.mapEast !== undefined &&
33+
(key.mapEast <= key.mapWest ||
34+
(!key.mapWest && key.mapEast <= model.get('mapWest')))){
3135
key.mapEast = parseFloat((key.mapWest || model.get('mapWest'))) + minimumDifference;
3236
}
33-
if (key.mapWest !== undefined && (key.mapWest >= key.mapEast || key.mapWest >= model.get('mapEast'))){
37+
if (key.mapWest !== undefined &&
38+
(key.mapWest >= key.mapEast ||
39+
(!key.mapEast && key.mapWest >= model.get('mapEast')))){
3440
key.mapWest = parseFloat((key.mapEast || model.get('mapEast'))) - minimumDifference;
3541
}
36-
if (key.mapNorth !== undefined && (key.mapNorth <= key.mapSouth || key.mapNorth <= model.get('mapSouth'))){
42+
if (key.mapNorth !== undefined &&
43+
(key.mapNorth <= key.mapSouth ||
44+
(!key.mapSouth && key.mapNorth <= model.get('mapSouth')))){
3745
key.mapNorth = parseFloat((key.mapSouth || model.get('mapSouth'))) + minimumDifference;
3846
}
3947
if (key.mapNorth !== undefined){
@@ -144,16 +152,18 @@ define([
144152
},
145153

146154
setLatLon: function () {
147-
var result = {};
148-
result.north = this.get('mapNorth');
149-
result.south = this.get('mapSouth');
150-
result.west = this.get('mapWest');
151-
result.east = this.get('mapEast');
152-
if (!(result.north && result.south && result.west && result.east)) {
153-
result = converter.USNGtoLL(this.get('usngbb'));
155+
if (this.get('locationType') === "latlon") {
156+
var result = {};
157+
result.north = this.get('mapNorth');
158+
result.south = this.get('mapSouth');
159+
result.west = this.get('mapWest');
160+
result.east = this.get('mapEast');
161+
if (!(result.north && result.south && result.west && result.east)) {
162+
result = converter.USNGtoLL(this.get('usngbb'));
154163

164+
}
165+
this.set(result);
155166
}
156-
this.set(result);
157167
},
158168

159169
setFilterBBox: function (model) {

0 commit comments

Comments
 (0)