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

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

Issue 1170403005: Revert of Gallery: Add toolbar at the top of window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/gallery.js ('k') | no next file » | 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 /** 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.
11 * @param {!HTMLElement} topToolbar Top toolbar element. 11 * @param {!HTMLElement} toolbar Toolbar element.
12 * @param {!HTMLElement} bottomToolbar Toolbar element.
13 * @param {!ImageEditor.Prompt} prompt Prompt. 12 * @param {!ImageEditor.Prompt} prompt Prompt.
14 * @param {!ErrorBanner} errorBanner Error banner. 13 * @param {!ErrorBanner} errorBanner Error banner.
15 * @param {!cr.ui.ArrayDataModel} dataModel Data model. 14 * @param {!cr.ui.ArrayDataModel} dataModel Data model.
16 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model. 15 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model.
17 * @param {!MetadataModel} metadataModel 16 * @param {!MetadataModel} metadataModel
18 * @param {!ThumbnailModel} thumbnailModel 17 * @param {!ThumbnailModel} thumbnailModel
19 * @param {!Object} context Context. 18 * @param {!Object} context Context.
20 * @param {!VolumeManagerWrapper} volumeManager Volume manager. 19 * @param {!VolumeManagerWrapper} volumeManager Volume manager.
21 * @param {function(function())} toggleMode Function to toggle the Gallery mode. 20 * @param {function(function())} toggleMode Function to toggle the Gallery mode.
22 * @param {function(string):string} displayStringFunction String formatting 21 * @param {function(string):string} displayStringFunction String formatting
23 * function. 22 * function.
24 * @constructor 23 * @constructor
25 * @struct 24 * @struct
26 * @suppress {checkStructDictInheritance} 25 * @suppress {checkStructDictInheritance}
27 * @extends {cr.EventTarget} 26 * @extends {cr.EventTarget}
28 */ 27 */
29 function SlideMode(container, content, topToolbar, bottomToolbar, prompt, 28 function SlideMode(container, content, toolbar, prompt, errorBanner, dataModel,
30 errorBanner, dataModel, selectionModel, metadataModel, thumbnailModel, 29 selectionModel, metadataModel, thumbnailModel, context, volumeManager,
31 context, volumeManager, toggleMode, displayStringFunction) { 30 toggleMode, displayStringFunction) {
32 /** 31 /**
33 * @type {!HTMLElement} 32 * @type {!HTMLElement}
34 * @private 33 * @private
35 * @const 34 * @const
36 */ 35 */
37 this.container_ = container; 36 this.container_ = container;
38 37
39 /** 38 /**
40 * @type {!Document} 39 * @type {!Document}
41 * @private 40 * @private
42 * @const 41 * @const
43 */ 42 */
44 this.document_ = assert(container.ownerDocument); 43 this.document_ = assert(container.ownerDocument);
45 44
46 /** 45 /**
47 * @type {!HTMLElement} 46 * @type {!HTMLElement}
48 * @const 47 * @const
49 */ 48 */
50 this.content = content; 49 this.content = content;
51 50
52 /** 51 /**
53 * @type {!HTMLElement} 52 * @type {!HTMLElement}
54 * @private 53 * @private
55 * @const 54 * @const
56 */ 55 */
57 this.topToolbar_ = topToolbar; 56 this.toolbar_ = toolbar;
58
59 /**
60 * @type {!HTMLElement}
61 * @private
62 * @const
63 */
64 this.bottomToolbar_ = bottomToolbar;
65 57
66 /** 58 /**
67 * @type {!ImageEditor.Prompt} 59 * @type {!ImageEditor.Prompt}
68 * @private 60 * @private
69 * @const 61 * @const
70 */ 62 */
71 this.prompt_ = prompt; 63 this.prompt_ = prompt;
72 64
73 /** 65 /**
74 * @type {!ErrorBanner} 66 * @type {!ErrorBanner}
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 212
221 this.document_.addEventListener('click', this.onDocumentClick_.bind(this)); 213 this.document_.addEventListener('click', this.onDocumentClick_.bind(this));
222 214
223 /** 215 /**
224 * Overwrite options and info bubble. 216 * Overwrite options and info bubble.
225 * @type {!HTMLElement} 217 * @type {!HTMLElement}
226 * @private 218 * @private
227 * @const 219 * @const
228 */ 220 */
229 this.options_ = util.createChild(queryRequiredElement( 221 this.options_ = util.createChild(queryRequiredElement(
230 this.topToolbar_, '.filename-spacer'), 'options'); 222 this.toolbar_, '.filename-spacer'), 'options');
231 223
232 /** 224 /**
233 * @type {!HTMLElement} 225 * @type {!HTMLElement}
234 * @private 226 * @private
235 * @const 227 * @const
236 */ 228 */
237 this.savedLabel_ = util.createChild(this.options_, 'saved'); 229 this.savedLabel_ = util.createChild(this.options_, 'saved');
238 this.savedLabel_.textContent = this.displayStringFunction_('GALLERY_SAVED'); 230 this.savedLabel_.textContent = this.displayStringFunction_('GALLERY_SAVED');
239 231
240 /** 232 /**
(...skipping 30 matching lines...) Expand all
271 this.overwriteOriginalBox_, '', 'label'); 263 this.overwriteOriginalBox_, '', 'label');
272 overwriteLabel.textContent = 264 overwriteLabel.textContent =
273 this.displayStringFunction_('GALLERY_OVERWRITE_ORIGINAL'); 265 this.displayStringFunction_('GALLERY_OVERWRITE_ORIGINAL');
274 overwriteLabel.setAttribute('for', 'overwrite-checkbox'); 266 overwriteLabel.setAttribute('for', 'overwrite-checkbox');
275 267
276 /** 268 /**
277 * @type {!HTMLElement} 269 * @type {!HTMLElement}
278 * @private 270 * @private
279 * @const 271 * @const
280 */ 272 */
281 this.bubble_ = util.createChild(this.bottomToolbar_, 'bubble'); 273 this.bubble_ = util.createChild(this.toolbar_, 'bubble');
282 this.bubble_.hidden = true; 274 this.bubble_.hidden = true;
283 275
284 /** 276 /**
285 * @type {!HTMLElement} 277 * @type {!HTMLElement}
286 * @const 278 * @const
287 */ 279 */
288 var bubbleContent = util.createChild(this.bubble_); 280 var bubbleContent = util.createChild(this.bubble_);
289 bubbleContent.innerHTML = this.displayStringFunction_( 281 bubbleContent.innerHTML = this.displayStringFunction_(
290 'GALLERY_OVERWRITE_BUBBLE'); 282 'GALLERY_OVERWRITE_BUBBLE');
291 283
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 this.arrowBox_, 'arrow right tool dimmable'); 320 this.arrowBox_, 'arrow right tool dimmable');
329 this.arrowRight_.addEventListener('click', 321 this.arrowRight_.addEventListener('click',
330 this.advanceManually.bind(this, 1)); 322 this.advanceManually.bind(this, 1));
331 util.createChild(this.arrowRight_); 323 util.createChild(this.arrowRight_);
332 324
333 /** 325 /**
334 * @type {!HTMLElement} 326 * @type {!HTMLElement}
335 * @private 327 * @private
336 * @const 328 * @const
337 */ 329 */
338 this.ribbonSpacer_ = queryRequiredElement(this.bottomToolbar_, 330 this.ribbonSpacer_ = queryRequiredElement(this.toolbar_, '.ribbon-spacer');
339 '.ribbon-spacer');
340 331
341 /** 332 /**
342 * @type {!Ribbon} 333 * @type {!Ribbon}
343 * @private 334 * @private
344 * @const 335 * @const
345 */ 336 */
346 this.ribbon_ = new Ribbon( 337 this.ribbon_ = new Ribbon(
347 this.document_, this.dataModel_, this.selectionModel_, thumbnailModel); 338 this.document_, this.dataModel_, this.selectionModel_, thumbnailModel);
348 this.ribbonSpacer_.appendChild(this.ribbon_); 339 this.ribbonSpacer_.appendChild(this.ribbon_);
349 340
350 util.createChild(this.container_, 'spinner'); 341 util.createChild(this.container_, 'spinner');
351 342
352 /** 343 /**
353 * @type {!HTMLElement} 344 * @type {!HTMLElement}
354 * @const 345 * @const
355 */ 346 */
356 var slideShowButton = queryRequiredElement(this.topToolbar_, 347 var slideShowButton = queryRequiredElement(this.toolbar_, 'button.slideshow');
357 'button.slideshow');
358 slideShowButton.title = this.displayStringFunction_('GALLERY_SLIDESHOW'); 348 slideShowButton.title = this.displayStringFunction_('GALLERY_SLIDESHOW');
359 slideShowButton.addEventListener('click', 349 slideShowButton.addEventListener('click',
360 this.startSlideshow.bind(this, SlideMode.SLIDESHOW_INTERVAL_FIRST)); 350 this.startSlideshow.bind(this, SlideMode.SLIDESHOW_INTERVAL_FIRST));
361 351
362 /** 352 /**
363 * @type {!HTMLElement} 353 * @type {!HTMLElement}
364 * @const 354 * @const
365 */ 355 */
366 var slideShowToolbar = util.createChild( 356 var slideShowToolbar = util.createChild(
367 this.container_, 'tool slideshow-toolbar'); 357 this.container_, 'tool slideshow-toolbar');
368 util.createChild(slideShowToolbar, 'slideshow-play'). 358 util.createChild(slideShowToolbar, 'slideshow-play').
369 addEventListener('click', this.toggleSlideshowPause_.bind(this)); 359 addEventListener('click', this.toggleSlideshowPause_.bind(this));
370 util.createChild(slideShowToolbar, 'slideshow-end'). 360 util.createChild(slideShowToolbar, 'slideshow-end').
371 addEventListener('click', this.stopSlideshow_.bind(this)); 361 addEventListener('click', this.stopSlideshow_.bind(this));
372 362
373 // Editor. 363 // Editor.
374 /** 364 /**
375 * @type {!HTMLElement} 365 * @type {!HTMLElement}
376 * @private 366 * @private
377 * @const 367 * @const
378 */ 368 */
379 this.editButton_ = queryRequiredElement(this.topToolbar_, 'button.edit'); 369 this.editButton_ = queryRequiredElement(this.toolbar_, 'button.edit');
380 this.editButton_.title = this.displayStringFunction_('GALLERY_EDIT'); 370 this.editButton_.title = this.displayStringFunction_('GALLERY_EDIT');
381 this.editButton_.disabled = true; // Disabled by default. 371 this.editButton_.disabled = true; // Disabled by default.
382 this.editButton_.addEventListener('click', this.toggleEditor.bind(this)); 372 this.editButton_.addEventListener('click', this.toggleEditor.bind(this));
383 373
384 /** 374 /**
385 * @type {!HTMLElement} 375 * @type {!HTMLElement}
386 * @private 376 * @private
387 * @const 377 * @const
388 */ 378 */
389 this.printButton_ = queryRequiredElement(this.topToolbar_, 'button.print'); 379 this.printButton_ = queryRequiredElement(this.toolbar_, 'button.print');
390 this.printButton_.title = this.displayStringFunction_('GALLERY_PRINT'); 380 this.printButton_.title = this.displayStringFunction_('GALLERY_PRINT');
391 this.printButton_.disabled = true; // Disabled by default. 381 this.printButton_.disabled = true; // Disabled by default.
392 this.printButton_.addEventListener('click', this.print_.bind(this)); 382 this.printButton_.addEventListener('click', this.print_.bind(this));
393 383
394 /** 384 /**
395 * @type {!HTMLElement} 385 * @type {!HTMLElement}
396 * @private 386 * @private
397 * @const 387 * @const
398 */ 388 */
399 this.editBarSpacer_ = queryRequiredElement(this.bottomToolbar_, 389 this.editBarSpacer_ = queryRequiredElement(this.toolbar_, '.edit-bar-spacer');
400 '.edit-bar-spacer');
401 390
402 /** 391 /**
403 * @type {!HTMLElement} 392 * @type {!HTMLElement}
404 * @private 393 * @private
405 * @const 394 * @const
406 */ 395 */
407 this.editBarMain_ = util.createChild(this.editBarSpacer_, 'edit-main'); 396 this.editBarMain_ = util.createChild(this.editBarSpacer_, 'edit-main');
408 397
409 /** 398 /**
410 * @type {!HTMLElement} 399 * @type {!HTMLElement}
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 var event = assertInstanceof(event, MouseEvent); 1859 var event = assertInstanceof(event, MouseEvent);
1871 var viewport = this.slideMode_.getViewport(); 1860 var viewport = this.slideMode_.getViewport();
1872 if (!this.enabled_ || !viewport.isZoomed()) 1861 if (!this.enabled_ || !viewport.isZoomed())
1873 return; 1862 return;
1874 this.stopOperation(); 1863 this.stopOperation();
1875 viewport.setOffset( 1864 viewport.setOffset(
1876 viewport.getOffsetX() + event.wheelDeltaX, 1865 viewport.getOffsetX() + event.wheelDeltaX,
1877 viewport.getOffsetY() + event.wheelDeltaY); 1866 viewport.getOffsetY() + event.wheelDeltaY);
1878 this.slideMode_.applyViewportChange(); 1867 this.slideMode_.applyViewportChange();
1879 }; 1868 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/gallery.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698