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

Commit 0aa5f87

Browse files
author
Rainer Simon
committed
Merge pull request #132 from moschlar/patch-stopselection
Add the stopSelection method to the global anno object
2 parents 030b876 + 7ae3707 commit 0aa5f87

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/annotorious.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,19 @@ annotorious.Annotorious.prototype.hideSelectionWidget = function(opt_item_url) {
253253
}
254254
}
255255

256+
annotorious.Annotorious.prototype.stopSelection = function(opt_item_url) {
257+
if (opt_item_url) {
258+
var module = this._getModuleForItemSrc(opt_item_url);
259+
if (module)
260+
module.stopSelection(opt_item_url);
261+
} else {
262+
goog.array.forEach(this._modules, function(module) {
263+
module.stopSelection();
264+
});
265+
}
266+
}
267+
268+
256269
/**
257270
* Highlights the specified annotation.
258271
* @param {annotorious.Annotation} annotation the annotation

src/mediatypes/module.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,18 @@ annotorious.mediatypes.Module.prototype.activateSelector = function(opt_item_url
268268
}
269269
}
270270

271+
annotorious.mediatypes.Module.prototype.stopSelection = function(opt_item_url) {
272+
if (opt_item_url) {
273+
var annotator = this._annotators.get(opt_item_url);
274+
if (annotator)
275+
annotator.stopSelection();
276+
} else {
277+
goog.array.forEach(this._annotators.getValues(), function(annotator) {
278+
annotator.stopSelection();
279+
});
280+
}
281+
}
282+
271283
/**
272284
* Adds an annotation to an item managed by this module.
273285
* @param {annotorious.Annotation} annotation the annotation

0 commit comments

Comments
 (0)