diff --git a/src/annotorious.js b/src/annotorious.js index f54668f..cd02e99 100644 --- a/src/annotorious.js +++ b/src/annotorious.js @@ -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 diff --git a/src/mediatypes/module.js b/src/mediatypes/module.js index 6884b2e..94838cf 100644 --- a/src/mediatypes/module.js +++ b/src/mediatypes/module.js @@ -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