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

Commit

Permalink
Add the stopSelection method to the global anno object
Browse files Browse the repository at this point in the history
This allows the selection process to be stopped from an external actor with

    anno.hideSelectionWidget();
    anno.stopSelection();
  • Loading branch information
moschlar committed Aug 21, 2015
1 parent 030b876 commit 7ae3707
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 7ae3707

Please sign in to comment.