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

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

Issue 297323003: Gallery.app: Fix image rotation in the image editor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.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 '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 *
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 * @private 931 * @private
932 */ 932 */
933 SlideMode.prototype.saveCurrentImage_ = function(callback) { 933 SlideMode.prototype.saveCurrentImage_ = function(callback) {
934 var item = this.getSelectedItem(); 934 var item = this.getSelectedItem();
935 var oldEntry = item.getEntry(); 935 var oldEntry = item.getEntry();
936 var canvas = this.imageView_.getCanvas(); 936 var canvas = this.imageView_.getCanvas();
937 937
938 this.showSpinner_(true); 938 this.showSpinner_(true);
939 var metadataEncoder = ImageEncoder.encodeMetadata( 939 var metadataEncoder = ImageEncoder.encodeMetadata(
940 this.selectedImageMetadata_.media, canvas, 1 /* quality */); 940 this.selectedImageMetadata_.media, canvas, 1 /* quality */);
941 941 var selectedImageMetadata = ContentProvider.ConvertContentMetadata(
942 this.selectedImageMetadata_ = ContentProvider.ConvertContentMetadata(
943 metadataEncoder.getMetadata(), this.selectedImageMetadata_); 942 metadataEncoder.getMetadata(), this.selectedImageMetadata_);
943 this.selectedImageMetadata_ = selectedImageMetadata;
944 this.metadataCache_.set(oldEntry,
945 Gallery.METADATA_TYPE,
946 selectedImageMetadata);
944 947
945 item.saveToFile( 948 item.saveToFile(
946 this.context_.saveDirEntry, 949 this.context_.saveDirEntry,
947 this.shouldOverwriteOriginal_(), 950 this.shouldOverwriteOriginal_(),
948 canvas, 951 canvas,
949 metadataEncoder, 952 metadataEncoder,
950 function(success) { 953 function(success) {
951 // TODO(kaznacheev): Implement write error handling. 954 // TODO(kaznacheev): Implement write error handling.
952 // Until then pretend that the save succeeded. 955 // Until then pretend that the save succeeded.
953 this.showSpinner_(false); 956 this.showSpinner_(false);
954 this.flashSavedLabel_(); 957 this.flashSavedLabel_();
955 958
956 var event = new Event('content'); 959 var event = new Event('content');
957 event.item = item; 960 event.item = item;
958 event.oldEntry = oldEntry; 961 event.oldEntry = oldEntry;
959 event.metadata = this.selectedImageMetadata_; 962 event.metadata = selectedImageMetadata;
960 this.dataModel_.dispatchEvent(event); 963 this.dataModel_.dispatchEvent(event);
961 964
962 // Allow changing the 'Overwrite original' setting only if the user 965 // Allow changing the 'Overwrite original' setting only if the user
963 // used Undo to restore the original image AND it is not a copy. 966 // used Undo to restore the original image AND it is not a copy.
964 // Otherwise lock the setting in its current state. 967 // Otherwise lock the setting in its current state.
965 var mayChangeOverwrite = !this.editor_.canUndo() && item.isOriginal(); 968 var mayChangeOverwrite = !this.editor_.canUndo() && item.isOriginal();
966 ImageUtil.setAttribute(this.options_, 'saved', !mayChangeOverwrite); 969 ImageUtil.setAttribute(this.options_, 'saved', !mayChangeOverwrite);
967 970
968 if (this.imageView_.getContentRevision() === 1) { // First edit. 971 if (this.imageView_.getContentRevision() === 1) { // First edit.
969 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit')); 972 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit'));
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 done = true; 1338 done = true;
1336 } 1339 }
1337 }.bind(this); 1340 }.bind(this);
1338 }; 1341 };
1339 1342
1340 /** 1343 /**
1341 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD 1344 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD
1342 * horizontally it's considered as a swipe gesture (change the current image). 1345 * horizontally it's considered as a swipe gesture (change the current image).
1343 */ 1346 */
1344 SwipeOverlay.SWIPE_THRESHOLD = 100; 1347 SwipeOverlay.SWIPE_THRESHOLD = 100;
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698