Fix issue with changing the tag right after selecting the tag's image

This commit is contained in:
Joseph Schorr 2013-10-16 23:55:11 -04:00
parent 58aaf41430
commit 898210065e

View file

@ -367,14 +367,23 @@ ImageHistoryTree.prototype.markPath_ = function(startingNode, isHighlighted) {
* Sets the current tag displayed in the tree.
*/
ImageHistoryTree.prototype.setTag_ = function(tagName) {
if (tagName == this.currentTag_) {
return;
}
var imageByDBID = this.imageByDBID_;
// Save the current tag.
var previousTagName = this.currentTag_;
this.currentTag_ = tagName;
var imageByDBID = this.imageByDBID_;
// Update the state of each existing node to no longer be highlighted.
if (this.currentImage_) {
var currentNode = imageByDBID[this.currentImage_.dbid];
var previousImage = this.findImage_(function(image) {
return image.tags.indexOf(previousTagName || '(no tag specified)') >= 0;
});
if (previousImage) {
var currentNode = imageByDBID[previousImage.dbid];
this.markPath_(currentNode, false);
}