Creating a vector image with on-mouse hot spots?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
williamk
Posts: 4
Joined: 2013-01-15T03:59:38-07:00
Authentication code: 6789

Creating a vector image with on-mouse hot spots?

Post by williamk »

Guys, I'm new here, so I'm asking this before I get my head around things just to find out its not possible and spent hours and hours for nothing... so, please, could someone give me a hand?

I need to create a map that adjusts itself, this is easy, but I also need to be able to click on it and know which section I clicked. Is this possible?

What I will create is an Iridology map. (eye exam chart)

Thank you for any help.

Best Regards, WilliamK
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Creating a vector image with on-mouse hot spots?

Post by snibgo »

ImageMagic doesn't contain tools that capture mouse clicks.

Other systems, such as Web languages, do contain such tools.
snibgo's IM pages: im.snibgo.com
williamk
Posts: 4
Joined: 2013-01-15T03:59:38-07:00
Authentication code: 6789

Re: Creating a vector image with on-mouse hot spots?

Post by williamk »

Yes, I'm aware of that, but I wonder if via PHP I could detect if I'm hitting a vector area or not, something like that. Like games does.

For example, I have 4 circles in my vector, and I want to know if a X/Y position hits one of those circles and which one. ;-)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Creating a vector image with on-mouse hot spots?

Post by Bonzo »

Yes you can do it with php ( will give you the x and y cordinates in the URL ) but the page will reload. You may be able to do it with javascript and not have the page reload - I do not use javascript and so can not confirm this.

I did have a couple of php examples on my website but I have removed one and this one http://www.rubblewebs.co.uk/imagemagick/trials/imap.php is broken; I will try and have a look at it later if I remember.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Creating a vector image with on-mouse hot spots?

Post by Bonzo »

My example seems to be working OK now - when you click on a colour on the first page and go to the second page you can see the co-ordinates of the click in the URL.
williamk
Posts: 4
Joined: 2013-01-15T03:59:38-07:00
Authentication code: 6789

Re: Creating a vector image with on-mouse hot spots?

Post by williamk »

Thanks Bonzo, I will check out things pretty soon. Just to speed things up, could you please show me how you did that? :D
williamk
Posts: 4
Joined: 2013-01-15T03:59:38-07:00
Authentication code: 6789

Re: Creating a vector image with on-mouse hot spots?

Post by williamk »

Never mind, I saw the "click here to download the code" link.... :oops:
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Creating a vector image with on-mouse hot spots?

Post by anthony »

Bonzo wrote:My example seems to be working OK now - when you click on a colour on the first page and go to the second page you can see the co-ordinates of the click in the URL.
Doesn't work for me (firefox v16 under linux)


Actually I liked you older example where you create a colored map of areas within an image, take the users click coordinates and look up the color in that color map to determine what area the user selected. Is that online somewhere?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Creating a vector image with on-mouse hot spots?

Post by Bonzo »

Doesn't work for me (firefox v16 under linux)
Strange as it works in Firefox 17.0.1 on Windows.
Actually I liked you older example where you create a colored map of areas within an image, take the users click coordinates and look up the color in that color map to determine what area the user selected. Is that online somewhere?
No I do not think it is, last thing I used it for was an imagemap on my gallery. I will look it out again and make another demo when I get time.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Creating a vector image with on-mouse hot spots?

Post by snibgo »

It works for me on Firefox 3.5.16 under Windows 7. As I moved the mouse around, it continuously showed the coordinates in the address bar.

Is Firefox now on v17? About time I upgraded, I suppose.
snibgo's IM pages: im.snibgo.com
Post Reply