<commit_before>import React from 'react';
import Wall from './Wall';
require('aframe-text-component');

function centerText() {
  const doorTexts = document.getElementsByClassName('door-text');
  let halfTextWidth, textPosition;
  for (var i = 0; i < doorTexts.length; i++) {
    halfTextWidth = doorTexts[i].object3D.children[0].geometry.boundingSphere.radius;
    textPosition = doorTexts[i].getAttribute('position');
    textPosition.x -= halfTextWidth;
    doorTexts[i].setAttribute('position', textPosition);
  }
  return 'centered';
}

class Walls extends React.Component {

  constructor(props) {
    super(props);
    this.wallHeight = 8;
    this.doorWidth = 2;
    this.doorHeight = 3;
    this.wallThickness = 0.3;
  }

  componentDidMount() {
    setTimeout(() => centerText(), 4000);
  }
  renderDoorWays () {
    let maxLinkCount = Math.floor((this.props.width - 0.5) / (0.5 + this.doorWidth));
    //0.5 is min space between doors
    let links = this.props.links.slice(0, maxLinkCount);
    let boxCount = links.length + 1;
    let boxWidth = (this.props.width - (links.length * this.doorWidth)) / boxCount;
    //Make link colliders:
    let linkPads = links.map((link, i) => {
      const xPos = -this.props.width/2 + boxWidth * (i + 1) + this.doorWidth * (i + 1/2);
      const yPos = 0;
      const zPos = -this.props.length/2 - this.wallThickness/2;
      return (
        <a-entity key={i}>
          <a-entity // door title
            class="door-text"
            text={`text: ${link.title}`}
            material="color: black"
            position={`${xPos} ${yPos + this.doorHeight + 0.2} ${zPos + this.wallThickness}`} />
          <a-box // linkPad
            link={link.url}
            static-body
            position={`${xPos} ${yPos} ${zPos}`}
            height='0.1'
            width={this.doorWidth}
            depth={this.wallThickness}
            material='transparent:true; opacity:0;'/>
        </a-entity>
      )
    });
    let lowerWalls = [];
    for(let i = 0; i < boxCount; i++) {
      lowerWalls.push((
        <Wall key={'lowerWall' + i}
          position={`${(boxWidth - this.props.width)/2 + i * (boxWidth + this.doorWidth)} 
            1.5 ${-(this.props.length + this.wallThickness)/2}`}
          height={this.doorHeight}
          width={boxWidth}
          wallThickness={this.wallThickness}
          material={`src:#stucco; repeat:${boxWidth} ${this.doorHeight};`}/>
      ))
    }
    return linkPads.concat(lowerWalls);
  }

  render () {
    return (
      <a-entity position='0 0 0'>
        <a-box id='northWall'
          static-body 
          position={`0 ${this.wallHeight/2} ${this.props.length/2 + this.wallThickness/2}`}
          depth={this.wallThickness} width={this.props.width} height={this.wallHeight}
          material={`src:#stucco; repeat:${this.props.width} ${this.wallHeight};`}/>
        <a-box id='northWallTrim'
          position={`0 0.1 ${this.props.length/2}`}
          depth={0.1} width={this.props.width} height={0.2}
          material='src:#stucco; repeat:25 8;'/>
        <Wall id='westWall'
          position={`${(this.props.width + this.wallThickness)/2} ${this.wallHeight/2} 0`}
          rotation='0 -90 0'
          width={this.props.length + this.wallThickness * 2}
          height={this.wallHeight}
          wallThickness={this.wallThickness}
          material={`src:#stucco2; repeat:${this.props.length/2} ${this.wallHeight/2};`}/>
        <Wall id='eastWall'
          position={`${-(this.props.width + this.wallThickness)/2} ${this.wallHeight/2} 0`}
          rotation='0 90 0'
          width={this.props.length + this.wallThickness * 2}
          height={this.wallHeight}
          wallThickness={this.wallThickness}
          material={`src:#marbleSurface; repeat:${this.props.length/4} ${this.wallHeight/4};`}
          trimMaterial='src:#stucco; repeat:25 8;'/>
        <Wall id='southWallUpper'
          position={`0 ${(this.wallHeight + this.doorHeight)/2} 
            ${-(this.props.length + this.wallThickness)/2}`}
          wallThickness={this.wallThickness} 
          width={this.props.width} height={this.wallHeight - this.doorHeight}
          material={`src:#stucco; repeat:${this.props.width} ${this.wallHeight - this.doorHeight};`} 
          trimThickness={0} />
        {this.renderDoorWays.call(this)}

      </a-entity>
    )
  }
}

module.exports = Walls;
<commit_msg>Resize text over doors<commit_after>import React from 'react';
import Wall from './Wall';
require('aframe-text-component');

