Interactive interface for browsing global, full-resolution satellite imagery
delete unused image crop and ui info files
Edward Platob6676e3754ca
diff --git a/web/js/image/rubberband.js b/web/js/image/rubberband.jsdeleted file mode 100644index f0690a3b9..000000000--- a/web/js/image/rubberband.js+++ /dev/null@@ -1,270 +0,0 @@-import 'jquery-ui-bundle/jquery-ui';-import 'jquery-jcrop';-import lodashFind from 'lodash/find';-import util from '../util/util';-import wvui from '../ui/ui';-import { imagePanel } from './panel';--const dialogConfig = {- dialogClass: 'wv-panel wv-image',- title: 'Take a snapshot',- show: {- effect: 'slide',- direction: 'up'- },- hide: {- effect: 'slide',- direction: 'up'- },- width: 230,- height: 'auto',- minHeight: 10,- draggable: false,- resizable: false,- autoOpen: false,- closeText: ''-};--const PALETTE_WARNING =- 'One or more layers on the map have been modified (changed palette, ' +- 'thresholds, etc.). These modifications cannot be used to take a ' +- 'snapshot. Would you like to temporarily revert to the original ' +- 'layer(s)?';--const GRATICLE_WARNING =- 'The graticule layer cannot be used to take a snapshot. Would you ' +- 'like to hide this layer?';--const ROTATE_WARNING =- 'Image may not be downloaded when rotated. Would you like to reset rotation?';--export function imageRubberband(models, ui, config) {- var self = {};-- var containerId = 'wv-image-button';- var container;- var selector = '#' + containerId;- var coords = null;- var previousCoords = null;- var $cropee = $('#wv-map'); // TODO: Test on non-canvas- var state = 'off';- var jcropAPI = null;- var previousPalettes = null;- var $button;- var $label;-- self.panel = imagePanel(models, ui, config, dialogConfig);- self.events = util.events();-- /**- * Initializes the RubberBand component.- *- * @this {RubberBand}- */- var init = function() {- var compareModel = models.compare;-- container = document.getElementById(containerId);- if (container === null) {- throw new Error("Error: element '" + containerId + "' not found!");- }- $button = $('<input></input>')- .attr('type', 'checkbox')- .attr('id', 'wv-image-button-check')- .val('');- $label = $('<label></label>')- .attr('for', 'wv-image-button-check')- .attr('title', 'Take a snapshot');- var $icon = $('<i></i>')- .addClass('fa')- .addClass('fa-camera')- .addClass('fa-2x');- $label.append($icon);- $(selector).append($label);- $(selector).append($button);- $button.button({- text: false- });- $button.on('click', toggle);- if (compareModel) {- compareModel.events.on('toggle', toggleButton);- }- toggleButton();- };- var toggleButton = function() {- var compareModel = models.compare;- if (compareModel && compareModel.active) {- $button.button('disable');- $label.attr(- 'title',- 'You must exit comparison mode to use the snapshot feature'- );- } else {- $button.button('enable');- $label.attr('title', 'Take a snapshot');- }- };- var toolbarButtons = function(action) {- $('#wv-info-button input').button(action);- $('#wv-proj-button input').button(action);- $('#wv-link-button input').button(action);- };-- var toggle = function() {- var geographic = models.proj.selected.id === 'geographic';- // Enables UI to select an area on the map while darkening the view- var toggleOn = function() {- state = 'on';- toolbarButtons('disable');- self.panel.show();- $('.ui-dialog').on('dialogclose', function() {- if (state === 'on') {- toggle();- }- document.activeElement.blur();- });- draw();- };- var resetRotation = function() {- ui.map.selected.getView().animate({- rotation: 0,- duration: 400- });- };-- var disablePalettes = function() {- // Save the previous state to be restored later- previousPalettes = models.palettes.active;- models.palettes.clear();- toggle();- };-- var disableGraticle = function() {- models.layers.setVisibility('Graticule', false);- toggle();- };- if (state === 'off') {- var layers = models.layers.get({- renderable: true- });- if (- lodashFind(layers, {- id: 'Graticule'- }) &&- geographic- ) {- wvui.ask({- header: 'Notice',- message: GRATICLE_WARNING,- onOk: disableGraticle,- onCancel: function() {- $button.prop('checked', false).button('refresh');- }- });- return;- }-- // Confirm with the user they want to continue, and if so, disable- // the palettes before bringing up the crop box.- if (models.palettes.inUse()) {- wvui.ask({- header: 'Notice',- message: PALETTE_WARNING,- onOk: disablePalettes,- onCancel: function() {- $button.prop('checked', false).button('refresh');- }- });- return;- }- // Don't toggle area select UI for downloading image if image rotated- if (ui.map.selected.getView().getRotation() === 0.0) {- toggleOn();- } else {- wvui.ask({- header: 'Reset rotation?',- message: ROTATE_WARNING,- onOk: function() {- resetRotation();- setTimeout(toggle, 500); // Let rotation finish before image download can occur- }- });- }- } else {- state = 'off';- $button.prop('checked', false).button('refresh');- $cropee.insertAfter('#productsHolder');- jcropAPI.destroy();- if (geographic) {- ui.map.events.trigger('selectiondone');- } // Should be a changed to a image event- if (previousPalettes) {- models.palettes.restore(previousPalettes);- previousPalettes = null;- }- toolbarButtons('enable');- wvui.closeDialog();- $('.wv-image-coords').hide();- }- };-- /**- * Sets the values for the rubberband (x1, y1, x2, y2, width, height) from the passed "coordinates" object of JCrop *- * @this {RBand}- * @param {String} coordinates object of JCrop- *- */- var setCoords = function(c, panel) {- previousCoords = coords;- coords = c;- self.panel.update(coords);- };-- /**- * Activates the drawing on the map.- *- * @this {RBand}- *- *- */- var draw = function() {- $cropee.Jcrop({- bgColor: 'black',- bgOpacity: 0.3,- onSelect: function(c) {- previousCoords = coords;- handleChange(c);- },- onChange: function(c) {- handleChange(c);- },- onRelease: function(c) {- coords = previousCoords;- toggle();- },- fullScreen: true- });-- jcropAPI = $cropee.data('Jcrop');- if (models.proj.selected.id === 'geographic') {- ui.map.events.trigger('selecting');- } // Should be a changed to a image event- if (coords) {- jcropAPI.setSelect([coords.x, coords.y, coords.x2, coords.y2]);- } else {- jcropAPI.setSelect([- $(window).width() / 2 - 100,- $(window).height() / 2 - 100,- $(window).width() / 2 + 100,- $(window).height() / 2 + 100- ]);- }- };-- var handleChange = function(c) {- setCoords(c);- };-- init();- return self;-}diff --git a/web/js/ui/info.js b/web/js/ui/info.jsdeleted file mode 100644index 3f9a5380e..000000000--- a/web/js/ui/info.js+++ /dev/null@@ -1,143 +0,0 @@-import 'jquery-ui-bundle/jquery-ui';-import wvui from './ui';-import util from '../util/util';-import { feedbackUi } from '../feedback';--export function uiInfo(ui, config) {- var feedbackDialog = feedbackUi();- var selector = '#wv-info-button';- var $button = $('<input />')- .attr('type', 'checkbox')- .attr('id', 'wv-info-button-check');- var $label = $('<label></label>')- .attr('for', 'wv-info-button-check')- .attr('title', 'Information');- var $icon = $('<i></i>')- .addClass('fa')- .addClass('fa-info-circle')- .addClass('fa-2x');- $label.append($icon);- $(selector)- .append($label);- $(selector)- .append($button);-- $button.button({- text: false- });-- $button.click(function(event) {- event.stopPropagation();- wvui.close();- var checked = $('#wv-info-button-check')- .prop('checked');- if (checked) {- show();- }- });-- var show = function() {- var $menu = wvui.getMenu()- .attr('id', 'wv-info-menu');- var $alerts;- var whatsNewUrl = 'https://github.com/nasa-gibs/worldview/releases';- var $menuItems = $('<ul></ul>');- var $feedback = $('<li><a class=\'feedback\' href=\'mailto:@MAIL@?subject=Feedback for @LONG_NAME@ tool\'><i class=\'ui-icon fa fa-envelope fa-fw\'></i>Send Feedback</a></li>');- var $tour = $('<li><a><i class=\'ui-icon fa fa-truck fa-fw\'></i>Explore Worldview</a></li>');- var $about = $('<li><a><i class=\'ui-icon fa fa-file fa-fw\'></i>About</a></li>');- var $source = $('<li><a><i class=\'ui-icon fa fa-code fa-fw\'></i>Source Code</a></li>');- var $new = $('<li><a target=\'_blank\' href=\'' + whatsNewUrl + '\'><i class=\'ui-icon fa fa-flag fa-fw\'></i>What\'s New</a></li>');-- if (config.features.notification) {- $alerts = ui.notification.getAlert();- }- if (config.features.feedback) {- $menuItems.append($feedback);- }- if (config.features.tour && config.stories && config.storyOrder && window.innerWidth >= 740 && window.innerHeight >= 450) {- $menuItems.append($tour);- }- $menuItems.append($source);- $menuItems.append($about);- $menuItems.append($new);- if ($alerts) {- $menuItems.append($alerts);- }- $menuItems.append($about);- $menu.append($menuItems);-- $menuItems.menu();- wvui.positionMenu($menuItems, {- my: 'left top',- at: 'left bottom + 5',- of: $label- });- $menuItems.hide();-- $about.click(function() {- if (util.browser.small) {- window.open('pages/about.html?v=@BUILD_NONCE@', '_blank');- } else {- wvui.getDialog()- .dialog({- title: 'About',- width: 625,- height: 525,- show: {- effect: 'fade'- },- hide: {- effect: 'fade'- },- closeText: ''- })- .load('pages/about.html?v=@BUILD_NONCE@ #page')- .addClass('wv-opaque');- }- });- $source.click(function(e) {- window.open('https://github.com/nasa-gibs/worldview', '_blank');- });-- $feedback.click(function(event) {- event.preventDefault();- feedbackDialog.showFeedback();- });-- $tour.click(function() {- ui.tour.startTour();- });-- $('#wv-toolbar')- .find('input:not(#wv-info-button-check)')- .prop('checked', false)- .button('refresh');- $menuItems.show('slide', {- direction: 'up'- });-- var clickOut = function(event) {- if ($button.parent()- .has(event.target)- .length > 0) {- return;- }- $menuItems.hide();- $('#wv-info-button-check')- .prop('checked', false);- $('#wv-info-button')- .find('label')- .removeClass('ui-state-hover');- $button.button('refresh');- $('body')- .off('click', clickOut)- .off('touchstart', clickOut);- };- $menuItems.on('touchstart', function(event) {- event.stopPropagation();- });- $('html')- .one('click', clickOut)- .one('touchstart', clickOut);- };-};