We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to avoid focus to comment box on comment panel when arrow annotation is added

Hi,

When we add an arrow annotation, the pdf viewer automatically sets focus to comment box on comment panel. My questions are:

  1. Is it possible not to add comment automatically for arrow annotation.
  2. Is it possible not to focus automatically for arrow annotation when comment panel is open.

Thank you

5 Replies

CK Chinnamunia Karthik Chinna Thambi Syncfusion Team January 4, 2023 04:56 AM UTC

While adding the annotations the comment box on comment panel is focused automatically when the comment panel is open is the behaviour of the PDF Viewer. If you can elaborate your requirement as why do you need not to focus the comment panel while adding the arrow annotation, we will check its feasibility to consider or not, or to suggest alternate option to achieve your requirement.



SR Sriraman replied to Chinnamunia Karthik Chinna Thambi January 4, 2023 04:59 AM UTC

As per my requirement, we do not want to add any comment for line/arrow annotation.


If there is a workaround to not focus the comment panel while adding the line/arrow annotation it is fine for now.



CK Chinnamunia Karthik Chinna Thambi Syncfusion Team January 5, 2023 02:17 AM UTC

Refer the below code snippet and sample to achieve your requirement. In the given sample, we are disabling the comment panel for line and arrow annotations alone while adding and selecting annotations.


Code snippet:


    public annotationAdd(args){

      var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];

 

      // Disble comment panel for line and arrow annotations alone.

      if ((args.annotationType === "Line") || args.annotationType === "Arrow"){

        console.log(args);

        viewer.enableCommentPanel = false;

      }

      else{

        viewer.enableCommentPanel = true;

      }

    }

 

    public annotationSelect(args){

      var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];

 

      // Disble comment panel for line and arrow annotations alone.

      if ((args.annotation.subType === "Line") || args.annotation.subType === "Arrow"){

        console.log(args);

        viewer.enableCommentPanel = false;

      }

      else{

        viewer.enableCommentPanel = true;

      }

    }

 


Sample: https://stackblitz.com/edit/angular-dxub1a-4nglne?file=app.component.ts,app.component.html,package.json,app.component.css




SR Sriraman January 6, 2023 04:38 AM UTC

Thanks for your reply and suggestion. However, it is not working as expected. For example, if we have comment panel open and add/select a line annotation, it hides the comment panel. Similarly lets say you have a comment panel open and you are checking the comments, if there is a comment for line annotation and click on it, it hides the comment pa





CK Chinnamunia Karthik Chinna Thambi Syncfusion Team January 9, 2023 05:17 PM UTC

Refer the below code snippet and sample for not to disable the comment panel while clicking the line/arrow annotation comments.

 

Code snippet:

 

 

    public annotationSelect(args){

      var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];

      console.log(args);

 

      // Disble comment panel for line and arrow annotations alone.

      if ((args.annotation.subType === "Line" || args.annotation.subType === "Arrow") && (!args.isProgrammaticSelection)){

        viewer.enableCommentPanel = false;

      }

      else{

        viewer.enableCommentPanel = true;

      }

    }

 

Sample: https://stackblitz.com/edit/angular-dxub1a-gzaaut?file=app.component.ts,app.component.html,package.json,app.component.css

 

Note: While selecting the line/arrow annotations the comment panel is disabled.


Loader.
Up arrow icon