Take cursors off the GPU and position them on the lines layer

The compositor overhead is not worth it.
This commit is contained in:
Nathan Sobo
2014-07-27 11:37:36 -06:00
parent 444c18be34
commit 393552a4b6
5 changed files with 32 additions and 37 deletions

View File

@@ -8,22 +8,11 @@ CursorComponent = React.createClass
render: ->
{pixelRect, defaultCharWidth} = @props
{height, width} = pixelRect
{top, left, height, width} = pixelRect
width = defaultCharWidth if width is 0
WebkitTransform = @getTransform()
WebkitTransform = "translate(#{left}px, #{top}px)"
div className: 'cursor', style: {height, width, WebkitTransform}
getTransform: ->
{pixelRect, scrollTop, scrollLeft, useHardwareAcceleration} = @props
{top, left} = pixelRect
top -= scrollTop
left -= scrollLeft
if useHardwareAcceleration
"translate3d(#{left}px, #{top}px, 0px)"
else
"translate(#{left}px, #{top}px)"
shouldComponentUpdate: (newProps) ->
not isEqualForProperties(newProps, @props, 'pixelRect', 'scrollTop', 'scrollLeft', 'defaultCharWidth')
not isEqualForProperties(newProps, @props, 'pixelRect', 'defaultCharWidth')