<commit_before>L.Polyline.Draw = L.Handler.Draw.extend({
	options: {
		icon: new L.DivIcon({
			iconSize: new L.Point(8, 8),
			className: 'leaflet-div-icon leaflet-editing-icon'
		}),
		guidelineDistance: 20
	},
	
	addHooks: function () {
		L.Handler.Draw.prototype.addHooks.call(this);
		if (this._map) {
			this._markers = [];

			this._markerGroup = new L.LayerGroup();
			this._map.addLayer(this._markerGroup);

			this._poly = new L.Polyline([], { color: '#f06eaa' });

			//TODO refactor: move cursor to styles
			this._container.style.cursor = 'crosshair';

			this._updateLabelText(this._polyOptions.getLabelText(this._markers.length));

			L.DomEvent
				.addListener(this._container, 'mousemove', this._onMouseMove, this)
				.addListener(this._container, 'click', this._onClick, this);
		}
	},

	removeHooks: function () {
		L.Handler.Draw.prototype.removeHooks.call(this);
		if (this._map) {
			var poly;

			if (this._polyOptions.type === 'polygon') {
				poly = new L.Polygon(this._poly.getLatLngs(), { color: '#f06eaa' });
			} else {
				poly = new L.Polyline(this._poly.getLatLngs(), { color: '#f06eaa' });
			}

			this._map.fire('polycreated', { poly: poly });

			if (this._markers.length > 0) {
				this._markers[0].off('click', this.disable);
			}

			//remove markers from map
			this._map.removeLayer(this._markerGroup);
			delete this._markerGroup;
			delete this._markers;

			this._map.removeLayer(this._poly);
			delete this._poly;

			//clean up DOM
			this._clearGuides();

			L.DomEvent
				.removeListener(this._container, 'mousemove', this._onMouseMove)
				.removeListener(this._container, 'click', this._onClick);
		}
	},

	drawPolyline: function () {
		this._polyOptions = {
			type: 'polyline',
			getLabelText: function (markerCount) {
				var text;
				if (markerCount === 0) {
					text = 'Click to start drawing line.';
				} else if (markerCount === 1) {
					text = 'Click to continue drawing line.';
				} else {
					text = 'Click last point to finish line.';
				}
				return text;
			}
		};
		this.enable();
	},

	drawPolygon: function () {
		this._polyOptions = {
			type: 'polygon',
			getLabelText: function (markerCount) {<commit_msg>Make sure we reset the map cursor<commit_after>L.Polyline.Draw = L.Handler.Draw.extend({
	options: {
		icon: new L.DivIcon({
			iconSize: new L.Point(8, 8),
			className: 'leaflet-div-icon leaflet-editing-icon'
		}),
		guidelineDistance: 20
	},
	
	addHooks: function () {
		L.Handler.Draw.prototype.addHooks.call(this);
		if (this._map) {
			this._markers = [];

			this._markerGroup = new L.LayerGroup();
			this._map.addLayer(this._markerGroup);

			this._poly = new L.Polyline([], { color: '#f06eaa' });

			//TODO refactor: move cursor to styles
			this._container.style.cursor = 'crosshair';

			this._updateLabelText(this._polyOptions.getLabelText(this._markers.length));

			L.DomEvent
				.addListener(this._container, 'mousemove', this._onMouseMove, this)
				.addListener(this._container, 'click', this._onClick, this);
		}
	},

	removeHooks: function () {
		L.Handler.Draw.prototype.removeHooks.call(this);
		if (this._map) {
			var poly;

			if (this._polyOptions.type === 'polygon') {
				poly = new L.Polygon(this._poly.getLatLngs(), { color: '#f06eaa' });
			} else {
				poly = new L.Polyline(this._poly.getLatLngs(), { color: '#f06eaa' });
			}

			this._map.fire('polycreated', { poly: poly });

			if (this._markers.length > 0) {
				this._markers[0].off('click', this.disable);
			}

			//remove markers from map
			this._map.removeLayer(this._markerGroup);
			delete this._markerGroup;
			delete this._markers;

			this._map.removeLayer(this._poly);
			delete this._poly;

			//clean up DOM
			this._clearGuides();
			this._container.style.cursor = '';

			L.DomEvent
				.removeListener(this._container, 'mousemove', this._onMouseMove)
				.removeListener(this._container, 'click', this._onClick);
		}
	},

	drawPolyline: function () {
		this._polyOptions = {
			type: 'polyline',
			getLabelText: function (markerCount) {
				var text;
				if (markerCount === 0) {
					text = 'Click to start drawing line.';
				} else if (markerCount === 1) {
					text = 'Click to continue drawing line.';
				} else {
					text = 'Click last point to finish line.';
				}
				return text;
			}
		};
		this.enable();
	},

	drawPolygon: function () {
		this._polyOptions = {
			type: 'polygon',
			getLabelText: function (markerCount) {
{'fraction_non_alphanumeric': 0.15553047404063206, 'fraction_numerical': 0.006320541760722348, 'mean_word_length': 3.277027027027027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '571177', 'n_tokens_mistral': 1818, 'n_tokens_neox': 1505, 'n_words': 303}