function centerText() {
  const doorTexts = document.getElementsByClassName('door-text');
  let halfTextWidth, textPosition;
  for (var i = 0; i < doorTexts.length; i++) {
    halfTextWidth = doorTexts[i].object3D.children[0].geometry.boundingSphere.radius;
    textPosition = doorTexts[i].getAttribute('position');
    textPosition.x -= halfTextWidth;
    doorTexts[i].setAttribute('position', textPosition);
  }
  return 'centered';
}

class Walls extends React.Component {

  constructor(props) {
    super(props);
    this.wallHeight = 8;
    this.doorWidth = 2;
    this.doorHeight = 3;
    this.wallThickness = 0.3;
  }

  componentDidMount() {
    setTimeout(() => centerText(), 4000);
  }
  renderDoorWays () {
    let maxLinkCount = Math.floor((this.props.width - 0.5) / (0.5 + this.doorWidth));
    //0.5 is min space between doors
    let links = this.props.links.slice(0, maxLinkCount);
    let boxCount = links.length + 1;
    let boxWidth = (this.props.width - (links.length * this.doorWidth)) / boxCount;
    //Make link colliders:
    let linkPads = links.map((link, i) => {
      const xPos = -this.props.width/2 + boxWidth * (i + 1) + this.doorWidth * (i + 1/2);
      const yPos = 0;
      const zPos = -this.props.length/2 - this.wallThickness/2;
      return (
        <a-entity key={i}>
          <a-entity // door title
            class="door-text"
            text={`text: ${link.title}; size:0.2; height:0.02`}
            material="color: black"
            position={`${xPos} ${yPos + this.doorHeight + 0.2} ${zPos + this.wallThickness}`} />
          <a-box // linkPad
            link={link.url}
            static-body
            position={`${xPos} ${yPos} ${zPos}`}
            height='0.1'
            width={this.doorWidth}
            depth={this.wallThickness}
            material='transparent:true; opacity:0;'/>
        </a-entity>
      )
    });
    let lowerWalls = [];
    for(let i = 0; i < boxCount; i++) {
      lowerWalls.push((
        <Wall key={'lowerWall' + i}
          position={`${(boxWidth - this.props.width)/2 + i * (boxWidth + this.doorWidth)} 
            1.5 ${-(this.props.length + this.wallThickness)/2}`}
          height={this.doorHeight}
          width={boxWidth}
          wallThickness={this.wallThickness}
          material={`src:#stucco; repeat:${boxWidth} ${this.doorHeight};`}/>
      ))
    }
    return linkPads.concat(lowerWalls);
  }

  render () {
    return (
      <a-entity position='0 0 0'>
        <a-box id='northWall'
          static-body 
          position={`0 ${this.wallHeight/2} ${this.props.length/2 + this.wallThickness/2}`}
          depth={this.wallThickness} width={this.props.width} height={this.wallHeight}
          material={`src:#stucco; repeat:${this.props.width} ${this.wallHeight};`}/>
        <a-box id='northWallTrim'
          position={`0 0.1 ${this.props.length/2}`}
          depth={0.1} width={this.props.width} height={0.2}
          material='src:#stucco; repeat:25 8;'/>
        <Wall id='westWall'
          position={`${(this.props.width + this.wallThickness)/2} ${this.wallHeight/2} 0`}
          rotation='0 -90 0'
          width={this.props.length + this.wallThickness * 2}
          height={this.wallHeight}
          wallThickness={this.wallThickness}
          material={`src:#stucco2; repeat:${this.props.length/2} ${this.wallHeight/2};`}/>
        <Wall id='eastWall'
          position={`${-(this.props.width + this.wallThickness)/2} ${this.wallHeight/2} 0`}
          rotation='0 90 0'
          width={this.props.length + this.wallThickness * 2}
          height={this.wallHeight}
          wallThickness={this.wallThickness}
          material={`src:#marbleSurface; repeat:${this.props.length/4} ${this.wallHeight/4};`}
          trimMaterial='src:#stucco; repeat:25 8;'/>
        <Wall id='southWallUpper'
          position={`0 ${(this.wallHeight + this.doorHeight)/2} 
            ${-(this.props.length + this.wallThickness)/2}`}
          wallThickness={this.wallThickness} 
          width={this.props.width} height={this.wallHeight - this.doorHeight}
          material={`src:#stucco; repeat:${this.props.width} ${this.wallHeight - this.doorHeight};`} 
          trimThickness={0} />
        {this.renderDoorWays.call(this)}

      </a-entity>
    )
  }
}

module.exports = Walls;

{'fraction_non_alphanumeric': 0.16719385449615906, 'fraction_numerical': 0.019317668323542703, 'mean_word_length': 2.5103092783505154, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '3286531', 'n_tokens_mistral': 3017, 'n_tokens_neox': 2889, 'n_words': 499}