<commit_before>/**
 * Mouse + Pointerlock controls.
 *
 * Based on: https://github.com/aframevr/aframe/pull/1056
 */
module.exports = {
  schema: {
    enabled: { default: true },
    pointerlockEnabled: { default: true },
    sensitivity: { default: 1 / 25 }
  },

  init: function () {
    this.mouseDown = false;
    this.pointerLocked = false;
    this.lookVector = new THREE.Vector2();
    this.bindMethods();
  },

  play: function () {
    this.addEventListeners();
  },

  pause: function () {
    this.removeEventListeners();
    this.lookVector.set(0, 0);
  },

  remove: function () {
    this.pause();
  },

  bindMethods: function () {
    this.onMouseDown = this.onMouseDown.bind(this);<commit_msg>[mouse-controls] Fix handling when pointerlock is disabled while in pointerlock mode.<commit_after>/**
 * Mouse + Pointerlock controls.
 *
 * Based on: https://github.com/aframevr/aframe/pull/1056
 */
module.exports = {
  schema: {
    enabled: { default: true },
    pointerlockEnabled: { default: true },
    sensitivity: { default: 1 / 25 }
  },

  init: function () {
    this.mouseDown = false;
    this.pointerLocked = false;
    this.lookVector = new THREE.Vector2();
    this.bindMethods();
  },

  update: function (previousData) {
    var data = this.data;
    if (previousData.pointerlockEnabled && !data.pointerlockEnabled && this.pointerLocked) {
      document.exitPointerLock();
    }
  },

  play: function () {
    this.addEventListeners();
  },

  pause: function () {
    this.removeEventListeners();
    this.lookVector.set(0, 0);
  },

  remove: function () {
    this.pause();
  },

  bindMethods: function () {
    this.onMouseDown = this.onMouseDown.bind(this);
{'fraction_non_alphanumeric': 0.1502651738361815, 'fraction_numerical': 0.011785503830288745, 'mean_word_length': 3.0332541567695963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3843111', 'n_tokens_mistral': 553, 'n_tokens_neox': 535, 'n_words': 108}