i want to add the click event only on the stroke of the rectangle and avoid the click inside the rectangle.
Here is the code below:
var stage = new Kinetic.Stage({
container: 'container',
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
var rect = new Kinetic.Rect({
x: 239,
y: 75,
width: 100,
height: 50,
fill: 'green',
stroke: 'black',
strokeWidth: 4
});
rect.on('click', function () {
var fill = this.getFill() == 'red' ? '#00d00f' : 'red';
this.setFill(fill);
layer.draw();
});
layer.add(rect);
stage.add(layer);
and the fiddle : jsfiddle.net/6N3PB/