Extract method in fabric.Canvas