2 Коммиты a576602268 ... 373c421251

Автор SHA1 Сообщение Дата
  liutian 373c421251 fix: 修复选中注释及删除注释 API 问题 3 недель назад
  liutian a576602268 fix: 修复选中注释及删除注释 API 问题 3 недель назад

+ 1 - 1
packages/core/src/annotation/freetext.js

@@ -601,7 +601,7 @@ export default class Shape extends Base {
   }
 
   handleOutside () {
-    this.hidden = !this.hidden
+    this.hidden = true
 
     if (this.layer.selectedElementName === this.annotation.name) {
       this.layer.selectedElementName = null

+ 1 - 1
packages/core/src/annotation/ink.js

@@ -135,7 +135,7 @@ export default class Ink extends Base {
   }
 
   handleOutside () {
-    this.hidden = !this.hidden
+    this.hidden = true
     if (this.layer.selectedElementName === this.annotation.name) {
       this.layer.selectedElementName = null
     }

+ 1 - 1
packages/core/src/annotation/line.js

@@ -254,7 +254,7 @@ export default class Line extends Base {
   }
 
   handleOutside () {
-    this.hidden = !this.hidden
+    this.hidden = true
     if (this.layer.selectedElementName === this.annotation.name) {
       this.layer.selectedElementName = null
     }

+ 1 - 1
packages/core/src/annotation/shape.js

@@ -431,7 +431,7 @@ export default class Shape extends Base {
   }
 
   handleOutside () {
-    this.hidden = !this.hidden
+    this.hidden = true
     if (this.layer.selectedElementName === this.annotation.name) {
       this.layer.selectedElementName = null
     }

+ 1 - 1
packages/core/src/annotation/stamp.js

@@ -407,7 +407,7 @@ export default class Stamp extends Base {
   }
 
   handleOutside () {
-    this.hidden = !this.hidden
+    this.hidden = true
     if (this.layer.selectedElementName === this.annotation.name) {
       this.layer.selectedElementName = null
     }

+ 1 - 1
packages/core/src/form/check_box.js

@@ -545,7 +545,7 @@ export default class CheckBox extends Base {
       document.getElementById('propertyPanelButton').click()
     }
 
-    this.hidden = !this.hidden
+    this.hidden = true
 
     if (this.layer.annotationStore.selectedElementName === this.annotation.name) {
       this.layer.annotationStore.selectedElementName = null

+ 1 - 1
packages/core/src/form/combo_box.js

@@ -532,7 +532,7 @@ export default class ComboBox extends Base {
       document.getElementById('propertyPanelButton').click()
     }
 
-    this.hidden = !this.hidden
+    this.hidden = true
 
     if (this.layer.annotationStore.selectedElementName === this.annotation.name) {
       this.layer.annotationStore.selectedElementName = null

+ 1 - 1
packages/core/src/form/list_box.js

@@ -508,7 +508,7 @@ export default class ListBox extends Base {
       document.getElementById('propertyPanelButton').click()
     }
 
-    this.hidden = !this.hidden
+    this.hidden = true
 
     if (this.layer.annotationStore.selectedElementName === this.annotation.name) {
       this.layer.annotationStore.selectedElementName = null

+ 1 - 1
packages/core/src/form/push_button.js

@@ -486,7 +486,7 @@ export default class PushButton extends Base {
       this.layer.selectedElementName = null
     }
 
-    this.hidden = !this.hidden
+    this.hidden = true
 
     if (this.layer.annotationStore.selectedElementName === this.annotation.name) {
       this.layer.annotationStore.selectedElementName = null

+ 1 - 1
packages/core/src/form/radio_button.js

@@ -548,7 +548,7 @@ export default class RadioButton extends Base {
       document.getElementById('propertyPanelButton').click()
     }
 
-    this.hidden = !this.hidden
+    this.hidden = true
 
     if (this.layer.annotationStore.selectedElementName === this.annotation.name) {
       this.layer.annotationStore.selectedElementName = null

+ 1 - 1
packages/core/src/form/text_field.js

@@ -471,7 +471,7 @@ export default class TextField extends Base {
       this.layer.selectedElementName = null
     }
 
-    this.hidden = !this.hidden
+    this.hidden = true
 
     if (this.layer.annotationStore.selectedElementName === this.annotation.name) {
       this.layer.annotationStore.selectedElementName = null

+ 8 - 3
packages/core/src/pdf_page_view.js

@@ -457,11 +457,16 @@ class PDFPageView {
 
   selectAnnotation(annotation) {
     annotation.name && (this.annotationStore.toSelectAnnotationName = annotation.name)
-    if (!this.compdfAnnotationLayer) return
-    const annotationsArray = this.compdfAnnotationLayer.annotationsArray
+    const compdfAnnotationLayer = this.compdfAnnotationLayer
+    if (!compdfAnnotationLayer) return
+    const annotationsArray = compdfAnnotationLayer.annotationsArray
     const annotationIndex = annotationsArray.findIndex(item => item.annotation.name === this.annotationStore.toSelectAnnotationName)
+    if (compdfAnnotationLayer.selectedElementName) {
+      const selectedAnnotationIndex = annotationsArray.findIndex(item => item.annotation.name === compdfAnnotationLayer.selectedElementName)
+      selectedAnnotationIndex > -1 && compdfAnnotationLayer.annotationsArray[selectedAnnotationIndex].handleOutside()
+    }
     if (annotationIndex > -1) {
-      this.compdfAnnotationLayer.annotationsArray[annotationIndex].selectAnnotation()
+      compdfAnnotationLayer.annotationsArray[annotationIndex].selectAnnotation()
       this.annotationStore.toSelectAnnotationName = null
     }
   }