<commit_before>var _ = require('underscore');
var L = require('leaflet');
var LeafletLayerView = require('./leaflet-layer-view');

/**
 * this is a dummy layer class that modifies the leaflet DOM element background
 * instead of creating a layer with div
 */
var LeafletPlainLayerView = L.Class.extend({
  includes: L.Mixin.Events,

  initialize: function(layerModel, leafletMap) {
    LeafletLayerView.call(this, layerModel, this, leafletMap);
  },

  onAdd: function() {
    this.redraw();
  },

  onRemove: function() {
    var div = this.leafletMap.getContainer()
    div.style.background = 'none';
  },

  _modelUpdated: function() {
    this.redraw();
  },

  redraw: function() {
    var div = this.leafletMap.getContainer()
    div.style.backgroundColor = this.model.get('color') || '#FFF';

    if (this.model.get('image')) {
      var st = 'transparent url(' + this.model.get('image') + ') repeat center center';
      div.style.background = st
    }
  },

  // this method
  setZIndex: function() {
  }

});

_.extend(LeafletPlainLayerView.prototype, LeafletLayerView.prototype);

module.exports = LeafletPlainLayerView;<commit_msg>Remove inheritance plainlayer<commit_after>var _ = require('underscore');
var L = require('leaflet');
var LeafletLayerView = require('./leaflet-layer-view');

var LeafletPlainLayerView = function (layerModel, leafletMap) {
  var self = this;
  LeafletLayerView.apply(this, [layerModel, this._createLeafletLayer(layerModel), leafletMap]);

  this.leafletLayer.onAdd = function () {
    self._redraw();
  };

  this.leafletLayer.onRemove = function () {
    var div = self.leafletMap.getContainer();
    div.style.background = 'none';
  };
}

LeafletPlainLayerView.prototype = _.extend(
  {},
  LeafletLayerView.prototype,
  {
    setZIndex: function () {},

    _createLeafletLayer: function (layerModel) {
      return new L.Class();
    },

    _modelUpdated: function () {
      this._redraw();
    },

    _redraw: function () {
      var div = this.leafletMap.getContainer()
      div.style.backgroundColor = this.model.get('color') || '#FFF';

      if (this.model.get('image')) {
        var style = 'transparent url(' + this.model.get('image') + ') repeat center center';
        div.style.background = style;
      }
    }
  }
);

module.exports = LeafletPlainLayerView;
{'fraction_non_alphanumeric': 0.14691943127962084, 'fraction_numerical': 0.0, 'mean_word_length': 3.5798816568047336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6976574', 'n_tokens_mistral': 757, 'n_tokens_neox': 730, 'n_words': 148}