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 8737673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:34:43+00:00 2026-06-13T10:34:43+00:00

I expected this to be 100% a no-brainer, but as it turns out, I

  • 0

I expected this to be 100% a no-brainer, but as it turns out, I cannot figure out what the x and y attributes of an svg created and manipulated with Raphael.js mean. I assumed they were the coordinates of the top-left corner of the object in relation to the canvas, but now I’m not so sure.

After creating a canvas (var paper = new Raphael(container,width,height)) and adding an image or rectangle to it, for example, if I retrieve the “x” and “y” attributes using the attr method (e.g. object.attr("x")), they’re both at 0. However, if I rotate that object and then retrieve the values of x and y again, the values don’t reflect the position of the top-left corner of my object in relation to the canvas anymore.

Can someone please explain this to me?

  • 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-06-13T10:34:44+00:00Added an answer on June 13, 2026 at 10:34 am

    I fear @afaf12’s answer complacently goes only half the distance. He’s absolutely correct that transformation logic occurs after the fundamental attributes of a given element and doesn’t effect them, but it is certainly possible to retrieve the x and y of that element after transformations are applied. You’ll want to use the getBBox method, like this:

    var bbox = elem.getBBox();
    console.log("Transformed coordinates of element are %s,%s", bbox.x, bbox.y );
    

    Please note that there is some trickiness involved — this returns the bounding box of the element, which is often a superset of the space occupied by the element — so there’s no guarantee that the returned point will be IN the element.

    Another alternative occurs if you’re using paths — path.getPointAtLength also works with transformed coordinates, so you can get the x,y offset of the beginning of a path by calling

    var coord = elem.getPointAtLength(0);
    console.log("Transformed coordinates of path are %s,%s", coord.x, coord.y );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I expected this to print [b] but it prints [] : $x = abc;
This code when executed displays the expected output but prints segmentation fault (core dumped)
I'm not 100% what is causing this but something is getting past me with
This seems to be like a common use case... but somehow I cannot get
This works in Chrome, Safari and Firefox, but not in IE9 style='height:100' IE9 just
I am currently seeing a set of errors across my builds. Is this expected
g++ compiler gives this error: expected `;' before 'it' template <typename T> class myList
I am getting this error While running this LoadError: Expected /home/user/Desktop/Tripurari/myapp/app/models/host.rb to define Host##
Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
This method works as expected - it creates a JTree with a root node

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.