Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: ui/file_manager/gallery/js/slide_mode.js

Issue 571453002: Correct indentation, JSDoc, etc... to comply with closure linter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | ui/file_manager/image_loader/cache.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Slide mode displays a single image and has a set of controls to navigate 8 * Slide mode displays a single image and has a set of controls to navigate
9 * between the images and to edit an image. 9 * between the images and to edit an image.
10 * 10 *
11 * @param {Element} container Main container element. 11 * @param {Element} container Main container element.
12 * @param {Element} content Content container element. 12 * @param {Element} content Content container element.
13 * @param {Element} toolbar Toolbar element. 13 * @param {Element} toolbar Toolbar element.
14 * @param {ImageEditor.Prompt} prompt Prompt. 14 * @param {ImageEditor.Prompt} prompt Prompt.
15 * @param {cr.ui.ArrayDataModel} dataModel Data model. 15 * @param {cr.ui.ArrayDataModel} dataModel Data model.
16 * @param {cr.ui.ListSelectionModel} selectionModel Selection model. 16 * @param {cr.ui.ListSelectionModel} selectionModel Selection model.
17 * @param {Object} context Context. 17 * @param {Object} context Context.
18 * @param {VolumeManager} volumeManager Volume manager.
18 * @param {function(function())} toggleMode Function to toggle the Gallery mode. 19 * @param {function(function())} toggleMode Function to toggle the Gallery mode.
19 * @param {function(string):string} displayStringFunction String formatting 20 * @param {function(string):string} displayStringFunction String formatting
20 * function. 21 * function.
21 * @constructor 22 * @constructor
22 */ 23 */
23 function SlideMode(container, content, toolbar, prompt, dataModel, 24 function SlideMode(container, content, toolbar, prompt, dataModel,
24 selectionModel, context, volumeManager, toggleMode, displayStringFunction) { 25 selectionModel, context, volumeManager, toggleMode, displayStringFunction) {
25 this.container_ = container; 26 this.container_ = container;
26 this.document_ = container.ownerDocument; 27 this.document_ = container.ownerDocument;
27 this.content = content; 28 this.content = content;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 }; 328 };
328 329
329 /** 330 /**
330 * Leave the mode. 331 * Leave the mode.
331 * @param {Rect} zoomToRect Rectangle for zoom effect. 332 * @param {Rect} zoomToRect Rectangle for zoom effect.
332 * @param {function} callback Called when the image is committed and 333 * @param {function} callback Called when the image is committed and
333 * the zoom-out animation has started. 334 * the zoom-out animation has started.
334 */ 335 */
335 SlideMode.prototype.leave = function(zoomToRect, callback) { 336 SlideMode.prototype.leave = function(zoomToRect, callback) {
336 var commitDone = function() { 337 var commitDone = function() {
337 this.stopEditing_(); 338 this.stopEditing_();
338 this.stopSlideshow_(); 339 this.stopSlideshow_();
339 ImageUtil.setAttribute(this.arrowBox_, 'active', false); 340 ImageUtil.setAttribute(this.arrowBox_, 'active', false);
340 this.selectionModel_.removeEventListener( 341 this.selectionModel_.removeEventListener(
341 'change', this.onSelectionBound_); 342 'change', this.onSelectionBound_);
342 this.dataModel_.removeEventListener('splice', this.onSpliceBound_); 343 this.dataModel_.removeEventListener('splice', this.onSpliceBound_);
343 this.ribbon_.disable(); 344 this.ribbon_.disable();
344 this.active_ = false; 345 this.active_ = false;
345 if (this.savedSelection_) 346 if (this.savedSelection_)
346 this.selectionModel_.selectedIndexes = this.savedSelection_; 347 this.selectionModel_.selectedIndexes = this.savedSelection_;
347 this.unloadImage_(zoomToRect); 348 this.unloadImage_(zoomToRect);
348 callback(); 349 callback();
349 }.bind(this); 350 }.bind(this);
350 351
351 this.viewport_.resetView(); 352 this.viewport_.resetView();
352 if (this.getItemCount_() === 0) { 353 if (this.getItemCount_() === 0) {
353 this.showErrorBanner_(false); 354 this.showErrorBanner_(false);
354 commitDone(); 355 commitDone();
355 } else { 356 } else {
356 this.commitItem_(commitDone); 357 this.commitItem_(commitDone);
357 } 358 }
358 359
359 // Disable the slide-mode only buttons when leaving. 360 // Disable the slide-mode only buttons when leaving.
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 * Max number that the overwrite info bubble is shown. 1027 * Max number that the overwrite info bubble is shown.
1027 * @type {number} 1028 * @type {number}
1028 */ 1029 */
1029 SlideMode.OVERWRITE_BUBBLE_MAX_TIMES = 5; 1030 SlideMode.OVERWRITE_BUBBLE_MAX_TIMES = 5;
1030 1031
1031 /** 1032 /**
1032 * @return {boolean} True if 'Overwrite original' is set. 1033 * @return {boolean} True if 'Overwrite original' is set.
1033 * @private 1034 * @private
1034 */ 1035 */
1035 SlideMode.prototype.shouldOverwriteOriginal_ = function() { 1036 SlideMode.prototype.shouldOverwriteOriginal_ = function() {
1036 return this.overwriteOriginal_.checked; 1037 return this.overwriteOriginal_.checked;
1037 }; 1038 };
1038 1039
1039 /** 1040 /**
1040 * 'Overwrite original' checkbox handler. 1041 * 'Overwrite original' checkbox handler.
1041 * @param {Event} event Event. 1042 * @param {Event} event Event.
1042 * @private 1043 * @private
1043 */ 1044 */
1044 SlideMode.prototype.onOverwriteOriginalClick_ = function(event) { 1045 SlideMode.prototype.onOverwriteOriginalClick_ = function(event) {
1045 var items = {}; 1046 var items = {};
1046 items[SlideMode.OVERWRITE_KEY] = event.target.checked; 1047 items[SlideMode.OVERWRITE_KEY] = event.target.checked;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 * @param {number=} opt_interval Slideshow interval in ms. 1184 * @param {number=} opt_interval Slideshow interval in ms.
1184 * @private 1185 * @private
1185 */ 1186 */
1186 SlideMode.prototype.scheduleNextSlide_ = function(opt_interval) { 1187 SlideMode.prototype.scheduleNextSlide_ = function(opt_interval) {
1187 console.assert(this.isSlideshowPlaying_(), 'Inconsistent slideshow state'); 1188 console.assert(this.isSlideshowPlaying_(), 'Inconsistent slideshow state');
1188 1189
1189 if (this.slideShowTimeout_) 1190 if (this.slideShowTimeout_)
1190 clearTimeout(this.slideShowTimeout_); 1191 clearTimeout(this.slideShowTimeout_);
1191 1192
1192 this.slideShowTimeout_ = setTimeout(function() { 1193 this.slideShowTimeout_ = setTimeout(function() {
1193 this.slideShowTimeout_ = null; 1194 this.slideShowTimeout_ = null;
1194 this.selectNext(1); 1195 this.selectNext(1);
1195 }.bind(this), 1196 }.bind(this), opt_interval || SlideMode.SLIDESHOW_INTERVAL);
1196 opt_interval || SlideMode.SLIDESHOW_INTERVAL);
1197 }; 1197 };
1198 1198
1199 /** 1199 /**
1200 * Resumes the slideshow. 1200 * Resumes the slideshow.
1201 * @param {number=} opt_interval Slideshow interval in ms. 1201 * @param {number=} opt_interval Slideshow interval in ms.
1202 * @private 1202 * @private
1203 */ 1203 */
1204 SlideMode.prototype.resumeSlideshow_ = function(opt_interval) { 1204 SlideMode.prototype.resumeSlideshow_ = function(opt_interval) {
1205 this.container_.setAttribute('slideshow', 'playing'); 1205 this.container_.setAttribute('slideshow', 'playing');
1206 this.scheduleNextSlide_(opt_interval); 1206 this.scheduleNextSlide_(opt_interval);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 /** 1320 /**
1321 * Touch handlers of the slide mode. 1321 * Touch handlers of the slide mode.
1322 * @param {DOMElement} targetElement Event source. 1322 * @param {DOMElement} targetElement Event source.
1323 * @param {SlideMode} slideMode Slide mode to be operated by the handler. 1323 * @param {SlideMode} slideMode Slide mode to be operated by the handler.
1324 * @constructor 1324 * @constructor
1325 */ 1325 */
1326 function TouchHandler(targetElement, slideMode) { 1326 function TouchHandler(targetElement, slideMode) {
1327 /** 1327 /**
1328 * Event source. 1328 * Event source.
1329 * @type {DOMElement} 1329 * @type {DOMElement}
1330 * @private
1330 */ 1331 */
1331 this.targetElement_ = targetElement; 1332 this.targetElement_ = targetElement;
1332 1333
1333 /** 1334 /**
1334 * Target of touch operations. 1335 * Target of touch operations.
1335 * @type {SlideMode} 1336 * @type {SlideMode}
1336 * @private 1337 * @private
1337 */ 1338 */
1338 this.slideMode_ = slideMode; 1339 this.slideMode_ = slideMode;
1339 1340
1340 /** 1341 /**
1341 * Flag to enable/disable touch operation. 1342 * Flag to enable/disable touch operation.
1342 * @type {boolean} 1343 * @type {boolean}
1344 * @private
1343 */ 1345 */
1344 this.enabled_ = true; 1346 this.enabled_ = true;
1345 1347
1346 /** 1348 /**
1347 * Whether it is in a touch operation that is started from targetElement or 1349 * Whether it is in a touch operation that is started from targetElement or
1348 * not. 1350 * not.
1349 * @type {boolean} 1351 * @type {boolean}
1350 * @private 1352 * @private
1351 */ 1353 */
1352 this.touchStarted_ = false; 1354 this.touchStarted_ = false;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 TouchHandler.prototype.onMouseWheel_ = function(event) { 1574 TouchHandler.prototype.onMouseWheel_ = function(event) {
1573 var viewport = this.slideMode_.getViewport(); 1575 var viewport = this.slideMode_.getViewport();
1574 if (!this.enabled_ || !viewport.isZoomed()) 1576 if (!this.enabled_ || !viewport.isZoomed())
1575 return; 1577 return;
1576 this.stopOperation(); 1578 this.stopOperation();
1577 viewport.setOffset( 1579 viewport.setOffset(
1578 viewport.getOffsetX() + event.wheelDeltaX, 1580 viewport.getOffsetX() + event.wheelDeltaX,
1579 viewport.getOffsetY() + event.wheelDeltaY); 1581 viewport.getOffsetY() + event.wheelDeltaY);
1580 this.slideMode_.applyViewportChange(); 1582 this.slideMode_.applyViewportChange();
1581 }; 1583 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | ui/file_manager/image_loader/cache.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698