<commit_before>'use strict'

window.angular.module('scegratooApp')
  .service('TreeNodeAttributeTextbox', (React, R) => {
    const {
      flatten,
      map,
      mergeAll,
      pipe,
      split,
    } = R

    const splitVector = pipe(
      split(' '),
      map(split(',')),
      flatten
    )

    return React.createClass({
      displayName: 'TreeNodeAttributeTextbox',
      propTypes: {
        attributeName: React.PropTypes.string.isRequired,
        index: React.PropTypes.number.isRequired,
        owner: React.PropTypes.object.isRequired,
        style: React.PropTypes.object
      },
      handleChangeEvent: function (event) {
        const {attributeName, index, owner} = this.props
        const oldVector = splitVector(owner.getAttribute(attributeName))

        oldVector[index] = event.currentTarget.value
        owner.setAttribute(attributeName, oldVector.join(' '))

        this.forceUpdate()
      },
      render: function () {
        const {owner, index, attributeName} = this.props

        return (
          <input
            type='number'
            step='0.1'
            value={splitVector(owner.getAttribute(attributeName))[index]}
            onChange={this.handleChangeEvent}
            style={mergeAll([
              {width: '50px'},
              this.props.style
            ])}
          />
        )
      }
    })
  })
<commit_msg>enable focus follows mouse for vectors (translation and rotation)<commit_after>'use strict'

window.angular.module('scegratooApp')
  .service('TreeNodeAttributeTextbox', (React, R) => {
    const {
      flatten,
      map,
      mergeAll,
      pipe,
      split,
    } = R

    const splitVector = pipe(
      split(' '),
      map(split(',')),
      flatten
    )

    return React.createClass({
      displayName: 'TreeNodeAttributeTextbox',
      propTypes: {
        attributeName: React.PropTypes.string.isRequired,
        index: React.PropTypes.number.isRequired,
        owner: React.PropTypes.object.isRequired,
        style: React.PropTypes.object
      },
      handleChangeEvent: function (event) {
        const {attributeName, index, owner} = this.props
        const oldVector = splitVector(owner.getAttribute(attributeName))

        oldVector[index] = event.currentTarget.value
        owner.setAttribute(attributeName, oldVector.join(' '))

        this.forceUpdate()
      },
      render: function () {
        const {owner, index, attributeName} = this.props

        return (
          <input
            type='number'
            step='0.1'
            value={splitVector(owner.getAttribute(attributeName))[index]}
            onChange={this.handleChangeEvent}
            onMouseEnter={() => this.getDOMNode().focus()}
            style={mergeAll([
              {width: '50px'},
              this.props.style
            ])}
          />
        )
      }
    })
  })

{'fraction_non_alphanumeric': 0.1203607353451266, 'fraction_numerical': 0.002774887270204648, 'mean_word_length': 2.048625792811839, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4816249', 'n_tokens_mistral': 804, 'n_tokens_neox': 800, 'n_words': 140}