Update cursor view when selection screen position changes

This commit is contained in:
Nathan Sobo
2014-04-01 16:35:26 -06:00
parent 9c2d321327
commit c44fd62eb1
3 changed files with 28 additions and 2 deletions

View File

@@ -1,12 +1,19 @@
{React, div} = require 'reactionary'
SubscriberMixin = require './subscriber-mixin'
CursorComponent = require './cursor-component'
module.exports =
SelectionComponent = React.createClass
render: ->
console.log "render selection component"
mixins: [SubscriberMixin]
render: ->
{selection, lineHeight, charWidth} = @props
{cursor} = selection
div className: 'selection',
CursorComponent({cursor, lineHeight, charWidth})
componentDidMount: ->
@subscribe @props.selection, 'screen-range-changed', => @forceUpdate()
componentWillUnmount: ->
@unsubscribe()