<commit_before>// namespace 
var GNOVEL = GNOVEL || {};

(function() {
	"use strict";

	/**
	 *
	 * @class InteractableObject
	 * @constructor
	 * 
	 */
	var InteractableObject = function(path, page, params) {
		params = params || {};
		this._page = page;
		this._mouseDownListener = null;
		this._img = null;
		this._params = params;

		// create the image
		// for now we require width and height in params
		var x = params.x || 0;
		var y = params.y || 0;
		var pos = new THREE.Vector3(x, y, 100);
		this._img = this._page.createImage(path, pos, this._params.width, this._params.height);

		this._page._addToScene(this._img);

		var io = this;
		this._mouseDownListener = function(event) {			
			io._onMouseDown(event);
		};
		document.addEventListener('mousedown', this._mouseDownListener, false);
	};

	InteractableObject.prototype._onMouseDown = function(event) {
		var mouse = new THREE.Vector2();

		event.preventDefault();

		mouse.x = (event.clientX / this._page._owner._renderer.domElement.clientWidth) * 2 - 1;
		mouse.y = -(event.clientY / this._page._owner._renderer.domElement.clientHeight) * 2 + 1;

		this._page._owner._raycaster.setFromCamera(mouse, this._page._owner.getCamera());
		//create array of objects intersected with
		var intersects = this._page._owner._raycaster.intersectObjects([this._img], true);
		if (intersects.length > 0) {
			var clickedObj = intersects[0].object;

			console.log("interactable object is clicked");

			if(this._params.onClick != null) {
				this._params.onClick(this);
			}
		}
	};

	GNOVEL.InteractableObject = InteractableObject;
}());
<commit_msg>#6: Gnovel classes should use Gnovel.addMouseDownListener<commit_after>// namespace 
var GNOVEL = GNOVEL || {};

(function() {
	"use strict";

	/**
	 *
	 * @class InteractableObject
	 * @constructor
	 * 
	 */
	var InteractableObject = function(path, page, params) {
		params = params || {};
		this._page = page;
		this._mouseDownListener = null;
		this._img = null;
		this._params = params;

		// create the image
		// for now we require width and height in params
		var x = params.x || 0;
		var y = params.y || 0;
		var pos = new THREE.Vector3(x, y, 100);
		this._img = this._page.createImage(path, pos, this._params.width, this._params.height);

		this._page._addToScene(this._img);

		var io = this;
		this._mouseDownListener = function(event) {			
			io._onMouseDown(event);
		};

		this._page.getOwner().addMouseDownListener(this._mouseDownListener);		
	};

	InteractableObject.prototype._onMouseDown = function(event) {		
		var mouse = new THREE.Vector2();

		event.preventDefault();

		mouse.x = (event.clientX / this._page._owner._renderer.domElement.clientWidth) * 2 - 1;
		mouse.y = -(event.clientY / this._page._owner._renderer.domElement.clientHeight) * 2 + 1;

		this._page._owner._raycaster.setFromCamera(mouse, this._page._owner.getCamera());
		//create array of objects intersected with
		var intersects = this._page._owner._raycaster.intersectObjects([this._img], true);
		if (intersects.length > 0) {
			var clickedObj = intersects[0].object;

			console.log("interactable object is clicked");

			if(this._params.onClick != null) {
				this._params.onClick(this);
			}
		}
	};

	InteractableObject.prototype.remove = function() {
		this._page.removeFromScene(this._img);
		this._page.getOwner().removeMouseDownListener(this._mouseDownListener);
	};

	GNOVEL.InteractableObject = InteractableObject;
}());

{'fraction_non_alphanumeric': 0.14110787172011663, 'fraction_numerical': 0.007871720116618075, 'mean_word_length': 3.785216178521618, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1371873', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1115, 'n_words': 229}