JSFiddle - React, Tailwind, and code Playground
HTML
<input style='margin-left: 20px;' id="teste" disabled></input>
<div id="papercanvas"></div>
JavaScript
// Creates canvas 320 Ă— 200 at 10, 50
var paper = Raphael(document.getElementById("papercanvas"), 520, 500);
var rect = paper.rect(20, 0, 50 , 50);
// Sets the fill attribute of the circle to red (#f00)
rect.attr("fill", "#f00");
// Sets the stroke attribute of the circle to white
rect.attr("stroke", "#fff");
//////////////////////////////////////////
var text = paper.text(10, 10, "1");
text.attr('cursor','pointer');
text.attr('font-size', '20px');
text.drag(onDragMove, onDragStart, onDragComplete);
function onDragStart(){
this.ox = this.attr('x');
this.oy = this.attr('y');
}
function onDragMove(dx,dy){
this.attr({x: this.ox + dx, y: this.oy + dy });
}
function onDragComplete(){
if((this.attr('x') > 20 && (this.attr('x') < 70)) && (this.attr('y') < 50)) {
this.attr('fill', 'white');
rect.attr('fill', 'black');
} else {
this.attr('fill', 'black');
rect.attr('fill', 'red');
}
};