Search code examples
javascriptace-editormouse-cursor

Get row and column number from mouse coordinates


I am using Ace for my in browser text editor.

editor.on("mousemove", function (e)
{
  // use clientX clientY to get row and column locations
});

From clientX clientY coordinates i need actual row and column number on the editor.

Looking at Ace api but cant find anything related.

Do you know any way i can achieve this?

Thanks


Solution

  • Found it.

    editor.on("mousemove", function (e)
    {
       var position = e.getDocumentPosition();
    });
    

    found it looking inside event object in chrome debugger.