<commit_before>'use strict';

import R from 'ramda';
import mapboxgl from 'mapbox-gl';
import EditStore from './edit_store';
import themeEdit from './theme/edit';
import themeStyle from './theme/style';
import themeDrawing from './theme/drawing';
import { DOM, createButton } from './util';

// Data store
import Store from './store';

// Control handlers
import Line from './geometries/line';
import Point from './geometries/point';
import Square from './geometries/square';
import Polygon from './geometries/polygon';

export default class Draw extends mapboxgl.Control {

  constructor(options) {
    super();

    this.options = {
      position: 'top-left',
      keybindings: true,
      geoJSON: [],
      controls: {
        marker: true,
        line: true,
        shape: true,
        square: true
      }
    };

    mapboxgl.util.setOptions(this, options);

    // event listeners
    this.drag = this._drag.bind(this);
    this.onClick = this._onClick.bind(this);
    this.onKeyUp = this._onKeyUp.bind(this);
    this.endDrag = this._endDrag.bind(this);
    this.onKeyDown = this._onKeyDown.bind(this);
    this.onMouseUp = this._onMouseUp.bind(this);
    this.onMouseDown = this._onMouseDown.bind(this);
    this.initiateDrag = this._initiateDrag.bind(this);

  }

  onAdd(map) {
    var controlClass = this._controlClass = 'mapboxgl-ctrl-draw-btn';
    var container = this._container = DOM.create('div', 'mapboxgl-ctrl-group', map.getContainer());
    var controls = this.options.controls;
    this._store = new Store(map);
    this._editStore = new EditStore(map);
    this._store.setEditStore(this._editStore);
    this._editStore.setDrawStore(this._store);

    // Build out draw controls
    if (controls.line) {
      this.lineStringCtrl = createButton(this._container, {
        className: controlClass + ' line',
        title: `LineString tool ${this.options.keybindings && '(l)'}`,
        fn: this._drawLine.bind(this),<commit_msg>mapboxgl.util.setOPtions -> Object.assign - closes #37<commit_after>'use strict';

import R from 'ramda';
import mapboxgl from 'mapbox-gl';
import EditStore from './edit_store';
import themeEdit from './theme/edit';
import themeStyle from './theme/style';
import themeDrawing from './theme/drawing';
import { DOM, createButton } from './util';

// Data store
import Store from './store';

// Control handlers
import Line from './geometries/line';
import Point from './geometries/point';
import Square from './geometries/square';
import Polygon from './geometries/polygon';

export default class Draw extends mapboxgl.Control {

  constructor(options) {
    super();

    this.options = {
      position: 'top-left',
      keybindings: true,
      geoJSON: [],
      controls: {
        marker: true,
        line: true,
        shape: true,
        square: true
      }
    };

    Object.assign(this, options);

    // event listeners
    this.drag = this._drag.bind(this);
    this.onClick = this._onClick.bind(this);
    this.onKeyUp = this._onKeyUp.bind(this);
    this.endDrag = this._endDrag.bind(this);
    this.onKeyDown = this._onKeyDown.bind(this);
    this.onMouseUp = this._onMouseUp.bind(this);
    this.onMouseDown = this._onMouseDown.bind(this);
    this.initiateDrag = this._initiateDrag.bind(this);

  }

  onAdd(map) {
    var controlClass = this._controlClass = 'mapboxgl-ctrl-draw-btn';
    var container = this._container = DOM.create('div', 'mapboxgl-ctrl-group', map.getContainer());
    var controls = this.options.controls;
    this._store = new Store(map);
    this._editStore = new EditStore(map);
    this._store.setEditStore(this._editStore);
    this._editStore.setDrawStore(this._store);

    // Build out draw controls
    if (controls.line) {
      this.lineStringCtrl = createButton(this._container, {
        className: controlClass + ' line',
        title: `LineString tool ${this.options.keybindings && '(l)'}`,
        fn: this._drawLine.bind(this),
{'fraction_non_alphanumeric': 0.1383679675620882, 'fraction_numerical': 0.0005068423720223011, 'mean_word_length': 3.225910064239829, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6218521', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1206, 'n_words': 278}