lib/multi-wrap-guide-view.js
// Creates and appends all guides to view.
Creates and appends all guides to view.
Creates and appends all guides to view .
appendGuides (positions, horizontal) {
    const lineHeight = this.editor.getLineHeightInPixels()
    const charWidth = this.editorElement.getDefaultCharacterWidth()
    const scrollTop = this.editorElement.getScrollTop()
    const scrollLeft = this.editorElement.getScrollLeft()
    const group = createElement('div', 'multi-wrap-guide-group')
    if (horizontal) {
      group.classList.add('horizontal')
    } else {
      group.classList.add('vertical')
    }
    for (const position of positions) {
      if (group.classList.contains('horizontal')) {
        if ((this.editor.getLineCount() + (2 * this.editor.getRowsPerPage())) < position) continue
      }
      const tip = createElement('div', 'multi-wrap-guide-tip')
      tip.textContent = position
      const line = createElement('div', 'multi-wrap-guide-line')
      line.append(tip)
      const guide = createElement('div', 'multi-wrap-guide')
      if (!atom.config.get('multi-wrap-guide.locked')) { guide.classList.add('draggable') }
      guide.onmousedown = event => this.mouseDownGuide(guide, event)
      guide.append(line)
      if (group.classList.contains('horizontal')) {
        let row = this.editor.screenRowForBufferRow(position)
        if (this.editor.isFoldedAtBufferRow(position)) { row += 1 }
        guide.style.top = `${(lineHeight * row) - scrollTop}px`
      } else {
        guide.style.left = `${(charWidth * position) - scrollLeft}px`
      }
      group.append(guide)
    }
    this.element.append(group)
  }
appendGuides ( positions , horizontal ) { const lineHeight = this . editor . getLineHeightInPixels ( ) const charWidth = this . editorElement . getDefaultCharacterWidth ( ) const scrollTop = this . editorElement . getScrollTop ( ) const scrollLeft = this . editorElement . getScrollLeft ( ) const group = createElement ( 'div' , 'multi-wrap-guide-group' ) if ( horizontal ) { group . classList . add ( 'horizontal' ) } else { group . classList . add ( 'vertical' ) } for ( const position of positions ) { if ( group . classList . contains ( 'horizontal' ) ) { if ( ( this . editor . getLineCount ( ) + ( 2 * this . editor . getRowsPerPage ( ) ) ) < position ) continue } const tip = createElement ( 'div' , 'multi-wrap-guide-tip' ) tip . textContent = position const line = createElement ( 'div' , 'multi-wrap-guide-line' ) line . append ( tip ) const guide = createElement ( 'div' , 'multi-wrap-guide' ) if ( ! atom . config . get ( 'multi-wrap-guide.locked' ) ) { guide . classList . add ( 'draggable' ) } guide . onmousedown = event => this . mouseDownGuide ( guide , event ) guide . append ( line ) if ( group . classList . contains ( 'horizontal' ) ) { let row = this . editor . screenRowForBufferRow ( position ) if ( this . editor . isFoldedAtBufferRow ( position ) ) { row += 1 } guide . style . top = ` ${ ( lineHeight * row ) - scrollTop } ` } else { guide . style . left = ` ${ ( charWidth * position ) - scrollLeft } ` } group . append ( guide ) } this . element . append ( group ) }
Creates and appends all guides to view.
Creates and appends all guides to view .
// don't draw very distant horizontal guides