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

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

Issue 1255143003: Gallery.app: make edit button toggleable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix failed test cases. Created 5 years, 4 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
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 /** 5 /**
6 * Slide mode displays a single image and has a set of controls to navigate 6 * Slide mode displays a single image and has a set of controls to navigate
7 * between the images and to edit an image. 7 * between the images and to edit an image.
8 * 8 *
9 * @param {!HTMLElement} container Main container element. 9 * @param {!HTMLElement} container Main container element.
10 * @param {!HTMLElement} content Content container element. 10 * @param {!HTMLElement} content Content container element.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 this.selectionModel_, thumbnailModel); 331 this.selectionModel_, thumbnailModel);
332 this.ribbonSpacer_.appendChild(this.ribbon_); 332 this.ribbonSpacer_.appendChild(this.ribbon_);
333 333
334 util.createChild(this.container_, 'spinner'); 334 util.createChild(this.container_, 'spinner');
335 335
336 /** 336 /**
337 * @type {!HTMLElement} 337 * @type {!HTMLElement}
338 * @const 338 * @const
339 */ 339 */
340 var slideShowButton = queryRequiredElement(this.topToolbar_, 340 var slideShowButton = queryRequiredElement(this.topToolbar_,
341 '.button.slideshow'); 341 'paper-button.slideshow');
342 slideShowButton.addEventListener('click', 342 slideShowButton.addEventListener('click',
343 this.startSlideshow.bind(this, SlideMode.SLIDESHOW_INTERVAL_FIRST)); 343 this.startSlideshow.bind(this, SlideMode.SLIDESHOW_INTERVAL_FIRST));
344 344
345 /** 345 /**
346 * @type {!HTMLElement} 346 * @type {!HTMLElement}
347 * @const 347 * @const
348 */ 348 */
349 var slideShowToolbar = util.createChild( 349 var slideShowToolbar = util.createChild(
350 this.container_, 'tool slideshow-toolbar'); 350 this.container_, 'tool slideshow-toolbar');
351 util.createChild(slideShowToolbar, 'slideshow-play'). 351 util.createChild(slideShowToolbar, 'slideshow-play').
352 addEventListener('click', this.toggleSlideshowPause_.bind(this)); 352 addEventListener('click', this.toggleSlideshowPause_.bind(this));
353 util.createChild(slideShowToolbar, 'slideshow-end'). 353 util.createChild(slideShowToolbar, 'slideshow-end').
354 addEventListener('click', this.stopSlideshow_.bind(this)); 354 addEventListener('click', this.stopSlideshow_.bind(this));
355 355
356 // Editor. 356 // Editor.
357 /** 357 /**
358 * @type {!HTMLElement} 358 * @type {!HTMLElement}
359 * @private 359 * @private
360 * @const 360 * @const
361 */ 361 */
362 this.editButton_ = queryRequiredElement(this.topToolbar_, '.button.edit'); 362 this.editButton_ = queryRequiredElement(this.topToolbar_, 'button.edit');
363 this.editButton_.addEventListener('click', this.toggleEditor.bind(this)); 363 this.editButton_.addEventListener('click', this.toggleEditor.bind(this));
364 364
365 /** 365 /**
366 * @private {!FilesToggleRipple}
367 * @const
368 */
369 this.editButtonToggleRipple_ = /** @type {!FilesToggleRipple} */
370 (assert(this.editButton_.querySelector('files-toggle-ripple')));
371
372 /**
366 * @type {!HTMLElement} 373 * @type {!HTMLElement}
367 * @private 374 * @private
368 * @const 375 * @const
369 */ 376 */
370 this.printButton_ = queryRequiredElement(this.topToolbar_, '.button.print'); 377 this.printButton_ = queryRequiredElement(
378 this.topToolbar_, 'paper-button.print');
371 this.printButton_.addEventListener('click', this.print_.bind(this)); 379 this.printButton_.addEventListener('click', this.print_.bind(this));
372 380
373 /** 381 /**
374 * @type {!HTMLElement} 382 * @type {!HTMLElement}
375 * @private 383 * @private
376 * @const 384 * @const
377 */ 385 */
378 this.editBarSpacer_ = queryRequiredElement(this.bottomToolbar_, 386 this.editBarSpacer_ = queryRequiredElement(this.bottomToolbar_,
379 '.edit-bar-spacer'); 387 '.edit-bar-spacer');
380 388
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 cr.dispatchSimpleEvent(this, 'useraction'); 1525 cr.dispatchSimpleEvent(this, 'useraction');
1518 1526
1519 if (!this.active_) { 1527 if (!this.active_) {
1520 this.toggleMode_(this.toggleEditor.bind(this)); 1528 this.toggleMode_(this.toggleEditor.bind(this));
1521 return; 1529 return;
1522 } 1530 }
1523 1531
1524 this.stopSlideshow_(); 1532 this.stopSlideshow_();
1525 1533
1526 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing()); 1534 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing());
1535 this.editButtonToggleRipple_.activated = this.isEditing();
1527 1536
1528 if (this.isEditing()) { // isEditing has just been flipped to a new value. 1537 if (this.isEditing()) { // isEditing has just been flipped to a new value.
1529 // Reset zoom. 1538 // Reset zoom.
1530 this.viewport_.resetView(); 1539 this.viewport_.resetView();
1531 this.imageView_.applyViewportChange(); 1540 this.imageView_.applyViewportChange();
1532 if (this.context_.readonlyDirName) { 1541 if (this.context_.readonlyDirName) {
1533 this.editor_.getPrompt().showAt( 1542 this.editor_.getPrompt().showAt(
1534 'top', 'GALLERY_READONLY_WARNING', 0, this.context_.readonlyDirName); 1543 'top', 'GALLERY_READONLY_WARNING', 0, this.context_.readonlyDirName);
1535 } 1544 }
1536 this.touchHandlers_.enabled = false; 1545 this.touchHandlers_.enabled = false;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 var event = assertInstanceof(event, MouseEvent); 1852 var event = assertInstanceof(event, MouseEvent);
1844 var viewport = this.slideMode_.getViewport(); 1853 var viewport = this.slideMode_.getViewport();
1845 if (!this.enabled_ || !viewport.isZoomed()) 1854 if (!this.enabled_ || !viewport.isZoomed())
1846 return; 1855 return;
1847 this.stopOperation(); 1856 this.stopOperation();
1848 viewport.setOffset( 1857 viewport.setOffset(
1849 viewport.getOffsetX() + event.wheelDeltaX, 1858 viewport.getOffsetX() + event.wheelDeltaX,
1850 viewport.getOffsetY() + event.wheelDeltaY); 1859 viewport.getOffsetY() + event.wheelDeltaY);
1851 this.slideMode_.applyViewportChange(); 1860 this.slideMode_.applyViewportChange();
1852 }; 1861 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/gallery.js ('k') | ui/file_manager/integration_tests/gallery/photo_editor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698