Quellcode durchsuchen

fix: 回归测试修复

wzl vor 3 Wochen
Ursprung
Commit
42ccd35efc

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

@@ -642,7 +642,7 @@ export default class Shape extends Base {
   handleMouseMove (event) {
     if (event.button !== 0 && event.type === 'mousemove') return
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -172,7 +172,7 @@ export default class Ink extends Base {
   handleMouseMove (event) {
     if (event.button !== 0 && event.type === 'mousemove') return
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -398,7 +398,7 @@ export default class Line extends Base {
   handleMouseMove (event) {
     if (event.button !== 0 && event.type === 'mousemove') return
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -486,7 +486,7 @@ export default class Link extends Base {
   handleMouseMove (event) {
     if (event.button !== 0 && event.type === 'mousemove') return
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -463,7 +463,7 @@ export default class Shape extends Base {
   handleMouseMove (event) {
     if (event.button !== 0 && event.type === 'mousemove') return
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -423,10 +423,9 @@ export default class Stamp extends Base {
       event.stopPropagation()
     }
     if (event.type === 'touchstart') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
       document.body.style.userSelect = 'none';
       document.getElementById('app').style.touchAction = 'none';
-      document.querySelector('.document-container').style.overflow = 'hidden'
     }
     const operatorId = event.target.getAttribute('data-id')
   

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

@@ -144,7 +144,7 @@ export default class Text extends Base {
   handleMouseMove (event) {
     if (event.button !== 0 && event.type === 'mousemove') return
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     const { pageX, pageY } = getClickPoint(event)
     if (pageX === this.startState.clickX && pageY === this.startState.clickY) return

+ 1 - 1
packages/core/src/editor/image_editor.js

@@ -509,7 +509,7 @@ export class ImageEditor {
     this.moving = true
     
     if (e.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
 
     const { pageX, pageY } = getClickPoint(e)

+ 1 - 1
packages/core/src/editor/text_editor.js

@@ -649,7 +649,7 @@ export class TextEditor {
     this.hidePopup()
     
     if (e.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
 
     if (this.state === 1) {

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

@@ -600,7 +600,7 @@ export default class CheckBox extends Base {
 
   handleMouseMove (event) {
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -576,7 +576,7 @@ export default class ComboBox extends Base {
 
   handleMouseMove (event) {
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)
@@ -896,6 +896,7 @@ export default class ComboBox extends Base {
             value: props.item,
             index: annotation.items.length - 1
           }
+          props.selected = annotation.selected
         }
       }
 
@@ -930,11 +931,14 @@ export default class ComboBox extends Base {
           Value: items[toIndex].Value,
           String: items[toIndex].String
         }
+        props.selected = 0
+        annotation.selected = 0
 
         const optionElement = this.selectElement.options[fromIndex]
         optionElement.remove()
 
         this.selectElement.insertBefore(optionElement, this.selectElement.options[toIndex])
+        this.selectElement.selectedIndex = 0
       }
     }
 

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

@@ -152,8 +152,8 @@ export default class ListBox extends Base {
           'div',
           {
             width: '100%',
-            height: '30px',
-            lineHeight: '30px',
+            height: Math.round(20 * this.scale) + 'px',
+            lineHeight: Math.round(20 * this.scale) + 'px',
             borderBottom: '1px solid #666666',
             overflow: 'hidden',
             textOverflow: 'ellipsis',
@@ -552,7 +552,7 @@ export default class ListBox extends Base {
 
   handleMouseMove(event) {
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)
@@ -865,8 +865,8 @@ export default class ListBox extends Base {
             'div',
             {
               width: '100%',
-              height: '30px',
-              lineHeight: '30px',
+              height: Math.round(20 * this.scale) + 'px',
+              lineHeight: Math.round(20 * this.scale) + 'px',
               borderBottom: '1px solid #666666',
               overflow: 'hidden',
               textOverflow: 'ellipsis',

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

@@ -529,7 +529,7 @@ export default class PushButton extends Base {
 
   handleMouseMove (event) {
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -603,7 +603,7 @@ export default class RadioButton extends Base {
 
   handleMouseMove (event) {
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -462,7 +462,7 @@ export default class SignatureFields extends Base {
   handleMouseMove (event) {
     if (event.button !== 0 && event.type === 'mousemove') return
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

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

@@ -534,7 +534,7 @@ export default class TextField extends Base {
 
   handleMouseMove (event) {
     if (event.type === 'touchmove') {
-      document.querySelector('.document-container').style.overflow = 'hidden'
+      document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
     }
     this.moving = true
     const { pageX, pageY } = getClickPoint(event)

+ 2 - 2
packages/core/src/markup/text_annotation.js

@@ -260,7 +260,7 @@ class TextAnnotation extends BaseAnnotation {
 
     this.eventBus._off('markupUpdate', this.onUpdateMarkup)
     this.ctx.clearRect(this.rect.left * this.ratio, this.rect.top * this.ratio, this.rect.width * this.ratio, this.rect.height * this.ratio)
-    this.ctx.putImageData(this.baseImageData, 0, 0, this.rect.left * this.ratio, this.rect.top * this.ratio, Math.round(this.rect.width * this.ratio + this.lineWidth + 2), Math.round(this.rect.height * this.ratio + this.lineWidth + 2))
+    this.ctx.putImageData(this.baseImageData, 0, 0, this.rect.left * this.ratio, this.rect.top * this.ratio, Math.round(this.rect.width * this.ratio + this.lineWidth + 20), Math.round(this.rect.height * this.ratio + this.lineWidth + 20))
     this.eventBus.dispatch('markupUpdate', {
       name: this.annotation.name,
       pageIndex: this.page,
@@ -330,7 +330,7 @@ class TextAnnotation extends BaseAnnotation {
     ) return
 
     this.ctx.clearRect(this.rect.left * this.ratio, this.rect.top * this.ratio, this.rect.width * this.ratio, this.rect.height * this.ratio)
-    this.ctx.putImageData(this.baseImageData, 0, 0, this.rect.left * this.ratio, this.rect.top * this.ratio, Math.round(this.rect.width * this.ratio + this.lineWidth + 2), Math.round(this.rect.height * this.ratio + this.lineWidth + 2))
+    this.ctx.putImageData(this.baseImageData, 0, 0, this.rect.left * this.ratio, this.rect.top * this.ratio, Math.round(this.rect.width * this.ratio + this.lineWidth + 20), Math.round(this.rect.height * this.ratio + this.lineWidth + 20))
     this.drawCanvas(this.positionArray)
   }
 

+ 6 - 6
packages/core/src/worker/compdfkit_worker.js

@@ -605,18 +605,18 @@ class CPDFWorker {
       if (annotation.fontName || annotation.fontSize || annotation.color) {
         setAnnotFontData(annotation)
       }
-      if (annotation.selected || annotation.selected === 0) {
-        const result = setAnnotSelected(annotation)
-        if (result) {
-          return result
-        }
-      }
       if (annotation.item) {
         addWidgetItem(annotation)
       }
       if (annotation.moveOption) {
         setWidgetItems(annotation)
       }
+      if (annotation.selected || annotation.selected === 0) {
+        const result = setAnnotSelected(annotation)
+        if (result) {
+          return result
+        }
+      }
       if (annotation.hasOwnProperty('deleteItemIndex')) {
         deleteWidgetItem(annotation)
       }