OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 // Allow changing the 'Overwrite original' setting only if the user | 972 // Allow changing the 'Overwrite original' setting only if the user |
973 // used Undo to restore the original image AND it is not a copy. | 973 // used Undo to restore the original image AND it is not a copy. |
974 // Otherwise lock the setting in its current state. | 974 // Otherwise lock the setting in its current state. |
975 var mayChangeOverwrite = !this.editor_.canUndo() && item.isOriginal(); | 975 var mayChangeOverwrite = !this.editor_.canUndo() && item.isOriginal(); |
976 ImageUtil.setAttribute(this.options_, 'saved', !mayChangeOverwrite); | 976 ImageUtil.setAttribute(this.options_, 'saved', !mayChangeOverwrite); |
977 | 977 |
978 if (this.imageView_.getContentRevision() === 1) { // First edit. | 978 if (this.imageView_.getContentRevision() === 1) { // First edit. |
979 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit')); | 979 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit')); |
980 } | 980 } |
981 | 981 |
982 if (util.isSameEntry(oldEntry, item.getEntry())) { | 982 if (!util.isSameEntry(oldEntry, item.getEntry())) { |
983 this.dataModel_.splice( | 983 this.dataModel_.splice( |
984 this.getSelectedIndex(), 0, new Gallery.Item(oldEntry)); | 984 this.getSelectedIndex(), 0, new Gallery.Item(oldEntry)); |
985 // The ribbon will ignore the splice above and redraw after the | 985 // The ribbon will ignore the splice above and redraw after the |
986 // select call below (while being obscured by the Editor toolbar, | 986 // select call below (while being obscured by the Editor toolbar, |
987 // so there is no need for nice animation here). | 987 // so there is no need for nice animation here). |
988 // SlideMode will ignore the selection change as the displayed item | 988 // SlideMode will ignore the selection change as the displayed item |
989 // index has not changed. | 989 // index has not changed. |
990 this.select(++this.displayedIndex_); | 990 this.select(++this.displayedIndex_); |
991 } | 991 } |
992 callback(); | 992 callback(); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 done = true; | 1345 done = true; |
1346 } | 1346 } |
1347 }.bind(this); | 1347 }.bind(this); |
1348 }; | 1348 }; |
1349 | 1349 |
1350 /** | 1350 /** |
1351 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD | 1351 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD |
1352 * horizontally it's considered as a swipe gesture (change the current image). | 1352 * horizontally it's considered as a swipe gesture (change the current image). |
1353 */ | 1353 */ |
1354 SwipeOverlay.SWIPE_THRESHOLD = 100; | 1354 SwipeOverlay.SWIPE_THRESHOLD = 100; |
OLD | NEW |