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

The screenX and screenY of the drag event in the webview are wrong #177

Open
zhu-xiaoming opened this issue Jun 26, 2021 · 3 comments
Open

Comments

@zhu-xiaoming
Copy link

zhu-xiaoming commented Jun 26, 2021

I listened to the drag event, in the dragend event, I got screenX and screenY, and found that their values ​​are wrong.

Here is a minimal reproducible example, which is a repository generated using skpm/with-webview template:
https://github.com/little-tomorrow/sketch-plugin-test

Version Information

  • sketch version: 72.1
  • macos version: 11.3.1

To reproduce

  1. git clone https://github.com/little-tomorrow/sketch-plugin-test.git
  2. Run npm i to generate the my-plugin plugin in the project
  3. Start sketch, select plugin -> my-plugin -> my-command, At this time, the webview window will be opened
  4. Drag the github picture in the webview to the upper left corner of the screen
  5. Then open devtools through the right-click menu

Expected Behavior

Print out x: 0, y: 0 in devtools

Actual Behavior

Print out x: 123, y: 66 in devtools

Screenshots

image
image
image

@zhu-xiaoming
Copy link
Author

Additional information:
I found that by dragging pictures of different sizes to the upper left corner, the final printed information is also different, basically the value of x is the same, the value of y is very different

@mathieudutour
Copy link
Member

mathieudutour commented Jun 28, 2021

so on macOS, the origin is at the bottom left (as opposed to JavaScript where it's at the top left). Maybe I made a mistake when trying to convert the coordinates.

Could you have a look?

@zhu-xiaoming
Copy link
Author

zhu-xiaoming commented Jul 1, 2021

@mathieudutour drag to the bottom left corner, x: 123, y: 965

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

2 participants