<commit_before>### define
libs/event_mixin : EventMixin
mjs : MJS
underscore : _
three : THREE
###

updateMacro = (_this) ->

  _this.trigger("changed", _this.currentMatrix, _this.zoomStep)
  _this.hasChanged = true


transformationWithDistanceMacro = (_this, transformationFn, transformationArg1, transformationArg2) ->

  { currentMatrix } = _this
  MJS.M4x4.translate(_this.distanceVecNegative, currentMatrix, currentMatrix)
  transformationFn.call(_this, transformationArg1, transformationArg2)
  MJS.M4x4.translate(_this.distanceVecPositive, currentMatrix, currentMatrix)
  updateMacro(_this)


class Flycam3d

  ZOOM_STEP_INTERVAL : 1.1
  ZOOM_STEP_MIN : 0.5
  ZOOM_STEP_MAX : 10

  zoomStep : 1
  hasChanged : true
  scale : null
  currentMatrix : null

  constructor : (@distance, scale) ->

    _.extend(this, new EventMixin())

    @scale = @calculateScaleValues(scale)

    @reset()
    @distanceVecNegative = [0, 0, -distance]
    @distanceVecPositive = [0, 0, distance]


  calculateScaleValues : (scale) ->

    scale = [1/scale[0], 1/scale[1], 1/scale[2]]
    maxScale = Math.max(scale[0], scale[1], scale[2])
    multi = 1/maxScale
    scale = [multi * scale[0], multi * scale[1], multi * scale[2]]
    scale<commit_msg>change max zoom for flight, #878<commit_after>### define
libs/event_mixin : EventMixin
mjs : MJS
underscore : _
three : THREE
###

updateMacro = (_this) ->

  _this.trigger("changed", _this.currentMatrix, _this.zoomStep)
  _this.hasChanged = true


transformationWithDistanceMacro = (_this, transformationFn, transformationArg1, transformationArg2) ->

  { currentMatrix } = _this
  MJS.M4x4.translate(_this.distanceVecNegative, currentMatrix, currentMatrix)
  transformationFn.call(_this, transformationArg1, transformationArg2)
  MJS.M4x4.translate(_this.distanceVecPositive, currentMatrix, currentMatrix)
  updateMacro(_this)


class Flycam3d

  ZOOM_STEP_INTERVAL : 1.1
  ZOOM_STEP_MIN : 0.5
  ZOOM_STEP_MAX : 5

  zoomStep : 1
  hasChanged : true
  scale : null
  currentMatrix : null

  constructor : (@distance, scale) ->

    _.extend(this, new EventMixin())

    @scale = @calculateScaleValues(scale)

    @reset()
    @distanceVecNegative = [0, 0, -distance]
    @distanceVecPositive = [0, 0, distance]


  calculateScaleValues : (scale) ->

    scale = [1/scale[0], 1/scale[1], 1/scale[2]]
    maxScale = Math.max(scale[0], scale[1], scale[2])
    multi = 1/maxScale
    scale = [multi * scale[0], multi * scale[1], multi * scale[2]]
    scale
{'fraction_non_alphanumeric': 0.12289156626506025, 'fraction_numerical': 0.027309236947791166, 'mean_word_length': 4.2775423728813555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5038730', 'n_tokens_mistral': 893, 'n_tokens_neox': 829, 'n_words': 176}