Преглед изворни кода

fix: FreeText 修复跨页移动背景色bug

liutian пре 2 недеља
родитељ
комит
5b3859d5d2
1 измењених фајлова са 6 додато и 10 уклоњено
  1. 6 10
      packages/core/src/annotation/freetext.js

+ 6 - 10
packages/core/src/annotation/freetext.js

@@ -83,10 +83,6 @@ export default class Shape extends Base {
       annotation.color = '#000000'
     }
 
-    if (!annotation.bgColor) {
-      annotation.bgColor = 'transparent'
-    }
-
     if (!annotation.fontSize) {
       annotation.fontSize = 16
     }
@@ -119,7 +115,7 @@ export default class Shape extends Base {
       lineHeight: '1.2em',
       padding: '2px 4px',
       overflow: 'auto',
-      backgroundColor: annotation.bgColor,
+      backgroundColor: annotation.bgColor ? annotation.bgColor : 'transparent',
       '-webkit-user-select': 'text'
     })
 
@@ -137,7 +133,7 @@ export default class Shape extends Base {
       lineHeight: '1.2em',
       padding: '2px 4px',
       overflow: 'hidden',
-      backgroundColor: annotation.bgColor
+      backgroundColor: annotation.bgColor ? annotation.bgColor : 'transparent',
     })
     if (annotation.contents) {
       freetextElement.innerHTML = annotation.contents
@@ -788,10 +784,10 @@ export default class Shape extends Base {
             return
           }
           if ((minPage + 2) === maxPage || (minPage === 1 && maxPage === 2)) {
-        left = pageX - (startState.clickX - leftTop.x)
-        top = page.first > (this.page + 1) ? pagePoint.y : pagePoint.y - annotationHeight
-        right = pageX - (startState.clickX - rightBottom.x)
-        bottom = page.first > (this.page + 1) ? pagePoint.y + annotationHeight : pagePoint.y
+            left = pageX - (startState.clickX - leftTop.x)
+            top = page.first > (this.page + 1) ? pagePoint.y : pagePoint.y - annotationHeight
+            right = pageX - (startState.clickX - rightBottom.x)
+            bottom = page.first > (this.page + 1) ? pagePoint.y + annotationHeight : pagePoint.y
           } else if ((minPage + 1) === maxPage) {
             left = page.first > (this.page + 1) ? pagePoint.x : pagePoint.x - annotationWidth
             top = pageY - (startState.clickY - leftTop.y)