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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:23:02+00:00 2026-05-28T04:23:02+00:00

I have previously worked with Raphael, but I have returned to my project and

  • 0

I have previously worked with Raphael, but I have returned to my project and decided to totally re-write it to improve performance and general code quality. Anyway, the application uses Raphael to create Mind Maps (If you have read my previous questions you will have more of an idea of the overall application).

So I create nodes on the canvas using paper.circle() etc and to avoid the unnecessary work of me using .drag() I decided to use the Raphael ZPD plugin. The plugin is far too complicated for me to fully understand, but I intend to edit it very slightly. I would like to store the active node in a variable _node. To do this I thought it would be as simple as getting the evt.target and assigning it, but apparently it’s not.

Here is part of the plugin (The bit where I think the assignment should go):

/**
 * Handle mouse button release event.
 */
me.handleMouseUp = function(evt) {
    if (evt.preventDefault)
        evt.preventDefault();

    evt.returnValue = false;

    var svgDoc = evt.target.ownerDocument;

    if ((me.state == 'pan' && me.opts.pan) || (me.state == 'move' && me.opts.drag)) {
        // Quit pan mode
        me.state = '';
    }
};

When using alert(evt.target); (when clicking a circle) I am given:

[object SVGCircleElement]

which implies that evt.target is getting the individual element (as it changes for other shapes) but then trying to manipulate _node after assignment fails. I get an error message of:

_node.attr is not a function

(I attempted to change the attr() as this was the simplest function).

I have tried many variations using node, evt.target, evt.currentTarget etc, but I’m sure I am just missing something stupid with evt.target because it produces the correct output on alert.

I understand that me. is defined elsewhere in the code so please view the link above if you need to (seems better than posting the full plugin here).

I’d appreciate any help that you can give.

Thank you.

UPDATE: I’m now 100% certain that it is evt.target that I should be storing in _node but it would seem that there is no direct link between SVG, DOM and Raphael. Any ideas on how I could link the SVG element back to Raphael?

  • 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-28T04:23:03+00:00Added an answer on May 28, 2026 at 4:23 am

    I started using this plugin last week, and have run into the same issue.

    I’m able to link the SVG shape back to the raphael handle to the shape.

    Basically, you first have to maintain a pointer to the raphael paper object that’s tied to the zpd plugin object. I do this by creating a raphPaper declaration after the var opts = {…} line

    var raphPaper = null;
    

    So that raphPaper object will be available like the opts object is.

    When raphael creates a shape, it assigns two variables (that I’ve found): .raphael and .raphaelid
    .raphael is a boolean telling us whether or not the SVG shape was created by raphael, and .raphaelid gives us the raphael internal id for the SVG shape. So, to get the raphael element, we just use getById on our paper object (raphPaper).

    if(evt.target.raphael){
        var raphShp = raphPaper.getById(evt.target.raphaelid);
    }
    

    So for your problem, you just have to assign raphShp to _node or whatever variable you want to access.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This piece of code has previously worked but I have C&P it to a
I have previously really only worked on your general 3-tier system. I am now
Previously I have only really worked on applications, but now I am trying to
This must have been answered previously, but my Google powers are off today and
I'm trying to get started with Django, and have previously worked with CakePHP, and
I have just started using StructureMap, having previously worked with Spring.Net. I love the
I have previously worked with Linked list in C++ where refering link list in
i have previously used datatable pagination and it worked as a charm. This time
I have a Drupal installation that previously worked perfectly on my localhost. However, now,
I have a Filter implementation that has worked previously in a single instance Glassfish

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.