Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Disable palettes for image download

Mike McGannad9f44d67522
diff --git a/web/js/date/wv.date.anim.js b/web/js/date/wv.date.anim.js
index f1d9054d7..e764b25ef 100644
--- a/web/js/date/wv.date.anim.js
+++ b/web/js/date/wv.date.anim.js
@@ -24,9 +24,7 @@
self.interval = options.interval || "day";
self.delta = options.delta || 1;
self.active = false;
-
var expired = false;
- var loaded = false;
var timer;
var init = function() {
@@ -66,32 +64,22 @@
return;
}
notify("prepare", self);
- loaded = true;
- expired = false;
var amount = ( self.direction === "forward" ) ?
self.delta : -self.delta;
var newDate = wv.util.dateAdd(model.selected, self.interval, amount);
- ui.preload(newDate, function() {
- notify("loaded");
- loaded = true;
- checkFrame(newDate);
- });
+ ui.preload(newDate);
timer = setTimeout(function() {
- notify("expired");
- expired = true;
- checkFrame(newDate);
+ advance(newDate);
}, self.delay);
};
- var checkFrame = function(newDate) {
- if ( loaded && expired ) {
- notify("advance");
- var updated = model.select(newDate);
- if ( !updated ) {
- self.stop();
- } else {
- prepareFrame();
- }
+ var advance = function(newDate) {
+ notify("advance");
+ var updated = model.select(newDate);
+ if ( !updated ) {
+ self.stop();
+ } else {
+ prepareFrame();
}
};
diff --git a/web/js/image/wv.image.rubberband.js b/web/js/image/wv.image.rubberband.js
index a6b7ac16e..fd77a6c76 100644
--- a/web/js/image/wv.image.rubberband.js
+++ b/web/js/image/wv.image.rubberband.js
@@ -88,24 +88,12 @@ wv.image.rubberband = wv.image.rubberband || function(models, ui, config) {
draw();
};
- // When disabling the palettes, we need to wait for the map to reload all
- // the tiles before enabling the crop box. The crop box copies all
- // elements in the map to do its background effect and if the map isn't
- // ready yet, it will copy blank images.
var disablePalettes = function() {
var map = ui.map.selected;
- var handler = function() {
- map.events.unregister("maploadend", map, handler);
- toggleOn();
- };
- map.events.register("maploadend", map, handler);
-
// Save the previous state to be restored later
previousPalettes = models.palettes.active;
models.palettes.clear();
- if ( !ui.map.isLoading() ) {
- handler();
- }
+ toggleOn();
};
if(state == "off") {
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index 02c9d2e18..0099b803c 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -47,7 +47,8 @@ wv.map.ui = wv.map.ui || function(models, config) {
models.palettes.events
.on("set-custom", updateLookup)
.on("clear-custom", updateLookup)
- .on("range", updateLookup);
+ .on("range", updateLookup)
+ .on("update", updateLookup);
updateProjection(true);
};