diff options
author | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 13:17:50 +0000 |
---|---|---|
committer | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 13:17:50 +0000 |
commit | a5ab75a9c03e256765d19f48a45f55acbfc6750e (patch) | |
tree | 73bc21e87bec0d93d76e6bcfb4e8dadee56b3af5 | |
parent | 29ba2ca8bdf9a2649cd6fb56f8a7bf50a613d455 (diff) | |
download | chromium_src-a5ab75a9c03e256765d19f48a45f55acbfc6750e.zip chromium_src-a5ab75a9c03e256765d19f48a45f55acbfc6750e.tar.gz chromium_src-a5ab75a9c03e256765d19f48a45f55acbfc6750e.tar.bz2 |
[filebrowser] Gallery UI polish
BUG=chromium-os:21065,chromium-os:21781,chromium-os:21755,chromium-os:21538
TEST=
Review URL: http://codereview.chromium.org/8354001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106274 0039d316-1c4b-4281-b951-d872f2087c98
7 files changed, 32 insertions, 17 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 0bc2124..fc0c44f 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -9535,7 +9535,7 @@ Keep your key file in a safe place. You will need it to create new versions of y </message> <message name="IDS_FILE_BROWSER_GALLERY" desc="Title of the action to open the Gallery."> - View and edit + View and Edit </message> <message name="IDS_FILE_BROWSER_GALLERY_EDIT" desc="In the Gallery, the title on the button shows/hides editing buttons."> Edit diff --git a/chrome/browser/resources/file_manager/js/exif_parser.js b/chrome/browser/resources/file_manager/js/exif_parser.js index 89991ba..804e634 100644 --- a/chrome/browser/resources/file_manager/js/exif_parser.js +++ b/chrome/browser/resources/file_manager/js/exif_parser.js @@ -42,7 +42,7 @@ ExifParser.prototype.parse = function(file, callback, errorCallback) { try { steps[++currentStep].apply(null, arguments); } catch(e) { - onError(e); + onError(e.stack); } } @@ -234,8 +234,9 @@ ExifParser.prototype.readTagValue = function(br, tag) { readFunction = function(size) { return br.readScalar(size, signed) }; var totalSize = tag.componentCount * size; - if (totalSize > 100 || totalSize < 1) { - // This is probably invalid exif data. + if (totalSize < 1) { + // This is probably invalid exif data, skip it. + tag.componentCount = 1; tag.value = br.readScalar(4); return; } diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js index 475a8b7..6aeac34 100644 --- a/chrome/browser/resources/file_manager/js/file_manager.js +++ b/chrome/browser/resources/file_manager/js/file_manager.js @@ -1834,6 +1834,8 @@ FileManager.prototype = { task.iconUrl = chrome.extension.getURL('images/icon_preview_16x16.png'); task.title = str('PREVIEW_IMAGE'); + // Do not create the Slideshow button if the Gallery is present. + if (GALLERY_ENABLED) continue; } else if (task_parts[1] == 'play') { task.iconUrl = chrome.extension.getURL('images/icon_play_16x16.png'); @@ -2110,6 +2112,7 @@ FileManager.prototype = { } galleryFrame.onload = function() { + self.document_.title = str('GALLERY'); galleryFrame.contentWindow.Gallery.open( self.currentDirEntry_, urls, @@ -2118,6 +2121,7 @@ FileManager.prototype = { // TODO(kaznacheev): keep selection. self.rescanDirectoryNow_(); // Make sure new files show up. self.dialogDom_.removeChild(galleryFrame); + self.document_.title = self.currentDirEntry_.fullPath; self.refocus(); }, self.metadataProvider_, diff --git a/chrome/browser/resources/file_manager/js/image_editor/gallery.css b/chrome/browser/resources/file_manager/js/image_editor/gallery.css index 54905f4..2bf9927 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/gallery.css +++ b/chrome/browser/resources/file_manager/js/image_editor/gallery.css @@ -41,7 +41,7 @@ body { } .gallery[tools] > .close div { - opacity: 0.4; + opacity: 0.5; } .gallery[tools] > .close div:hover { @@ -333,7 +333,7 @@ body { -webkit-box-orient: horizontal; -webkit-box-pack: center; -webkit-transition: width 0.5s ease-in-out; -} + } .gallery[editing] .toolbar .edit-bar { width: 100%; @@ -365,6 +365,8 @@ body { background-repeat: no-repeat; background-position: 5px center; + + opacity: 0.99; /* Workaround for http://crosbug.com/21065 */ } .gallery > .toolbar .button { @@ -540,7 +542,7 @@ body { } .gallery .crop-overlay .shadow { - background-color: rgba(0,0,0,0.4); + background-color: rgba(0,0,0,0.65); } .gallery .crop-overlay .middle-box { diff --git a/chrome/browser/resources/file_manager/js/image_editor/image_transform.js b/chrome/browser/resources/file_manager/js/image_editor/image_transform.js index a133a67..2b42236 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/image_transform.js +++ b/chrome/browser/resources/file_manager/js/image_editor/image_transform.js @@ -230,7 +230,9 @@ DraggableRect.prototype.getDragMode = function(x, y) { } else if (xBetween && yBetween) { result.whole = true; } else { - result.outside = true; + result.newcrop = true; + result.xSide = DraggableRect.RIGHT; + result.ySide = DraggableRect.BOTTOM; } return result; @@ -245,7 +247,7 @@ DraggableRect.prototype.getCursorStyle = function(x, y, mouseDown) { this.viewport_.screenToImageX(x), this.viewport_.screenToImageY(y)); } if (mode.whole) return 'move'; - if (mode.outside) return 'crop'; + if (mode.newcrop) return 'crop'; return this.cssSide_[mode.ySide] + this.cssSide_[mode.xSide] + '-resize'; }; @@ -283,12 +285,14 @@ DraggableRect.prototype.getDragHandler = function(x, y) { self.bounds_.bottom = self.bounds_.top + fixedHeight; }; } else { - if (this.dragMode_.outside) { - this.dragMode_.outside = false; - this.dragMode_.xSide = DraggableRect.RIGHT; - this.dragMode_.ySide = DraggableRect.BOTTOM; - this.bounds_.left = this.bounds_.right = x; - this.bounds_.top = this.bounds_.bottom = y; + function checkNewCrop() { + if (self.dragMode_.newcrop) { + self.dragMode_.newcrop = false; + self.bounds_.left = self.bounds_.right = x; + self.bounds_.top = self.bounds_.bottom = y; + mouseBiasX = 0; + mouseBiasY = 0; + } } function flipSide(side) { @@ -302,6 +306,7 @@ DraggableRect.prototype.getDragHandler = function(x, y) { if (this.dragMode_.xSide != DraggableRect.NONE) { mouseBiasX = self.bounds_[this.dragMode_.xSide] - x; resizeFuncX = function(x) { + checkNewCrop(); self.bounds_[self.dragMode_.xSide] = x; if (self.bounds_.left > self.bounds_.right) { self.dragMode_.xSide = flipSide(self.dragMode_.xSide); @@ -311,6 +316,7 @@ DraggableRect.prototype.getDragHandler = function(x, y) { if (this.dragMode_.ySide != DraggableRect.NONE) { mouseBiasY = self.bounds_[this.dragMode_.ySide] - y; resizeFuncY = function(y) { + checkNewCrop(); self.bounds_[self.dragMode_.ySide] = y; if (self.bounds_.top > self.bounds_.bottom) { self.dragMode_.ySide = flipSide(self.dragMode_.ySide); diff --git a/chrome/browser/resources/file_manager/js/image_editor/viewport.js b/chrome/browser/resources/file_manager/js/image_editor/viewport.js index ff780ff..ad989cd 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/viewport.js +++ b/chrome/browser/resources/file_manager/js/image_editor/viewport.js @@ -66,7 +66,9 @@ Viewport.prototype.setScale = function(scale, notify) { Viewport.prototype.getFittingScale = function() { var scaleX = this.screenBounds_.width / this.imageBounds_.width; var scaleY = this.screenBounds_.height / this.imageBounds_.height; - return Math.min(scaleX, scaleY); + // Scales > 1 do not look good. Also they are not really useful + // as we do not have any pixel-level operations. + return Math.min(1, scaleX, scaleY); }; Viewport.prototype.fitImage = function() { diff --git a/chrome/browser/resources/file_manager/js/mock_chrome.js b/chrome/browser/resources/file_manager/js/mock_chrome.js index 6545b55..3c5e7db 100644 --- a/chrome/browser/resources/file_manager/js/mock_chrome.js +++ b/chrome/browser/resources/file_manager/js/mock_chrome.js @@ -94,7 +94,7 @@ chrome.fileBrowserPrivate = { }, { taskId: extensionId + '|gallery', - title: 'View and edit', + title: 'View and Edit', regexp: /\.(jpe?g|gif|png|cr2?|tiff|webp|bmp)$/i, iconUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sEEBcOAw9XftIAAADFSURBVCjPrZKxCsIwEIa/FHFwsvYxROjSQXAoqLiIL+xgBtvZ91A6uOnQc2hT0zRqkR4c3P25+/PfJTCwLU6wEpgBWkDXuInDPSwF5r7mJIeNQFTnIiCeONpVdYlLoK9wEUhNg8+B9FDVaZcgCKAovjTXfvPJFwGZtKW60pt8bOGBzfLouemnFY/MAs8wDeEI4NzaybewBu4AysKVgrK0gfe5iB9vjdAUqQ/S1Y/R3IX9Zc1zxc7zxe2/0Iskt7AsG0hhx14W8XV43FgV4gAAAABJRU5ErkJggg==' } |