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

  • Home
  • SEARCH
  • 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 9122309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:04:21+00:00 2026-06-17T06:04:21+00:00

Here is my current state: http://jsfiddle.net/andrewgable/Xr6mc/ <!DOCTYPE HTML> <html> <head> <style> body { margin:

  • 0

Here is my current state: http://jsfiddle.net/andrewgable/Xr6mc/

    <!DOCTYPE HTML>
<html>
  <head>
    <style>
      body {
        margin: 0px;
        padding: 0px;
      }

    </style>
  </head>
  <body>
    <div id="container"></div>
    <script src="http://www.html5canvastutorials.com/libraries/kinetic-v4.3.0-beta2.js"></script>
    <script>
      var stage = new Kinetic.Stage({
        container: 'container',
        width: 578,
        height: 200
      });

      var lineLayer = new Kinetic.Layer();
      var flowerLayer = new Kinetic.Layer();
      var centerLayer = new Kinetic.Layer();

      var flower = new Kinetic.Group({
        x: stage.getWidth() / 2,
        y: stage.getHeight() / 2
      });

      // build stem
      var stem = new Kinetic.Line({
        strokeWidth: 10,
        stroke: 'green',
        points: [{
          x: flower.getX(),
          y: flower.getY()
        }, {
          x: stage.getWidth() / 2,
          y: stage.getHeight() + 10
        }]
      });

      // build center
      var center = new Kinetic.Circle({
        x: 0,
        y: 0,
        radius: 6,
        fill: 'black',
        draggable: true,
        x: stage.getWidth() / 2,
        y: stage.getHeight() / 2
      });

      center.on('mouseover', function() {
        this.setFill('orange');
        flowerLayer.draw();
        document.body.style.cursor = 'pointer';
      });

      center.on('mouseout', function() {
        this.setFill('black');
        flowerLayer.draw();
        document.body.style.cursor = 'default';
      });


      stage.on('mouseup', function() {
        document.body.style.cursor = 'default';
      });

      lineLayer.add(stem);
      flowerLayer.add(flower);
      centerLayer.add(center);
      stage.add(lineLayer);
      stage.add(flowerLayer);
      stage.add(centerLayer);

      // keep step and flower position in sync with center
      center.on('dragstart', (function() {
        center.getLayer().afterDraw(function() {
          stem.attrs.points[0] = center.getPosition();
          flower.setPosition(center.getPosition());
          lineLayer.draw();
          flowerLayer.draw();
        });
      }));

    </script>
  </body>
</html>

Just trying to make this line draggable (Easy, set it to drag).

And I want the line to have two anchor points, both can be draged in any direction.

As you can see I have only got to making one “anchor” point.

I cannot figure out the logic to make this possible, without the anchors moving about..

Thanks for your help.

  • 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-17T06:04:22+00:00Added an answer on June 17, 2026 at 6:04 am

    Take a look at http://jsfiddle.net/bxGMw/

    The same logic can be copied right over from this page to what you want. You could just use a buildAnchors function to create the anchors for a shape, and an update function to redraw();

    function buildAnchor(layer, x, y) {
                var anchor = new Kinetic.Circle({
                    x: x,
                    y: y,
                    radius: 8,
                    stroke: '#666',
                    fill: '#ddd',
                    strokeWidth: 2,
                    draggable: true
                });
    
                // add hover styling
                anchor.on('mouseover', function() {
                    document.body.style.cursor = 'pointer';
                    this.setStrokeWidth(4);
                    layer.draw();
                });
                anchor.on('mouseout', function() {
                    document.body.style.cursor = 'default';
                    this.setStrokeWidth(2);
                    layer.draw();
                });
    
                layer.add(anchor);
                return anchor;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my current position with a Jquery Banner - http://jsfiddle.net/WcXBs/2/ Apologies for the
I am working on a navigation which can be seen here: http://jsfiddle.net/ybvF4/ I'm sure
Here is the fiddle: http://jsfiddle.net/7txt3/29/ I want to have the record needle on the
Here is the current code I am using: <UserControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=ButtonPrototype.MainPage Width=640 Height=480>
I'm trying to do the tutorial here: http://www.asp.net/entity-framework/tutorials/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application In the ActionResult Edit, I have
I have prepared a fiddle of my nav bar: http://jsfiddle.net/88r9G/ At the moment, the
http://jsfiddle.net/pauldechov/u4naE/ App.Router = Em.Router.extend({ enableLogging: true, root: Em.Route.extend({ index: Em.Route.extend({ route: '/', connectOutlets: function(router)
Here's the situation : I have an ASP.NET PasswordRecovery ( http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.passwordrecovery.aspx ) control used
Here's my current situation: I have a NSMutableArray named dictKeyArray which I assign a
Here is the current code in my application: String[] ids = str.split("/"); When profiling

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.