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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:50:51+00:00 2026-05-16T10:50:51+00:00

How would I go about drawing a connection line in Raphael where the mousedown

  • 0

How would I go about drawing a connection line in Raphael where the mousedown initiates the starting point of the line, the mousemove moves the end point without moving the start point and the mouseup leaves it as it is?

  • 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-16T10:50:52+00:00Added an answer on May 16, 2026 at 10:50 am

    Have a look at the source of http://www.warfuric.com/taitems/RaphaelJS/arrow_test.htm.

    This might get you started.

    EDIT

    I made a quick example that will give you a head start (still need some work though: validation of parameters, adding comments, etcetera).

    Note: you still have to adapt the path to raphael.js

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta http-equiv="edit-Type" edit="text/html; charset=utf-8">
    
    
    <!-- Update the path to raphael js -->
    <script type="text/javascript"src="path/to/raphael1.4.js"></script>
    <script type='text/javascript'
        src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    
    <style type='text/css'>
    svg {
        border: solid 1px #000;
    }
    </style>
    
    </head>
    <body>
    <div id="raphaelContainer"></div>
    <script type='text/javascript'> 
        //<![CDATA[ 
    
    function Line(startX, startY, endX, endY, raphael) {
        var start = {
            x: startX,
            y: startY
        };
        var end = {
            x: endX,
            y: endY
        };
        var getPath = function() {
            return "M" + start.x + " " + start.y + " L" + end.x + " " + end.y;
        };
        var redraw = function() {
            node.attr("path", getPath());
        }
    
        var node = raphael.path(getPath());
        return {
            updateStart: function(x, y) {
                start.x = x;
                start.y = y;
                redraw();
                return this;
            },
            updateEnd: function(x, y) {
                end.x = x;
                end.y = y;
                redraw();
                return this;
            }
        };
    };
    
    
    
    $(document).ready(function() {
        var paper = Raphael("raphaelContainer",0, 0, 300, 400);
        $("#raphaelContainer").mousedown(
    
        function(e) {
            x = e.offsetX;
            y = e.offsetY;
            line = Line(x, y, x, y, paper);
            $("#raphaelContainer").bind('mousemove', function(e) {
                x = e.offsetX;
                y = e.offsetY;
                line.updateEnd(x, y);
            });
        });
    
        $("#raphaelContainer").mouseup(
    
        function(e) {
            $("#raphaelContainer").unbind('mousemove');
        });
    });
        //]]> 
        </script>
    </body>
    </html>
    

    See example: http://jsfiddle.net/rRtAq/9358/

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

Sidebar

Related Questions

Greetings Everyone. I was wondering how would I go about drawing an ached line
How would I go about drawing a view offscreen in order to perform some
How would I go about drawing a custom UIView that is literally just a
I have been learning about drawing to panels using bitmaps. I thought I would
Using QT, how would I go about taking user-supplied input (text) and drawing the
I would like 'about' to route to 'abouts/1' I tried this: match 'about' =>
Any ideas how I would go about writing a javascript method to insert an
Just a quick question about how you would go about implementing this. I want
I would like to know how I would go about altering the HTML that
I was wondering how one would go about developing a website from scratch with

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.