JSFiddle - React, Tailwind, and code Playground

HTML

<div id="stage"></div>

JavaScript

var paper = Raphael('stage', 300, 300);
var r = paper.rect(50,100,30,50).attr({fill:"#FFF"}).rotate(45),
    t = paper.text(30, 140, "Hello");

var p = paper.set(r, t);

r.set = p, t.set = p;


p.newTX=0,p.newTY=0,p.fDx=0,p.fDy=0,p.tAddX,p.tAddY,p.reInitialize=false,

start = function () {
    
},
move = function (dx, dy) {
    var a = this.set;
	a.tAddX=dx-a.fDx,a.tAddY=dy-a.fDy,a.fDx=dx,a.fDy=dy;
	if(a.reInitialize)
	{
		a.tAddX=0,a.fDx=0,a.tAddY=0;a.fDy=0,a.reInitialize=false;
	}
	else
	{
		a.newTX+=a.tAddX,a.newTY+=a.tAddY;
		a.attr({transform: "t"+a.newTX+","+a.newTY});
	}

},
up = function () {
	this.set.reInitialize=true;
};
p.drag(move, start, up);