For a few days now, I have been trying to change the fill color of the control that is scaling an object.
Here is a gif of what I'm talking about:
I would like some guidance on how to achieve this. I have been digging through Fabricjs documentation for days trying to get an idea on how to approach this problem.
https://github.com/fabricjs/fabric.js/wiki/Working-with-events
My theory was to bind to mouse:down
and mouse:up
events. When mouse:down
event fires, obtain the control context and change its fill color and when the mouse:up
fires, restore the fill color.
Unfortunately, I can't find any fabricjs method that would allow me to obtain the control context.
http://fabricjs.com/docs/fabric.Canvas.html
http://fabricjs.com/docs/fabric.Object.html
canvas.on('mouse:down',(){
// Obtain control context and change fill
});
canvas.on('mouse:up',(){
// Obtain control context and restore fill
});
I'm using Fabricjs version 3.2.0