Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7568217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:52:04+00:00 2026-05-30T14:52:04+00:00

I am a bit confused here about how to interact with an image in

  • 0

I am a bit confused here about how to interact with an image in a canvas.

My images load but I want to be able to click a given image and work out which image the mouse has clicked.

But the images can be offset aswell which makes matters more confusing, so I was wondering if there was a some kind of mathematical way to calculate which image your mouse is over when you click the canvas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:52:06+00:00Added an answer on May 30, 2026 at 2:52 pm

    Not tried in on a canvas, but maybe it can help (part is jQuery), base rely on DOM function elementFromPoint():

    getElemFromPos = function(x,y,def)
    {
     var f = 'elementFromPoint',
         x=parseInt(x),y=parseInt(y),d=$j(document);
     if(!d[0][f] || isNaN(x) || isNaN(y)) return def;
     var w=$(window),bRel=0;
     if( !d[0].__ajqefpc )
     {
       var sl=d.scrollTop();
       if( sl >0)
        { bRel = (d[0][f](0, sl + w.height() -1) == null); }
       else if((sl = d.scrollLeft())>0 )
             { bIsRel = (d[0][f](sl + w.width() -1, 0) == null); }
       d[0].__ajqefpc=(sl>0);
     }
    
     if(!bRel)
     {
       x += d.scrollLeft();
       y += d.scrollTop();
     }
    
     var r = d[0][f](x,y);
     return (r && r!=null)?r:false;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Bit confused here, I have an on-demand instance but do I get charged even
I'm learning the use of boost smart pointers but I'm a bit confused about
I'm pretty sure I am a bit confused here (I'm even confused about being
i read Here and bit confused about the unregistering events. means i have button
I am porting some Haskell code to F# but a bit confused about the
This might be a very basic question, but I am a bit confused about
I'm a bit confused about the difference between a facebook canvas application and a
I'm a bit confused on how IF ELSE statements work within a query. Here's
alt text http://img693.imageshack.us/img693/724/markov.png I'm a bit confused about some points here: What does it
A bit confused here about the support of codecs with FFMPEG, does FFMPEG support

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.