Mouse over of arbitrary shapes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amaccormack@gmail.com

    Mouse over of arbitrary shapes

    I can think of a number of ways do detect if the mouse if over (or
    clicking on, etc) a arbitrary shaped bitmapped image (say, some sprite
    where we want pixel-perfect click detection, not an enclosing
    rectangle) , such as some kind of array with a mask in it, individual
    lines of the sprite split into tiny rectangles, doing it all on the
    server side via an XML request, but I wondered if anyone could offer
    their experience or thoughts on the "best" way to do this that doesn't
    eat too much client or server resources.
  • Erwin Moller

    #2
    Re: Mouse over of arbitrary shapes

    amaccormack@gma il.com wrote:
    I can think of a number of ways do detect if the mouse if over (or
    clicking on, etc) a arbitrary shaped bitmapped image (say, some sprite
    where we want pixel-perfect click detection, not an enclosing
    rectangle) , such as some kind of array with a mask in it, individual
    lines of the sprite split into tiny rectangles, doing it all on the
    server side via an XML request, but I wondered if anyone could offer
    their experience or thoughts on the "best" way to do this that doesn't
    eat too much client or server resources.
    Hi,

    What about the good old imagemap?
    Google 'imagemap', and you'll find a lot of resources.

    You can make arbitrary shapes in it, and define also your JavaScript
    handlers.

    Here is a quick starters guide:
    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.


    Of course you can also homecook your own routine, based on the x and y
    position of the mouse over the image, but why reinvent the wheel?

    Regards,
    Erwin Moller

    Comment

    Working...