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

anno.setProperties with OpenSeadragon #187

Open
apricea4 opened this issue Jul 25, 2017 · 1 comment
Open

anno.setProperties with OpenSeadragon #187

apricea4 opened this issue Jul 25, 2017 · 1 comment

Comments

@apricea4
Copy link

apricea4 commented Jul 25, 2017

anno.setProperties breaks annotorious on the line anno.makeAnnotatable(viewer) in my code with the stack trace pointing to anno.min.js as well. I have tried putting it before and after the makeAnnotatable call. Has anyone successfully set the properties of an OpenSeadragon x annotorious annotation? I would like to be able to change the color and font of the text, change the color of the rectangle and make the annotations persist throughout the session.

Also, how might I get the height and width of an annotation in pixels? I see one can do annotation.text and so I imagine it would be annotation.height, but how can I guarantee pixels?

Thank you

@nasedil
Copy link

nasedil commented Apr 25, 2018

@apricea4 you can get annotation relative width and height as following:

annotation.shapes[0].geometry.width
annotation.shapes[0].geometry.height

The values would be in range 0..1. To convert to pixels you can multiply the values by the image width and height, respectively.

Regarding anno.setProperties, it also breaks in my case, during the anno.makeAnnotatable call, saying:

TypeError: $annotator$$1$$.$setProperties$ is not a function:
annotorious.debug.js:2043:76

$JSCompiler_StaticMethods__initAnnotator$$
http://annotorious.github.com/latest/annotorious.debug.js:2043:76
$$JSCompiler_prototypeAlias$$$$makeAnnotatable$$
http://annotorious.github.com/latest/annotorious.debug.js:2181:34
$$JSCompiler_prototypeAlias$$$$makeAnnotatable$$
http://annotorious.github.com/latest/annotorious.debug.js:4375:19

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants