<commit_before>'use strict';

var famous = require('famous');
var Consts = require('./Consts.js');
var Cell = require('./Cell.js');

var Node = famous.core.Node;
var Position = famous.components.Position;
var DOMElement = famous.domRenderables.DOMElement;

function Figure(id, randomId) {
	Node.call(this);

	// Center dot.
	this
		.setMountPoint(0, 0)
		.setAlign(0.5, 0.5)
		.setSizeMode('absolute', 'absolute')
		.setAbsoluteSize(Consts.DOT_SIDE * Consts.DIMENSION / 2, Consts.DOT_SIDE * Consts.DIMENSION / 2);

	this.domElement = new DOMElement(this, {
		tagName: 'h1',
		classes: ['Figure']
	});

	this.domElement.setAttribute('role', 'grid');
	this.domElement.setAttribute('aria-live', 'polite');

	this.id = id;
	this.randomId = randomId;

	this.cells = [];
	for (let cellCounter = 0; cellCounter < 4; cellCounter++) {
		let cell = new Cell(cellCounter, Consts.FIGURES[randomId][cellCounter].x, Consts.FIGURES[randomId][cellCounter].y);
		this.addChild(cell);
		this.cells.push(cell);
	}

	this.position = new Position(this);

	this.addUIEvent('click');
}

Figure.prototype = Object.create(Node.prototype);
Figure.prototype.constructor = Figure;

/*jshint -W074 */
Figure.prototype.onReceive = function onReceive(type, ev) {
	switch (type) {
	case 'click':
			this._parent.figureUpdate(this.id);
			this._parent.scoreSurcharge();
			this.emit('id', this.id).emit('randomId', this.randomId);
			break;
	default:
			return false;
	}
};/*jshint +W074 */

module.exports = Figure;<commit_msg>Disallow generating new Figure by clicking on them<commit_after>'use strict';

var famous = require('famous');
var Consts = require('./Consts.js');
var Cell = require('./Cell.js');

var Node = famous.core.Node;
var Position = famous.components.Position;
var DOMElement = famous.domRenderables.DOMElement;

function Figure(id, randomId) {
	Node.call(this);

	// Center dot.
	this
		.setMountPoint(0, 0)
		.setAlign(0.5, 0.5)
		.setSizeMode('absolute', 'absolute')
		.setAbsoluteSize(Consts.DOT_SIDE * Consts.DIMENSION / 2, Consts.DOT_SIDE * Consts.DIMENSION / 2);

	this.domElement = new DOMElement(this, {
		tagName: 'h1',
		classes: ['Figure']
	});

	this.domElement.setAttribute('role', 'grid');
	this.domElement.setAttribute('aria-live', 'polite');

	this.id = id;
	this.randomId = randomId;

	this.cells = [];
	for (let cellCounter = 0; cellCounter < 4; cellCounter++) {
		let cell = new Cell(cellCounter, Consts.FIGURES[randomId][cellCounter].x, Consts.FIGURES[randomId][cellCounter].y);
		this.addChild(cell);
		this.cells.push(cell);
	}

	this.position = new Position(this);
}

Figure.prototype = Object.create(Node.prototype);
Figure.prototype.constructor = Figure;

module.exports = Figure;
{'fraction_non_alphanumeric': 0.16369710467706014, 'fraction_numerical': 0.010393466963622866, 'mean_word_length': 4.673684210526316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2041234', 'n_tokens_mistral': 1002, 'n_tokens_neox': 936, 'n_words': 186}