I've some troubl to bring a FarbicJS element to the front of the canvas.
After a few web browsing I've found this post : Control z-index in Fabric.js Howerver it seems to have absolutely no effect in my code.
EDIT : this topic also bring some other solutions but no effect either.
I may have done a silly mistake but I can't figure out where. Here is my code (at least, the relevant part) :
//first image, well displayed and functionnal
fabric.Image.fromURL(sourceImg, function(img){
//don't pay attention to following properties
img.left = YYY
img.top = XXX
img.width = whatever
img.height = whatever
img.rega = something
//big animation part
img.on('mouseover', function(){
//blabla
});
that.canvas.add(img);
});
//second image (text), not displayed
var myText = new fabric.Text("SI REGA2", {
//some properties...
left: YYY // Here coordonnates of the text are the same
top: XXX // than first image's coordonnates.
selectable: false,
hasControls: false,
hasBorders: false,
fontSize: 20
});
this.canvas.add(myText); //adding text to the canvas...
this.canvas.bringToFront(myText); //... and bringing back to the front in order to place it over the first image
There is no error in the console, so I think all is going well, but the text is not displayed. Or at least under the first image.
What should I do ?