JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<script src="http://yandex.st/raphael/1.5.2/raphael.min.js"></script>
<script>
/**
* A Simple Vector Shape Drawing App with RaphaelJS and jQuery
* copyright 2010 Kayla Rose Martin - Licensed under the MIT license
* Inspired by http://stackoverflow.com/questions/3582344/draw-a-connection-line-in-raphaeljs
**/
function Circle(startX, startY, width, raphael) {
var start = {
x: startX,
y: startY,
w: width
};
var end = {
w: width
};
var getWidth = function() {
return end.w;
};
var redraw = function() {
node.attr({r: getWidth()});
}
var node = raphael.circle(start.x, start.y, getWidth());
node.attr({'fill': 'yellow', 'fill-opacity':0.3});
return {
updateStart: function(x, y) {
start.x = x;
start.y = y;
redraw();
return this;
},
updateEnd: function(x, y) {
var v = {
x: Math.abs(x - start.x),
y: Math.abs(y - start.y)
};
//Radius
end.w = Math.sqrt((Math.pow(v.x, 2) + Math.pow(v.y, 2)));
redraw();
return this;
},
clear: function() {
node.remove();
}
};
};
function Rect(startX, startY, width, height, raphael) {
var start = {
x: startX,
y: startY,
w: width,
h: height
};
var end = {
w: width,
h: height
};
...