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]能否少一些 神仙 写法,把人都看懵了。 #269

Closed
puxiao opened this issue May 7, 2024 · 1 comment
Closed

[Bug report]能否少一些 神仙 写法,把人都看懵了。 #269

puxiao opened this issue May 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@puxiao
Copy link

puxiao commented May 7, 2024

问题描述
我在看 src/views/Editor/Canvas/hooks/useSelectElement.ts 这个代码,然后我看到了

// 如果目标元素已被选中,同时也是当前操作元素,那么当目标元素在该状态下再次被点击时,将被设置为多选元素中的激活成员
else if (activeGroupElementId.value !== element.id) {
  const startPageX = e instanceof MouseEvent ? e.pageX : e.changedTouches[0].pageX
  const startPageY = e instanceof MouseEvent ? e.pageY : e.changedTouches[0].pageY

  ;(e.target as HTMLElement).onmouseup = (e: MouseEvent) => {
    const currentPageX = e.pageX
    const currentPageY = e.pageY

    if (startPageX === currentPageX && startPageY === currentPageY) {
      mainStore.setActiveGroupElementId(element.id)
      ;(e.target as HTMLElement).onmouseup = null
    }
  }
}

;(e.target as HTMLElement).onmouseup = (e: MouseEvent) => {...

;(e.target as HTMLElement).onmouseup = null

这前面还额外增加了一个 分号,还不能删除,删除报错,

我在哪,我是谁,我会JS吗,我咋看不懂~~~

@puxiao puxiao added the bug Something isn't working label May 7, 2024
@puxiao puxiao closed this as completed May 7, 2024
@luckymore
Copy link

普信猿,你确实该好好学学 js 了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants