How can I find an object with fabricjs

I have circles on my webpage, and I want to find a circle and then draw a line to another circle.

Is this possible with FabricJS?

-------------Problems Reply------------

Try starting here:

http://fabricjs.com/stickman/

http://fabricjs.com/quadratic-curve/

I made a example for you:

var canvas = new fabric.Canvas('c');
canvas.add(
new fabric.Circle({ top: 50, left: 50, radius: 25, fill: 'red' }),
new fabric.Circle({ top: 300, left: 300, radius: 25, fill: 'red' })
);
canvas.renderAll();

$('#drawLine').click(function(){
canvas.add(new fabric.Line([50, 50, 300, 300], {
left: 50+25, //25 = 50/radius
top: 50+25,
stroke: 'blue'
}));
});

Link here: http://jsfiddle.net/q6Y6k/17/

Category:javascript Views:2 Time:2018-10-04

Related post

  • Rails 3: How can I find an object with no children in it 2011-08-14

    I have a 3 models class Task < ActiveRecord::Base belongs_to :user, :dependent => :destroy has_many :clock_ins accepts_nested_attributes_for :clock_ins, :allow_destroy => true end class ClockIn < ActiveRecord::Base belongs_to :task, :depe

  • How can I retain embedded object with voting button reply? 2012-09-28

    I have created an OFT template(Entry Form) with voting buttons . Whenever the user fills the entry form and sends it across to the Admin and the Admin approves/rejects the form and CC the response to his/her higher authorities at the same time . My q

  • How can you find the rows with equal columns? 2009-09-17

    If I have a table with important 2 columns, CREATE TABLE foo (id INT, a INT, b INT, KEY a, KEY b); How can I find all the rows that have both a and b being the same in both rows? For example, in this data set id | a | b ---------- 1 | 1 | 2 2 | 5 | 4

  • jQuery - how can I find the element with a certain id? 2009-03-12

    I have a table and each of its td has a unique id that corresponds to some time intervals (0800 til 0830... 0830 til 0900 and so on). And I have an input text where the user will type the time intervals the they want to block. And if they type an int

  • How can I find an tag with watir-webdriver without taking a huge performance hit? 2012-04-10

    I am using watir-webdriver (0.5.3) in a Cucumber (1.1.9) test. I am attempting to verify the text value of an <acronym> tag. The code is legacy, and there are plans to change it to a <div> or <span> tag, but in the mean time I have

  • How can I serialize an object with a Dictionary property? 2010-01-13

    In the example code below, I get this error: Element TestSerializeDictionary123.Customer.CustomProperties vom Typ System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Sy

  • How can I send multiple objects with RubyAmf 2010-03-07

    I'm new to RubyAmf. I noticed that you can send an object with RubyAmf as follows: format.amf { render :amf => @user} Which works fine. But I wasn't sure what to do what when I have two ,or more, objects: @projects = @user.projects @tasks = @user.

  • How can I return a Object with Data in it 2010-08-11

    I know this maybe simple and I know the code I am posting is wrong but I am getting close I think. I am wanting to get the function below from the file pageDAL.cs to return the object page with the values for whatever pageID I pass in. If I do not ne

  • Python: How can I find all files with a particular extension? 2010-08-31

    I am trying to find all the .c files in a directory using Python. I wrote this, but it is just returning me all files - not just .c files. import os import re results = [] for folder in gamefolders: for f in os.listdir(folder): if re.search('.c', f):

  • How can I find all files with a certain line in the source? 2010-11-04

    I am using linux trying to find all files that contain the phrase "Hello" in them (not the filename) and then delete them all. How can I do this? --------------Solutions------------- grep --recursive --files-with-matches Hello $HOME | xargs -d '\n' r

  • How can I view an object with an alert() 2011-04-22

    I tried to do a debug but I am having problems. Now I try with alert(). For example I want to see the value of: var product = { ProductName: $('!Answer_Response[0]').val(), UnitPrice: $('#Price').val(), Stock: $('#Stock').val() }; When I say alert(pr

  • CakePHP - How can I find all languages with tongue twisters? 2011-08-02

    Model <?php class Tonguetwister extends AppModel { var $name = 'Tonguetwister'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'language' => array( 'className'

  • How can I generate Java objects with Bean Validation annotations from an XSD? 2011-11-04

    I'm writing an EJB as a contract first SOAP service and I generate the java classes and SEI from the WSDL. The WSDL specifies several types with constraints (max length, pattern, etc). The generated java classes are JAXB annotated but lack the contra

  • How can I create multiple objects with for loop in C++? 2011-11-04

    I am trying to create multiple objects using a for loop, as eventually I will want this program to create different numbers of the class depending on my input. I tried to write this using an answer to a previous question. However, when I try to compi

  • How can I drag an object with collision detection? 2011-11-11

    I want to create a function in which I can drag a MovieClip which will bump into other MovieClips on the stage without overlapping them. (i.e. the object cannot be dragged over or through other MovieClips). function dragHolder01(event:Event):void{ if

  • How can I declare an object with properties that I will be passing around inside of my function using Typescript? 2012-10-28

    I've been using the following: var modal = { content: '', form: '', href: '' } But now I have started to use Typescript is there a better way I can declare an object and how can I declare the types of my properties. The reason I am using this object

  • How can I compare an object with the parent class in php? 2009-10-16

    I want to compare the class of an object with the current class, and in inherited methods to refer to the parent class. This is the only way I can think of doing it: class foo { function compare($obj) { return get_class($obj) == get_class(new self);

  • How can I retrieve multiple objects with JPA? 2011-01-11

    I'm using JPA2/hibernate with this data model: class Stock { @ManyToOne private StockGroup stockGroup; private boolean visible; } class StockGroup { @OneToMany(mappedBy = "stockGroup") private List<Stock> stocks; } I would like to retrieve Stoc

  • How can one find the name with which a Node.js CLI script was called? 2011-02-01

    I have a script that should behave differently depending on what it is called as (think vimdiff). __filename is specifically designed to give the real name of the file, following aliases and symlinks and such. Is there a way to get the original comma

  • How can you reference a object with a class variable? 2011-08-09

    I couldn't find a answer to my question and I am thinking there is something easy I am missing.. I am trying to reference a a value within a object with a variable in a class. In this case I want the line on the bottom: echo $b->ref->$a->typ

  • How can I find an item with specific value, in a Collection bound to a Canvas 2011-09-13

    I've been Google'ing a bit around for this, but without getting any real answer. Probably because my question might be a bit cryptic. Here goes: Lets say i have an ObservableCollection<SomeModel> containing a bunch of models. I then add the cor

  • How can I find all objects that reference myObject? 2011-11-17

    I have an object myObject and I'm not sure who's holding references to it. (I want to know because I'm reverse engineering something.) I found the button "Objects pointing to this value" in the inspector, but it doesn't bring up anything, even if I m

  • How can I reference foreign objects with ormLite annotations on android 2012-09-26

    I want to use ORM annotations to apply my object relationship but I can't seem to find a way to do this properly using ormLite annotations, because I cant use jpa them on android, I think, but has someone done this, if not can someone tell me how to

  • How can I find repeated letters with a Perl regex? 2008-10-07

    I am looking for a regex that will find repeating letters. So any letter twice or more, for example: booooooot or abbott I won't know the letter I am looking for ahead of time. This is a question I was asked in interviews and then asked in interviews

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.140 (s). 11 q(s)