JSFiddle - React, Tailwind, and code Playground
by amadanNM
CSS
body
{
background:black;
}
JavaScript
//
// rect with line handlers
//
paper = new Raphael(0,0,500,500);
createRect(100,100,100,50);
function createRect(x,y,width,height)
{
var rect = paper.rect(x,y,width,height).attr({"fill":"white","stroke":"red"});
var topCtrl = paper.circle(x+(width/2),y,5).attr({"fill":"red"});
var bottomCtrl = paper.circle(x+(width/2),y+height,5).attr({"fill":"red"});
var leftCtrl = paper.circle(x,y+(height/2),5).attr({"fill":"red"});
var rightCtrl = paper.circle(x+(width),y+(height/2),5).attr({"fill":"red"});
addHoverListener(topCtrl);
addHoverListener(leftCtrl);
addHoverListener(rightCtrl);
addHoverListener(bottomCtrl);
}
function addHoverListener(obj)
{
obj.mouseover(function(event){
obj.attr({"fill":"green"});
});
obj.mouseout(function(event){
obj.attr({"fill":"red"});
});
}