# Glimmr Graphic Hyperlinks

## version 1/100805 by Erik Temple

**Chapter 7.2a - Report window and canvas coordinates (for use with Glimmr Canvas-Based Drawing by Erik Temple)**

Showing clicked coordinates is an action out of world. Understand "coordinates" as showing clicked coordinates. Coordinate-trace is a truth state that varies. Coordinate-trace is false.

Check showing clicked coordinates:

If coordinate-trace is false:

now coordinate-trace is true;

otherwise:

now coordinate-trace is false;

say "Coordinate reporting now [if coordinate-trace is true]on[otherwise]off[end if].[line break]".

The report coordinates rule is listed before the default command replacement by graphlinks rule in the clicking graphlink rules.

A clicking graphlink rule when coordinate-trace is true (this is the report coordinates rule):

let graph-x be current graphlink x as a fixed point number;

let graph-y be current graphlink y as a fixed point number;

say "[line break]Window coordinates of mouse input ([current graphlink window]): ([current graphlink x],[current graphlink y])[line break]Approximate canvas coordinates: ([(graph-x real minus the x-offset of the current graphlink window) real divided by the scaling factor of the current graphlink window as an integer],[(graph-y real minus the y-offset of the current graphlink window) real divided by the scaling factor of the current graphlink window as an integer])[line break]";

continue the action.

Glimmr Graphic Hyperlinks ends here.