Add frontend and API support for deleting tags. Model support is needed.
This commit is contained in:
parent
ee80f43375
commit
9da93c7caf
8 changed files with 195 additions and 6 deletions
|
@ -69,6 +69,25 @@ ImageHistoryTree.prototype.calculateDimensions_ = function(container) {
|
|||
};
|
||||
|
||||
|
||||
ImageHistoryTree.prototype.setupOverscroll_ = function() {
|
||||
var container = this.container_;
|
||||
var that = this;
|
||||
var overscroll = $('#' + container).overscroll();
|
||||
|
||||
overscroll.on('overscroll:dragstart', function() {
|
||||
$(that).trigger({
|
||||
'type': 'hideTagMenu'
|
||||
});
|
||||
});
|
||||
|
||||
overscroll.on('scroll', function() {
|
||||
$(that).trigger({
|
||||
'type': 'hideTagMenu'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Updates the dimensions of the tree.
|
||||
*/
|
||||
|
@ -88,8 +107,8 @@ ImageHistoryTree.prototype.updateDimensions_ = function() {
|
|||
var boundingBox = document.getElementById(container).getBoundingClientRect();
|
||||
document.getElementById(container).style.maxHeight = (viewportHeight - boundingBox.top - 110) + 'px';
|
||||
|
||||
$('#' + container).overscroll();
|
||||
|
||||
this.setupOverscroll_();
|
||||
|
||||
// Update the tree.
|
||||
var rootSvg = this.rootSvg_;
|
||||
var tree = this.tree_;
|
||||
|
@ -183,8 +202,7 @@ ImageHistoryTree.prototype.draw = function(container) {
|
|||
this.root_.y0 = 0;
|
||||
|
||||
this.setTag_(this.currentTag_);
|
||||
|
||||
$('#' + container).overscroll();
|
||||
this.setupOverscroll_();
|
||||
};
|
||||
|
||||
|
||||
|
@ -642,7 +660,7 @@ ImageHistoryTree.prototype.update_ = function(source) {
|
|||
if (tag == currentTag) {
|
||||
kind = 'success';
|
||||
}
|
||||
html += '<span class="label label-' + kind + ' tag" data-tag="' + tag + '">' + tag + '</span>';
|
||||
html += '<span class="label label-' + kind + ' tag" data-tag="' + tag + '"">' + tag + '</span>';
|
||||
}
|
||||
return html;
|
||||
});
|
||||
|
@ -654,6 +672,19 @@ ImageHistoryTree.prototype.update_ = function(source) {
|
|||
if (tag) {
|
||||
that.changeTag_(tag);
|
||||
}
|
||||
})
|
||||
.on("contextmenu", function(d, e) {
|
||||
d3.event.preventDefault();
|
||||
|
||||
var tag = this.getAttribute('data-tag');
|
||||
if (tag) {
|
||||
$(that).trigger({
|
||||
'type': 'showTagMenu',
|
||||
'tag': tag,
|
||||
'clientX': d3.event.clientX,
|
||||
'clientY': d3.event.clientY
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Ensure the tags are visible.
|
||||
|
|
Reference in a new issue