mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-28 09:01:33 +03:00
Use getElementsByClassName rather than jQuery
This commit is contained in:
parent
8a3f137519
commit
6eb72ac2a1
@ -1539,24 +1539,22 @@ class Editor extends View
|
||||
{row, column} = Point.fromObject(position)
|
||||
actualRow = Math.floor(row)
|
||||
|
||||
line = @lineElementForScreenRow(actualRow)
|
||||
lineElement = existingLineElement = line[0]
|
||||
lineElement = existingLineElement = @lineElementForScreenRow(actualRow)[0]
|
||||
unless existingLineElement
|
||||
lineElement = @buildLineElementForScreenRow(actualRow)
|
||||
line = $(lineElement)
|
||||
@renderedLines.append(lineElement)
|
||||
left = @positionLeftForLineAndColumn(line, column)
|
||||
left = @positionLeftForLineAndColumn(lineElement, column)
|
||||
unless existingLineElement
|
||||
@renderedLines[0].removeChild(lineElement)
|
||||
{ top: row * @lineHeight, left }
|
||||
|
||||
positionLeftForLineAndColumn: (line, column) ->
|
||||
lineCache = @pixelLeftCache.get(line[0])
|
||||
@pixelLeftCache.set(line[0], lineCache = {}) unless lineCache?
|
||||
positionLeftForLineAndColumn: (lineElement, column) ->
|
||||
lineCache = @pixelLeftCache.get(lineElement)
|
||||
@pixelLeftCache.set(lineElement, lineCache = {}) unless lineCache?
|
||||
|
||||
return lineCache[column] if lineCache[column]?
|
||||
|
||||
chars = line.find('.character')
|
||||
chars = lineElement.getElementsByClassName('character')
|
||||
left = 0
|
||||
for i in [0...column]
|
||||
left += chars[i].offsetWidth if chars[i]
|
||||
|
Loading…
Reference in New Issue
Block a user