annotorious / annotorious-v1

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

Plug-in for extending tooltip does not work with OpenSeaDragon #158

Open DarrynLavery opened 8 years ago

DarrynLavery commented 8 years ago

Hi,

I'm trying to write a plug-in to extend the tooltip to include more information. The plug in works when I annotate an image but not when I annotate an OpenSeaDragon image. There may be an interaction between plug-in and OpenSeaDragon (or I’ve done something wrong :-().

Best

Darryn

Step 1: Starting Point

I went back to the demo that comes with Annotorius: see http://www.lavery.me/libs/annotorius/example/example.html

Step 2: Took initial demo, reduced to minimal code and extended the tooltip

http://lavery.me/scratch/base.html screen

In this version if you create an annotation over the picture and then hover a newly created annotation, you can see a working extension. In this case I add a button to open a flick page.

Step 3: Integrated with OpenSeaDragon

In this version I integrate OpenSeaDragon and automatically add an annotation. However, in this example, the code to extend the tooltip does not work http://lavery.me/scratch/mosaic.html

rsimon commented 8 years ago

Hi Darryn,

that's a cool showcase! I tried dropping your plugin init code into the OpenSeadragon test page and this did, in fact, work.

It looks as if you've only made a very minor mistake: you placed the plugin init code after starting up Annotorious. If you change the order, things should work. Here's the code that worked for me:

https://gist.github.com/rsimon/7862c479b6c1ac8107d731e4d387d8ee

(Note that I'm defining the plugin first, and then setting up Annotorious later on page load.)

DarrynLavery commented 8 years ago

Thanks Rainer – that helped.

Let me update the thread accordingly.

Let me know if you want me to package these into a sample you can include on your site. Least I can for providing these plug-in – saved a lot of work.

Best,

Darryn

From: Rainer Simon [mailto:notifications@github.com] Sent: Wednesday, June 15, 2016 12:05 AM To: annotorious/annotorious Cc: darryn@lavery.org; Author Subject: Re: [annotorious/annotorious] Plug-in for extending tooltip does not work with OpenSeaDragon (#158)

Hi Darryn,

that's a cool showcase! I tried dropping your plugin init code into the OpenSeadragon test pagehttps://github.com/annotorious/annotorious/blob/master/test/openseadragon/test.html and this did, in fact, work.

It looks as if you've only made a very minor mistake: you placed the plugin init code after starting up Annotorious. If you change the order, things should work. Here's the code that worked for me:

https://gist.github.com/rsimon/7862c479b6c1ac8107d731e4d387d8ee

(Note that I'm defining the plugin first, and then setting up Annotorious later on page load.)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/annotorious/annotorious/issues/158#issuecomment-226105368, or mute the threadhttps://github.com/notifications/unsubscribe/ANAASxF5q_D9437jip6ym2nmoVMSIgK2ks5qL6QwgaJpZM4I1y0m.

DarrynLavery commented 8 years ago

OpenSeaDragon integration http://lavery.me/scratch/mosaic.html

Just switching the code around helped

anno.addPlugin('HelloWorldPlugin', {}); anno.makeAnnotatable(viewer); anno.addAnnotation(myAnnotation)

Generating annotations for an image http://lavery.me/scratch/base.html

Issue #116 was useful. Instead of adding class = "annotations" I enabled Annotorius through JavaScript.

Thanks

Darryn