Skip to content

linjekoll/raphael.coordinates.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

raphael.coordinates.js

Calculates the length in pixels between two coordinates using a Raphael.js path.

Examples

Create a basic path.

var paper = Raphael(10, 50, 320, 200);
var path = paper.path("M10 10 L90 90 L21 18 L19 31");

Get length from the M10, 10 coordinate to L21, 18.

path.getLengthBetweenCoordinates({
  x: 10,
  y: 10 
}, {
  x: 21,
  y: 18
});

/* => 212.86170582141557 */

Get length from start (M10, 10) to M21, 18.

path.getLengthFromStartTo(21, 18);
/* => 212.86170582141557 */

Get length from the end (L19, 31) to L90, 90.

path.getLengthFromEndTo(90, 90);
/* => 112.87756726953388 */

Requirements

Raphael.js 1.5.2 or greater.

License

Released under the MIT license.

About

Calculates the length in pixels between two coordinates using a Raphael.js path

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published