Interactive interface for browsing global, full-resolution satellite imagery
Disable download icon when request too large #123
Benjamin01b41466c107
diff --git a/web/css/anim.widget.css b/web/css/anim.widget.cssindex e513f1291..406110e7f 100644--- a/web/css/anim.widget.css+++ b/web/css/anim.widget.css@@ -222,6 +222,7 @@-webkit-transform: translate(-50%, -50%);color: #d54e21;position: absolute;+ transition: color 0.5s ease;}.jcrop-tracker .wv-dl-gif-bt-case i:hover {@@ -229,6 +230,12 @@cursor: pointer;}+.jcrop-tracker .wv-dl-gif-bt-case.disabled i,+.jcrop-tracker .wv-dl-gif-bt-case.disabled i:hover {+ cursor: default;+ color: transparent;+ pointer-events: none;+}/* Animation GIF Styles* Slider styles* copied and modified from https://github.com/davidchin/react-input-rangediff --git a/web/css/button.css b/web/css/button.cssindex a19937c6e..7d09afe94 100644--- a/web/css/button.css+++ b/web/css/button.css@@ -13,6 +13,7 @@background-image: -o-linear-gradient(#555, #666);font-family: "Segoe UI", "Arial", sans-serif;padding: 0;+ transition: background 0.5s ease;}.wv-button span {padding: 0.4em 1em;diff --git a/web/js/animation/gif.js b/web/js/animation/gif.jsindex 8ee9450a1..62a664d11 100644--- a/web/js/animation/gif.js+++ b/web/js/animation/gif.js@@ -2,14 +2,17 @@ import $ from 'jquery';import 'jquery-jcrop';import React from 'react';import ReactDOM from 'react-dom';-import wvui from '../ui/ui';+import gifshot from 'gifshot';import lodashFind from 'lodash/find';import lodashEach from 'lodash/each';import lodashRound from 'lodash/round';import lodashIsUndefined from 'lodash/isUndefined';+import lodashThrottle from 'lodash/throttle';+import { GA as googleAnalytics, GifResSelection } from 'worldview-components';import util from '../util/util';+import wvui from '../ui/ui';import uiIndicator from '../ui/indicator';import canvg from 'canvg-browser';@@ -52,6 +55,7 @@ export function animationGif(models, config, ui) {var imgWidth;var imgHeight;var requestSize;+ var throttleSetDownloadButton;var GRATICULE_WARNING ='The graticule layer cannot be used to take a snapshot. Would you ' +'like to hide this layer?';@@ -83,6 +87,8 @@ export function animationGif(models, config, ui) {models.anim.events.on('gif-click', setImageCoords);panelCase = document.createElement('div');panelCase.className = 'gif-dialog';+ throttleSetDownloadButton = lodashThrottle(setDownloadButtonClass, 300, { trailing: true });+options = {resolution: 1,onSelectionChange: onSelectionChange,@@ -132,8 +138,8 @@ export function animationGif(models, config, ui) {}requestSize = calulateFileSize(resolution, lonlats[0], lonlats[1], numDays, imgWidth, imgHeight);-updatePanel(getUpdatedProps());+ throttleSetDownloadButton();};var updatePanel = function(options) {self.reactComponent.setState(options);@@ -144,6 +150,19 @@ export function animationGif(models, config, ui) {var fileSizeValid = function() {return (requestSize < maxGifSize && imgHeight !== 0 && imgWidth !== 0);};+ var setDownloadButtonClass = function() {+ var $iconCase;+ var boo;+ $iconCase = $('.wv-dl-gif-bt-case');+ if (!$iconCase.length) return;+ boo = fileSizeValid();++ if (!boo && !$iconCase.hasClass('disabled')) {+ $iconCase.addClass('disabled');+ } else if (boo && $iconCase.hasClass('disabled')) {+ $iconCase.removeClass('disabled');+ }+ };/** Uses, frameUrl array and gifShot* Library to create GIF