Files
atom/src/cursor-component.coffee
Nathan Sobo 393552a4b6 Take cursors off the GPU and position them on the lines layer
The compositor overhead is not worth it.
2014-07-27 11:47:33 -06:00

19 lines
600 B
CoffeeScript

React = require 'react-atom-fork'
{div} = require 'reactionary-atom-fork'
{isEqualForProperties} = require 'underscore-plus'
module.exports =
CursorComponent = React.createClass
displayName: 'CursorComponent'
render: ->
{pixelRect, defaultCharWidth} = @props
{top, left, height, width} = pixelRect
width = defaultCharWidth if width is 0
WebkitTransform = "translate(#{left}px, #{top}px)"
div className: 'cursor', style: {height, width, WebkitTransform}
shouldComponentUpdate: (newProps) ->
not isEqualForProperties(newProps, @props, 'pixelRect', 'defaultCharWidth')