Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #132 from moschlar/patch-stopselection
Browse files Browse the repository at this point in the history
Add the stopSelection method to the global anno object
  • Loading branch information
Rainer Simon committed Aug 25, 2015
2 parents 030b876 + 7ae3707 commit 0aa5f87
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/annotorious.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@ annotorious.Annotorious.prototype.hideSelectionWidget = function(opt_item_url) {
}
}

annotorious.Annotorious.prototype.stopSelection = function(opt_item_url) {
if (opt_item_url) {
var module = this._getModuleForItemSrc(opt_item_url);
if (module)
module.stopSelection(opt_item_url);
} else {
goog.array.forEach(this._modules, function(module) {
module.stopSelection();
});
}
}


/**
* Highlights the specified annotation.
* @param {annotorious.Annotation} annotation the annotation
Expand Down
12 changes: 12 additions & 0 deletions src/mediatypes/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,18 @@ annotorious.mediatypes.Module.prototype.activateSelector = function(opt_item_url
}
}

annotorious.mediatypes.Module.prototype.stopSelection = function(opt_item_url) {
if (opt_item_url) {
var annotator = this._annotators.get(opt_item_url);
if (annotator)
annotator.stopSelection();
} else {
goog.array.forEach(this._annotators.getValues(), function(annotator) {
annotator.stopSelection();
});
}
}

/**
* Adds an annotation to an item managed by this module.
* @param {annotorious.Annotation} annotation the annotation
Expand Down

0 comments on commit 0aa5f87

Please sign in to comment.