<commit_before>import { Manager } from './manager';
import { iter } from './utils';
import { PolyShape } from './shapes';
import { convertHSLAToRGBA, RGBAColour } from './hsla';

const PASSIVE_NO_CAPTURE_FLAGS = {
  capture: false,
  passive: true,
};

(function() {
  const canvas = document.querySelector('canvas') as HTMLCanvasElement;
  const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
  const manager = new Manager(ctx, window.innerWidth, window.innerHeight);

  function sizeCanvas() {
    const windowWidth = window.innerWidth;
    const windowHeight = window.innerHeight;
    canvas.setAttribute('width', windowWidth.toString());
    canvas.setAttribute('height', windowHeight.toString());
    manager.updateScreenSize(windowWidth, windowHeight);
  }
  window.addEventListener('resize', sizeCanvas, PASSIVE_NO_CAPTURE_FLAGS);
  sizeCanvas();

  canvas.addEventListener(
    'touchstart',
    (event: TouchEvent) => {
      // event.preventDefault();
      iter(event.changedTouches, touch => {
        manager.addNewShape(touch.identifier, touch.pageX, touch.pageY);
      });
    },
    PASSIVE_NO_CAPTURE_FLAGS,
  );
  canvas.addEventListener(
    'touchmove',
    (event: TouchEvent) => {
      // event.preventDefault();
      iter(event.changedTouches, touch => {
        manager.cloneShape(touch.identifier, touch.pageX, touch.pageY);
      });
    },
    PASSIVE_NO_CAPTURE_FLAGS,
  );

  let isMouseDown = false;
  canvas.addEventListener(
    'mousedown',
    event => {
      isMouseDown = true;
      manager.addNewShape(-1, event.pageX, event.pageY);<commit_msg>Restored preventing default on touch events to support iOS correctly<commit_after>import { Manager } from './manager';
import { iter } from './utils';
import { PolyShape } from './shapes';
import { convertHSLAToRGBA, RGBAColour } from './hsla';

const PASSIVE_NO_CAPTURE_FLAGS = {
  capture: false,
  passive: true,
};

(function() {
  const canvas = document.querySelector('canvas') as HTMLCanvasElement;
  const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
  const manager = new Manager(ctx, window.innerWidth, window.innerHeight);

  function sizeCanvas() {
    const windowWidth = window.innerWidth;
    const windowHeight = window.innerHeight;
    canvas.setAttribute('width', windowWidth.toString());
    canvas.setAttribute('height', windowHeight.toString());
    manager.updateScreenSize(windowWidth, windowHeight);
  }
  window.addEventListener('resize', sizeCanvas, PASSIVE_NO_CAPTURE_FLAGS);
  sizeCanvas();

  canvas.addEventListener(
    'touchstart',
    (event: TouchEvent) => {
      event.preventDefault();
      iter(event.changedTouches, touch => {
        manager.addNewShape(touch.identifier, touch.pageX, touch.pageY);
      });
    },
    false,
  );
  canvas.addEventListener(
    'touchmove',
    (event: TouchEvent) => {
      event.preventDefault();
      iter(event.changedTouches, touch => {
        manager.cloneShape(touch.identifier, touch.pageX, touch.pageY);
      });
    },
    false,
  );

  let isMouseDown = false;
  canvas.addEventListener(
    'mousedown',
    event => {
      isMouseDown = true;
      manager.addNewShape(-1, event.pageX, event.pageY);
{'fraction_non_alphanumeric': 0.1315871531025881, 'fraction_numerical': 0.0018709073900841909, 'mean_word_length': 3.8168168168168166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1396157', 'n_tokens_mistral': 959, 'n_tokens_neox': 960, 'n_words': 190}