/**
* Integration script for adding hexagon grid to the existing maps controller
* This file provides the integration code to be added to maps_controller.js
*/
import { createHexagonGrid } from './hexagon_grid';
// Add this to the maps_controller.js connect() method after line 240 (after live map initialization)
export function initializeHexagonGrid(controller) {
// Create hexagon grid instance
controller.hexagonGrid = createHexagonGrid(controller.map, {
apiEndpoint: `/api/v1/maps/hexagons?api_key=${controller.apiKey}`,
style: {
fillColor: '#3388ff',
fillOpacity: 0.1,
color: '#3388ff',
weight: 1,
opacity: 0.5
},
debounceDelay: 300,
maxZoom: 16, // Don't show hexagons beyond this zoom
minZoom: 8 // Don't show hexagons below this zoom
});
return controller.hexagonGrid;
}
// Add this to the controlsLayer object in maps_controller.js (around line 194-205)
export function addHexagonToLayerControl(controller) {
// This should be added to the controlsLayer object:
// "Hexagon Grid": controller.hexagonGrid?.hexagonLayer || L.layerGroup()
return {
"Hexagon Grid": controller.hexagonGrid?.hexagonLayer || L.layerGroup()
};
}
// Add this to the disconnect() method cleanup
export function cleanupHexagonGrid(controller) {
if (controller.hexagonGrid) {
controller.hexagonGrid.destroy();
}
}
// Settings panel integration - add this to the settings form HTML (around line 843)
export const hexagonSettingsHTML = `