<commit_before>define ['underscore', 'utils', 'views/map_leg_marker', 'views/map_location_marker'], (_, Utils, MapLegMarker, MapLocationMarker) ->
  class MapRouteLegView

    constructor: ({@routes, @routeParams, @routeIndex, @index, @map}) ->
      @leg = @routes.at(@routeIndex).getLeg(@index)
      Reitti.Event.on 'routes:change', @onRoutesChanged

    dispose: ->
      Reitti.Event.off 'routes:change', @onRoutesChanged
      @hideMarkers()
      this

    render: () ->
      path = (new google.maps.LatLng point.y, point.x for point in @leg.get('shape'))
      @line = new google.maps.Polyline _.extend({
          map: @map
          path: path
          strokeWeight: 3
          strokeColor: Utils.transportColors[@leg.get('type')]
          strokeOpacity: 1.0
        }, @_legStyle())
      @marker = new MapLegMarker(@map, path[Math.floor(path.length / 2)], @leg.get('type'))

      google.maps.event.addListener @line, 'click', @onClicked
      google.maps.event.addListener @marker.marker, 'click', @onClicked
      this

    onClicked: () =>
      Reitti.Router.navigateToRoutes _.extend(@routeParams, legIndex: @index)

    onRoutesChanged: (routes, routeParams) =>
      if @isSelectedIn(routes, routeParams) and @line.getPath()?
        @showOriginMarker()<commit_msg>fix leg disposal fail<commit_after>define ['underscore', 'utils', 'views/map_leg_marker', 'views/map_location_marker'], (_, Utils, MapLegMarker, MapLocationMarker) ->
  class MapRouteLegView

    constructor: ({@routes, @routeParams, @routeIndex, @index, @map}) ->
      @leg = @routes.at(@routeIndex).getLeg(@index)
      Reitti.Event.on 'routes:change', @onRoutesChanged

    dispose: ->
      Reitti.Event.off 'routes:change', @onRoutesChanged
      @line?.setMap null
      @marker?.setMap null
      @hideMarkers()
      this

    render: () ->
      path = (new google.maps.LatLng point.y, point.x for point in @leg.get('shape'))
      @line = new google.maps.Polyline _.extend({
          map: @map
          path: path
          strokeWeight: 3
          strokeColor: Utils.transportColors[@leg.get('type')]
          strokeOpacity: 1.0
        }, @_legStyle())
      @marker = new MapLegMarker(@map, path[Math.floor(path.length / 2)], @leg.get('type'))

      google.maps.event.addListener @line, 'click', @onClicked
      google.maps.event.addListener @marker.marker, 'click', @onClicked
      this

    onClicked: () =>
      Reitti.Router.navigateToRoutes _.extend(@routeParams, legIndex: @index)

    onRoutesChanged: (routes, routeParams) =>
      if @isSelectedIn(routes, routeParams) and @line.getPath()?
        @showOriginMarker()
{'fraction_non_alphanumeric': 0.1479514415781487, 'fraction_numerical': 0.0030349013657056147, 'mean_word_length': 3.1724683544303796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1353072', 'n_tokens_mistral': 849, 'n_tokens_neox': 835, 'n_words': 168}