highlightBoundingBoxes()

in web-app-demo/Frontend/src/app/components/entity-tab/entity-tab.component.ts [259:296]


  highlightBoundingBoxes(data: any) {
    const canvas = <HTMLCanvasElement>document.getElementById(LAYER3)!;

    // Gets the canvas and sets teh editing mode to draw over everything
    const context = canvas.getContext("2d")!;

    const drawClient = new DocumentAnnotation();

    context.globalCompositeOperation = "source-over";
    if (this.processor == "OCR" || this.processor == "INVOICE") {
      const color = this.processor == "OCR" ? ORANGE : BLUE;
      drawClient.drawBoundingBoxes(
        context,
        canvas,
        null,
        color,
        "fill",
        data.bounding
      );
    } else if (this.processor == "FORM") {
      drawClient.drawBoundingBoxes(
        context,
        canvas,
        null,
        RED,
        "fill",
        data.bounding[0].value
      );
      drawClient.drawBoundingBoxes(
        context,
        canvas,
        null,
        BLUE,
        "fill",
        data.bounding[0].name
      );
    }
  }