Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report/Feeback]拖拽抖动问题,尝试的解决思路 #360

Open
HuiFeiYa opened this issue Jul 12, 2021 · 0 comments
Open

[Bug Report/Feeback]拖拽抖动问题,尝试的解决思路 #360

HuiFeiYa opened this issue Jul 12, 2021 · 0 comments

Comments

@HuiFeiYa
Copy link
Contributor

问题描述
问题1:参考 #351

  1. 找到控制点移动事件在 support/shape.js 文件中的 mousedownForMark 方法。内部方法 move 中调用handlePointMoveProp 父级传递的 props.handlePointMove 事件。
  2. 在移动时间中发现 calcVHLine 事件导致抖动。走到 isPointMove 逻辑,在这里会更新 pos 的值,导致渲染元素时候出现抖动。
// 路径 editor/canvas/edit.js
          if (Math.abs(offset) <= 5) {
            if (isPointMove) {
               this.setElementPosition({ width: ewidth + offset })
            } else {
              this.setElementPosition({ left: eleft + offset })
            }
            this.drawVLine(referX)
            hasVLine = true
          }

问题2: 元素宽高小于0时候会出现元素被拖拽平移的效果。
可以进行限制

      // 路径 support/shape.js
      let move = moveEvent => {
       // ... 
        pos.height = newHeight > 0 ? newHeight : 0
        pos.width = newWidth > 0 ? newWidth : 0
        pos.left = newWidth > 0 ? +left + (hasL ? disX : 0) : pos.left
        pos.top = newHeight > 0 ? +top + (hasT ? disY : 0) : pos.top
        this.handlePointMoveProp(pos)
      }
ly525 pushed a commit that referenced this issue Dec 5, 2021
ly525 pushed a commit that referenced this issue Dec 5, 2021
ly525 pushed a commit that referenced this issue Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant