Interactive interface for browsing global, full-resolution satellite imagery
prevent dateline updates for sudbaily date change
Edward Plato9875f9b565a4
diff --git a/web/js/map/datelinebuilder.js b/web/js/map/datelinebuilder.jsindex 78ee28795..d0a83a339 100644--- a/web/js/map/datelinebuilder.js+++ b/web/js/map/datelinebuilder.js@@ -22,6 +22,8 @@ var map,export function mapDateLineBuilder(models, config, store, ui) {var self = {};+ // formatted YYYY-MM-DD (e.g., 2019-06-25) for checking daily change for dateline+ self.date = {};/** Sets globals and event listeners*@@ -46,7 +48,11 @@ export function mapDateLineBuilder(models, config, store, ui) {const state = store.getState();const selectedDateStr = state.compare.isCompareA ? 'selected' : 'selectedB';const date = state.date[selectedDateStr];- return updateDate(date);+ const isNewDay = compareDateStrings(date);+ if (isNewDay) {+ return updateDate(date);+ }+ break;case CHANGE_PROJECTION:proj = action.id;}@@ -55,6 +61,7 @@ export function mapDateLineBuilder(models, config, store, ui) {var dimensions;map = olMap;drawDatelines(map, date);+ self.date = date.toISOString().split('T')[0];proj = store.getState().proj.id;Parent.events.on('moveend', function() {@@ -387,5 +394,26 @@ export function mapDateLineBuilder(models, config, store, ui) {return overlay;};+ /*+ * Check if YYYY-MM-DD changed or a subdaily drag occurred+ * to determine if new date lines are needed+ *+ * @method compareDateStrings+ * @private+ *+ * @param {object} date+ *+ * @sets {string} self.date - if new date+ * @returns {boolean}+ */+ const compareDateStrings = (date) => {+ const dateString = date.toISOString().split('T')[0];+ if (dateString !== self.date) {+ self.date = dateString;+ return true;+ }+ return false;+ };+return self;}