<commit_before>import React from 'react';
import EventEmitter from 'events';
import d3 from 'd3';
import CursorPane from './CursorPane';
import CanvasPane from './CanvasPane';


const MODE = {
    HAND: {},
    LINE: {}
};


export default class Whiteboard extends React.Component {

    static get propTypes() {
        return {
            width: React.PropTypes.number,
            height: React.PropTypes.number,
            style: React.PropTypes.object,
        };
    }

    static get childContextTypes() {
        return {
            emitter: React.PropTypes.object,
        };
    }

    getChildContext() {
        return {
            emitter: this.emitter,
        };
    }

    constructor(props) {
        super(props);

        this.emitter = new EventEmitter();
        this.state = {
            dataset: [],
            undoStack: [],
            mode: MODE.HAND,
            strokeWidth: 5,
            strokeColor: 'black',
        };
    }

    componentDidMount() {
        this.setupEventHandler();
    }

    setupEventHandler() {
        d3.select('body').on('keydown.body', () => {
            this.emitter.emit('keydown.body', d3.event.keyCode);
        });

        const that = this;
        this.emitter.on('keydown.body', (keyCode) => {
            if (keyCode === 48) { // 0'
                that.toggleMode();
            }<commit_msg>Remove event handler to toggle mode<commit_after>import React from 'react';
import EventEmitter from 'events';
import d3 from 'd3';
import CursorPane from './CursorPane';
import CanvasPane from './CanvasPane';


const MODE = {
    HAND: {},
    LINE: {}
};


export default class Whiteboard extends React.Component {

    static get propTypes() {
        return {
            width: React.PropTypes.number,
            height: React.PropTypes.number,
            style: React.PropTypes.object,
        };
    }

    static get childContextTypes() {
        return {
            emitter: React.PropTypes.object,
        };
    }

    getChildContext() {
        return {
            emitter: this.emitter,
        };
    }

    constructor(props) {
        super(props);

        this.emitter = new EventEmitter();
        this.state = {
            dataset: [],
            undoStack: [],
            mode: MODE.HAND,
            strokeWidth: 5,
            strokeColor: 'black',
        };
    }

    componentDidMount() {
        this.setupEventHandler();
    }

    setupEventHandler() {
        d3.select('body').on('keydown.body', () => {
            this.emitter.emit('keydown.body', d3.event.keyCode);
        });

        const that = this;
        this.emitter.on('keydown.body', (keyCode) => {
{'fraction_non_alphanumeric': 0.12794612794612795, 'fraction_numerical': 0.004863449307893753, 'mean_word_length': 1.762396694214876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1308886', 'n_tokens_mistral': 775, 'n_tokens_neox': 737, 'n_words': 160}