How to manually fill contour elements manually on canvas

0

I need to fill in the elements drawn on the canvas, like paintbrush's paint bucket, is there a way to capture the closed shapes by clicking the drawn canvas?

$scope.autoria = {
               title:null,
               color:"blue",
               line:1,
               other_color:false,
               default_borracha: {
                   status:false
               },
               resizeImagem:false,
               drawPen:false,
               fillImage:true,
               isEraser:false,
               enabled_upload:false,
               enabled_edit:false,
               background:"/img/bg.png",
               current_img_index:0,
               canvas: document.getElementById('canvas')
           };

$(document).on("click", "#canvas", function (e) {
    if (!$scope.autoria.isEraser && !$scope.autoria.drawPen &&
         $scope.autoria.fillImage) {

          this.clicked = function () {
              ctx.beginPath();
              ctx.fillStyle = $scope.autoria.color;
              ctx.fill();
              ctx.closePath();
         }

         var x = e.clientX,
             y = e.clientY,
            ctx = $scope.autoria.canvas.getContext("2d");
         this.clicked();
    }
});
    
asked by anonymous 18.04.2018 / 16:06

0 answers