JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
canvas {
border: 1px solid #9C9898;
margin :25%;
}
</style>
<script src="http://www.html5canvastutorials.com/libraries/kinetic-v4.0.1.js"></script>
<script>
window.onload = function() {
document.getElementById('container').addEventListener('click', function(e) {
alert("canvas clicked ") ;
}, false);
var stage = new Kinetic.Stage({
container: 'container',
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
var oval = new Kinetic.Ellipse({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: {
x: 100,
y: 50
},
fill: 'yellow',
stroke: 'black',
strokeWidth: 4,
draggable : true
});
oval.on("click",function(e){
e.stopPropagation ();
alert("Shape clicked");
});
// add the shape to the layer
layer.add(oval);
// add the layer to the stage
stage.add(layer);
};
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>