<commit_before>"use strict";

/*global module, require*/

var drawShapeLayersFactory = require("./draw-shape-layers.js");

module.exports = function(container, resultsTables, updateLegends, updateLayerControl, getTileLayers, getShapeLayers, map) {
    var hovered = {
	layerId: null,
	shapeId: null
    },
	getHoveredShape = function() {
	    return hovered;
	},
	
	setHoveredShape = function(layerId, shapeId) {
	    if (layerId === hovered.layerId && shapeId === hovered.shapeId) {
		return;
	    }

	    var oldShape = drawShapeLayers.selectShapeAndLayer(
		hovered.layerId,
		hovered.shapeId
	    ),
		oldTable = resultsTables.selectTable(
		    hovered.layerId
		),

		newShape = drawShapeLayers.selectShapeAndLayer(
		    layerId, shapeId
		),
		newTable = resultsTables.selectTable(
		    layerId
		);
	    
	    hovered.layerId = layerId;
	    hovered.shapeId = shapeId;
	    
	    drawShapeLayers.clearEmphasis(oldShape);
	    resultsTables.clearEmphasis(oldTable);
	    drawShapeLayers.addEmphasis(newShape, hovered.shapeId);
	    resultsTables.addEmphasis(newTable, hovered.shapeId);
	},

	updateShapeLayer = function(layerId) {
	    // ToDo
	    updateAll();	    
	},

	updateAll = function() {
	    var orderedShapeLayers = getShapeLayers().ordered().reverse();

	    resultsTables.updateDialogues(orderedShapeLayers);
	    drawShapeLayers.fromData(orderedShapeLayers);

	    updateLegends();
	    updateLayerControl();
	},

	drawShapeLayers = drawShapeLayersFactory(
	    map.overlay,
	    map.projectTile,
	    getHoveredShape,
	    setHoveredShape,
	    getShapeLayers
	);

    resultsTables.headerClicked(updateShapeLayer);
    
    return {
	update: updateAll
    };
};<commit_msg>Things update on map zoom again.<commit_after>"use strict";

/*global module, require*/

var drawShapeLayersFactory = require("./draw-shape-layers.js");

module.exports = function(container, resultsTables, updateLegends, updateLayerControl, getTileLayers, getShapeLayers, map) {
    var hovered = {
	layerId: null,
	shapeId: null
    },
	getHoveredShape = function() {
	    return hovered;
	},
	
	setHoveredShape = function(layerId, shapeId) {
	    if (layerId === hovered.layerId && shapeId === hovered.shapeId) {
		return;
	    }

	    var oldShape = drawShapeLayers.selectShapeAndLayer(
		hovered.layerId,
		hovered.shapeId
	    ),
		oldTable = resultsTables.selectTable(
		    hovered.layerId
		),

		newShape = drawShapeLayers.selectShapeAndLayer(
		    layerId, shapeId
		),
		newTable = resultsTables.selectTable(
		    layerId
		);
	    
	    hovered.layerId = layerId;
	    hovered.shapeId = shapeId;
	    
	    drawShapeLayers.clearEmphasis(oldShape);
	    resultsTables.clearEmphasis(oldTable);
	    drawShapeLayers.addEmphasis(newShape, hovered.shapeId);
	    resultsTables.addEmphasis(newTable, hovered.shapeId);
	},

	updateShapeLayer = function(layerId) {
	    // ToDo
	    updateAll();	    
	},

	updateAll = function() {
	    var orderedShapeLayers = getShapeLayers().ordered().reverse();

	    resultsTables.updateDialogues(orderedShapeLayers);
	    drawShapeLayers.fromData(orderedShapeLayers);

	    updateLegends();
	    updateLayerControl();
	},

	drawShapeLayers = drawShapeLayersFactory(
	    map.overlay,
	    map.projectTile,
	    getHoveredShape,
	    setHoveredShape,
	    getShapeLayers
	);

    resultsTables.headerClicked(updateShapeLayer);

    map.onViewReset(updateAll);
    
    return {
	update: updateAll
    };
};
{'fraction_non_alphanumeric': 0.1063768115942029, 'fraction_numerical': 0.0, 'mean_word_length': 3.5052219321148823, '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': '5237748', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1062, 'n_words': 174}