# [pdftex] Hover effects in pdftex.

James Quirk jjq at galcit.caltech.edu
Mon Dec 12 03:17:19 CET 2005

Ross,

With Acroread 7 you can achieve pretty much what you want by adding
the following JavaScript to an annotation's blur event:

var f  = event.target;  % get annotation object
var xo = this.mouseX;   % get mouse position
var yo = this.mouseY;
var v  = f.rect;        % get annotation position
var dx = xo-v[0];       % compute offset
var dy = yo-v[1];
v[0]  += dx;            % adjust annotation position
v[1]  += dy;
v[2]  += dx;
v[3]  += dy;
f.rect = v;
if(!event.shift) {      % repeat unless shift is pressed
f.setFocus();
}

The example document:

http://www.galcit.caltech.edu/~jjq/moveable-widget.pdf

demonstrates the approach. Click on the equation $e^{i\pi}+1=0$
then move the mouse and click a second time to reposition the
associated annotation; repeat as desrired. To terminate the
process: hold the shift key down.

James

On Mon, 12 Dec 2005, Ross Moore wrote:

> Hi all,
>
> This is an old-ish thread, but there is one type of annotation
> that wasn't discussed, so far as I recall.
>
> On 06/11/2005, at 4:22 AM, Heiko Oberdiek wrote:
>
> Hello Ross,
>
> you have send this to me only. Perhaps you wanted to send it
> to the list?
>
>> On Sat, Nov 05, 2005 at 09:10:44AM -0500, Victor Ivrii wrote:
>
>>> For me hover
>>> effect is the side-effect of Commenting and Drawing Markups - the
>>> question which
>>> I was long ago interested in. I think that  Notes could be a nice
>>> alternative to footnotes
>
> I know how to put an image onto a button, and to show/hide
> the button using JavaScript, in response to a click over
> an active rectangle.
> This works fine for popping-up an image at a fixed place.
>
> What I'd also like to do is to have the image able to be
> selected and moved around using the mouse, as if in its
> own mini-window having its own selection-bars, and with
> its own close-box.
>
> This is possible with text-annotations, but is it possible
> with arbitrary TeX-typeset material, say as with the image
> on a button trick ?
> If so, does anyone have sample coding that implements this ?
>
>
> I've tried unsuccessfully to create an example, using the Tools in
> Acrobat 6. Something like the Loupe window would be perfect,
> but this seems to be just a viewing tool, not something that
> can be specified within the document being viewed.
>
>
> An alternative effect might be to have the image in a separate
> 'minimal' document window, without all the navigation and selection
> tools that Reader normally provides. How to do this?
>
>
> Thanks in advance for any help.
>
> 	Ross
>
> ------------------------------------------------------------------------
> Ross Moore                                         ross at maths.mq.edu.au
> Mathematics Department                             office: E7A-419
> Macquarie University                               tel: +61 +2 9850 8955
> Sydney, Australia  2109                            fax: +61 +2 9850 8114
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> pdftex mailing list
> pdftex at tug.org
> http://tug.org/mailman/listinfo/pdftex
>