lib/multi-wrap-guide-view.js
// Returns [column, row] numbers of mouse cursor from a given mouse event.
Returns [column, row] numbers of mouse cursor from a given mouse event.
Returns [ column row ] numbers of mouse cursor from a given mouse event .
positionFromMouseEvent (e) {
    const [offsetLeft, offsetTop] = Array.from(this.offsetFromMouseEvent(e))
    const targetLeft = offsetLeft + this.editorElement.getScrollLeft()
    const targetTop = offsetTop + this.editorElement.getScrollTop()
    let left = 0
    let column = 0
    const charWidth = this.editorElement.getDefaultCharacterWidth()
    while (targetLeft > (left + (charWidth / 2))) {
      left += charWidth
      column += 1
    }
    let top = 0
    let row = 0
    const lineHeight = this.editor.getLineHeightInPixels()
    while (targetTop > (top + (lineHeight / 2))) {
      top += lineHeight
      row += 1
    }
    return [column, row]
  }
positionFromMouseEvent ( e ) { const [ offsetLeft , offsetTop ] = Array . from ( this . offsetFromMouseEvent ( e ) ) const targetLeft = offsetLeft + this . editorElement . getScrollLeft ( ) const targetTop = offsetTop + this . editorElement . getScrollTop ( ) let left = 0 let column = 0 const charWidth = this . editorElement . getDefaultCharacterWidth ( ) while ( targetLeft > ( left + ( charWidth / 2 ) ) ) { left += charWidth column += 1 } let top = 0 let row = 0 const lineHeight = this . editor . getLineHeightInPixels ( ) while ( targetTop > ( top + ( lineHeight / 2 ) ) ) { top += lineHeight row += 1 } return [ column , row ] }
Returns [column, row] numbers of mouse cursor from a given mouse event.
Returns [ column row ] numbers of mouse cursor from a given mouse event .