<commit_before>import React, { PropTypes } from 'react';
import { Layer, Rect, Stage } from 'react-konva';
import { RECT, CIRC, LINE, ELLS, TEXT, INPUT } from 'vclub/constants/whiteboardElements';
// action creator for adding new figure to board
import { addNewFigure } from 'vclub/redux/club/whiteboard';

import { backgroundColor, backgroundColorHover } from 'vclub/views/whiteBoardRoom/colors'

import {
  BoardRect, BoardCircle, BoardLine, BoardEllipse, BoardText, BoardInput,
} from '../figures';

import styles from './WhiteBoard.css';

class WhiteBoard extends React.Component {
  constructor() {
    super();
    this.state = {
      // 0 - Rect
      // 1 - Line
      // 2 - Ellipse
      // ...etc
      nextFigureType: null,
      // will be true after mouseDown
      // will be false after mouseUp
      listenForMouseMove: false,
      // figure to render
      // we work with only one figure, others are in store
      figure: null,
      // initial layer size
      layerHeight: window.innerHeight,
      layerWidth: window.innerWidth,
    };
  }

  // for canvas figures
  renderFigureOnCanvas = (figure) => {
    if (figure === null) return null;

    const { typeNumber } = figure;
    switch (typeNumber) {
      case RECT:
        return <BoardRect {...figure} />;
      case CIRC:
        return <BoardCircle {...figure} />;
      case LINE:
        return <BoardLine {...figure} />;
      case ELLS:
        return <BoardEllipse {...figure} />;
      case TEXT:
        return <BoardText {...figure} />;
      default:
        return null;
    }
  }

  clearCurrentFigure = () => {<commit_msg>fix rendering for canvas figures<commit_after>import React, { PropTypes } from 'react';
import { Layer, Rect, Stage } from 'react-konva';
import { RECT, CIRC, LINE, ELLS, TEXT, INPUT } from 'vclub/constants/whiteboardElements';
// action creator for adding new figure to board
import { addNewFigure } from 'vclub/redux/club/whiteboard';

import { backgroundColor, backgroundColorHover } from 'vclub/views/whiteBoardRoom/colors'

import {
  BoardRect, BoardCircle, BoardLine, BoardEllipse, BoardText, BoardInput,
} from '../figures';

import styles from './WhiteBoard.css';

class WhiteBoard extends React.Component {
  constructor() {
    super();
    this.state = {
      // 0 - Rect
      // 1 - Line
      // 2 - Ellipse
      // ...etc
      nextFigureType: null,
      // will be true after mouseDown
      // will be false after mouseUp
      listenForMouseMove: false,
      // figure to render
      // we work with only one figure, others are in store
      figure: null,
      // initial layer size
      layerHeight: window.innerHeight,
      layerWidth: window.innerWidth,
    };
  }

  // for canvas figures
  renderFigureOnCanvas = (figure, index) => {
    if (figure === null) return null;

    if (index === undefined)
      index = "-1"

    const { typeNumber } = figure;
    switch (typeNumber) {
      case RECT:
        return <BoardRect {...figure} key={index.toString()} />;
      case CIRC:
        return <BoardCircle {...figure} key={index.toString()} />;
      case LINE:
        return <BoardLine {...figure} key={index.toString()} />;
      case ELLS:
        return <BoardEllipse {...figure} key={index.toString()} />;
      case TEXT:
        return <BoardText {...figure} key={index.toString()} />;
      default:
        return null;
    }
  }

  clearCurrentFigure = () => {
{'fraction_non_alphanumeric': 0.12784588441331, 'fraction_numerical': 0.0020431990659661413, 'mean_word_length': 2.458123107971746, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, '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': '5994323', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1002, 'n_words': 303}