annotorious / annotorious-v1

Project has moved to http://github.com/annotorious/annotorious
https://annotorious.com
MIT License
592 stars 142 forks source link

Remove annotation from an image object (like the opposite of makeAnnotatable) #66

Closed thestonefox closed 11 years ago

thestonefox commented 11 years ago

I want to be able to dynamically say stop this object from being annotatable, so the opposite of makeAnnotatable

Is there a way? I don't see it in the documentation.

thestonefox commented 11 years ago

Nevermind, using a combination of removeAll and hideSelectionWidget will give me the desired outcome.

rsimon commented 11 years ago

Hi!

< Nevermind, using a combination of removeAll and hideSelectionWidget will give me the desired outcome. >

Yes, that will work. You could also use hideAnnotations and hideSelectionWidget. This way you could later re-enable again, without loosing the anntotations. But I think it will make sense to have a separate opposite to makeAnnotatable, as you say. Not sure how to name the API method yet. But I'll keep this issue open for now!

Thx, Rainer

thestonefox commented 11 years ago

Just noticed an issue with showSelectionWidget (or it's something I'm doing wrong)

I'm basically doing this:

anno.hideSelectionWidget(myImage.src); anno.showSelectionWidget(myImage.src);

and i'm getting the following console error:

Uncaught ReferenceError: item_url is not defined ---> annotorious-0.5.min.js:122

any ideas?

rsimon commented 11 years ago

Yes - sorry. Indeed that's a bug which I fixed after the 0.5 release! Can you replace your release of annotorious.min.js with the most up-to-date dev version? Just hotlink to (or download from) http://annotorious.github.io/latest/annotorious.min.js

thestonefox commented 11 years ago

Hi,

using the latest code, i no longer get the error but calling showSelectionWidget doesn't seem to bring back the annotation thingy.

thestonefox commented 11 years ago

but, calling anno.makeAnnotatable(myItem); again makes it come back ok

rsimon commented 11 years ago

< calling showSelectionWidget doesn't seem to bring back the annotation thingy. >

Ouch. Bug. I updated annotorious.min.js with a fix for this!

Yes, makeAnnotatable will bring everything back. But the old annotation canvas doesn't get properly destroyed underneath the hood. So this could cause problems further down the line. I need to look into this case more closely. But in any case: another reason for having a destroy(opt_item_url) method (and/or a check that keeps things clean if makeAnnotatable is called multiple times).

thestonefox commented 11 years ago

Yeah the latest version has fixed the showSelectionWidget issue :)

thanks mucho!

rsimon commented 11 years ago

Now implemented through anno.destroy(opt_item_url) and anno.reset API methods. Details are on the Wiki