Charles De Dampierre commited on
Commit
7a9ee24
1 Parent(s): 9187cfc

make clicked directly

Browse files
Files changed (1) hide show
  1. src/Map.jsx +11 -0
src/Map.jsx CHANGED
@@ -231,6 +231,13 @@ function MapView() {
231
 
232
  let currentlyClickedPolygon = null;
233
 
 
 
 
 
 
 
 
234
  topicsPolygons.on("click", (event, d) => {
235
  // Reset the fill color of the previously clicked polygon to transparent light grey
236
  if (currentlyClickedPolygon !== null) {
@@ -245,12 +252,16 @@ function MapView() {
245
 
246
  currentlyClickedPolygon = clickedPolygon;
247
 
 
248
  // Display the topic name and content from top_doc_content with a scroll system
249
  if (d.top_doc_content) {
250
  // Render the TextContainer component with topic details
251
  setSelectedDocument(d);
252
  }
253
  });
 
 
 
254
  };
255
 
256
  useEffect(() => {
 
231
 
232
  let currentlyClickedPolygon = null;
233
 
234
+ function clickFirstPolygon() {
235
+ // Simulate a click event on the first polygon
236
+ const firstPolygon = d3.select(topicsPolygons.nodes()[0]);
237
+ firstPolygon.node().dispatchEvent(new Event("click"));
238
+ }
239
+
240
+
241
  topicsPolygons.on("click", (event, d) => {
242
  // Reset the fill color of the previously clicked polygon to transparent light grey
243
  if (currentlyClickedPolygon !== null) {
 
252
 
253
  currentlyClickedPolygon = clickedPolygon;
254
 
255
+
256
  // Display the topic name and content from top_doc_content with a scroll system
257
  if (d.top_doc_content) {
258
  // Render the TextContainer component with topic details
259
  setSelectedDocument(d);
260
  }
261
  });
262
+
263
+ clickFirstPolygon();
264
+
265
  };
266
 
267
  useEffect(() => {