question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drag&Drop position

See original GitHub issue

Hi,

I try to have the mouse position when i drag&drop a block. Is it possible to have the X position and Y position with this event or another ? editor.on('block:drag:stop', model => [...]);

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
NicoEnglercommented, Mar 4, 2019

Hi, one attempt to solve this could be:

  1. Find the iframe of the canvas
  2. Find the mouse position inside the iframe

To do so, you could combine functions shared on StackOverflow.

The first step could be tackled with the function found right here: https://stackoverflow.com/a/1452885/8658366

The second step could be tackled with the function found right here: https://stackoverflow.com/a/7790764/8658366

I have combined those and set up a demo for you right here: https://jsfiddle.net/6f3rw4um/ Check the output of the console.

Good luck

0reactions
lock[bot]commented, Mar 10, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drag'n'Drop with mouse events - The Modern JavaScript Tutorial
Drag 'n'Drop is a great interface solution. Taking something and dragging and dropping it is a clear and simple way to do many...
Read more >
Drag and drop position relative - javascript - Stack Overflow
it seems i found answer Implementing drag and drop on relatively positioned elements in JavaScript. and as it says, with relative position, ...
Read more >
Drag and Drop with JavaScript - W3docs
In this chapter, we will learn about a great interface solution of JavaScript, called Drag and Drop. Find out why it should be...
Read more >
Vanilla JavaScript Drag n Drop Position - Daily Dev Tips
Now we will look at how we can drop it at a specific position. We drop it at the top half of the...
Read more >
Drag and drop element in a list - HTML DOM
Drag and drop element in a list. In this example, we will create a sortable list whose items can be dragged and dropped...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found