<commit_before>Archive = require '../../models/archive'

Interfaces = require '../interfaces'

Classification = require 'zooniverse/models/classification'
Subject = require 'zooniverse/models/subject'

window.Snap = require 'snapsvg'
require 'snap.svg.zpd'

ZOOM_FACTOR = 0.15

class BugExpeditions extends Interfaces
  className: 'BugExpeditionsTranscriptionController'
  template: require '../../views/transcription/bugs'
  widgetName: 'Bugs'

  constructor: ->
    super

    rawSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
    rawSvg.setAttribute 'id', 'image-container'
    @surface = Snap rawSvg

  setupInterfaceWorkflow: =>
    @transcriber.$el.append @surface.node

    zoomInDiv = document.createElement 'div'
    zoomInDiv.innerHTML = '+'

    zoomOutDiv = document.createElement 'div'
    zoomOutDiv.innerHTML = '-'

    zoomInDiv.classList.add 'zoom-control', 'zoom-in'
    zoomOutDiv.classList.add 'zoom-control', 'zoom-out'

    zoomInDiv.addEventListener 'click', =>
      g = @surface.select "##{@image.node.parentNode.id}"

      {width, height, cx, cy} = g.getBBox()
      deltaX = ((width * (1 + ZOOM_FACTOR)) - width) / 2
      deltaY = ((height * (1 + ZOOM_FACTOR)) - height) / 2

      matrix = new Snap.Matrix @image.node.parentNode.getCTM()
      g.transform matrix.scale(1 + ZOOM_FACTOR).translate -(deltaX), -(deltaY)

    zoomOutDiv.addEventListener 'click', =>
      g = @surface.select "##{@image.node.parentNode.id}"

      {width, height} = g.getBBox()
      deltaX = Math.abs ((width * (1 - ZOOM_FACTOR)) - width) / 2
      deltaY = Math.abs ((height * (1 - ZOOM_FACTOR)) - height) / 2

      matrix = new Snap.Matrix @image.node.parentNode.getCTM()
      g.transform matrix.scale(1 - ZOOM_FACTOR).translate deltaX, deltaY

    @transcriber.$el.append zoomInDiv
    @transcriber.$el.append zoomOutDiv

  nextSubject: =>
    @surface.zpd 'destroy'
    @surface.clear()
    @classification = new Classification subject: Subject.current

    Subject.current.location.small ?= Subject.current.location.standard
    console.log(Subject.current);
    subjectImage = Subject.current.location.standard

    img = new Image
    img.onload = =>
      maxHeight = window.innerHeight - 150
      scaleFactor = Math.min 1, (maxHeight / img.naturalHeight)

      @image = @surface.image subjectImage, 0, 0, img.naturalWidth * scaleFactor, img.naturalHeight * scaleFactor
      @image.transform("t#{(window.innerWidth / 2) - (@image.getBBox().width / 2)},20")

      @surface.zpd()

      @transcriber.startTranscribing Subject.current

    img.src = subjectImage

module.exports = BugExpeditions
<commit_msg>Removing console log<commit_after>Archive = require '../../models/archive'

Interfaces = require '../interfaces'

Classification = require 'zooniverse/models/classification'
Subject = require 'zooniverse/models/subject'

window.Snap = require 'snapsvg'
require 'snap.svg.zpd'

ZOOM_FACTOR = 0.15

class BugExpeditions extends Interfaces
  className: 'BugExpeditionsTranscriptionController'
  template: require '../../views/transcription/bugs'
  widgetName: 'Bugs'

  constructor: ->
    super

    rawSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
    rawSvg.setAttribute 'id', 'image-container'
    @surface = Snap rawSvg

  setupInterfaceWorkflow: =>
    @transcriber.$el.append @surface.node

    zoomInDiv = document.createElement 'div'
    zoomInDiv.innerHTML = '+'

    zoomOutDiv = document.createElement 'div'
    zoomOutDiv.innerHTML = '-'

    zoomInDiv.classList.add 'zoom-control', 'zoom-in'
    zoomOutDiv.classList.add 'zoom-control', 'zoom-out'

    zoomInDiv.addEventListener 'click', =>
      g = @surface.select "##{@image.node.parentNode.id}"

      {width, height, cx, cy} = g.getBBox()
      deltaX = ((width * (1 + ZOOM_FACTOR)) - width) / 2
      deltaY = ((height * (1 + ZOOM_FACTOR)) - height) / 2

      matrix = new Snap.Matrix @image.node.parentNode.getCTM()
      g.transform matrix.scale(1 + ZOOM_FACTOR).translate -(deltaX), -(deltaY)

    zoomOutDiv.addEventListener 'click', =>
      g = @surface.select "##{@image.node.parentNode.id}"

      {width, height} = g.getBBox()
      deltaX = Math.abs ((width * (1 - ZOOM_FACTOR)) - width) / 2
      deltaY = Math.abs ((height * (1 - ZOOM_FACTOR)) - height) / 2

      matrix = new Snap.Matrix @image.node.parentNode.getCTM()
      g.transform matrix.scale(1 - ZOOM_FACTOR).translate deltaX, deltaY

    @transcriber.$el.append zoomInDiv
    @transcriber.$el.append zoomOutDiv

  nextSubject: =>
    @surface.zpd 'destroy'
    @surface.clear()
    @classification = new Classification subject: Subject.current

    Subject.current.location.small ?= Subject.current.location.standard
    subjectImage = Subject.current.location.standard

    img = new Image
    img.onload = =>
      maxHeight = window.innerHeight - 150
      scaleFactor = Math.min 1, (maxHeight / img.naturalHeight)

      @image = @surface.image subjectImage, 0, 0, img.naturalWidth * scaleFactor, img.naturalHeight * scaleFactor
      @image.transform("t#{(window.innerWidth / 2) - (@image.getBBox().width / 2)},20")

      @surface.zpd()

      @transcriber.startTranscribing Subject.current

    img.src = subjectImage

module.exports = BugExpeditions

{'fraction_non_alphanumeric': 0.13819905213270142, 'fraction_numerical': 0.010616113744075829, 'mean_word_length': 3.345963756177924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7384117', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1659, 'n_words': 341}