imad-hl commented on code in PR #35859:
URL: https://github.com/apache/superset/pull/35859#discussion_r2682255937


##########
superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js:
##########
@@ -156,18 +201,123 @@ function CountryMap(element, props) {
       );
   };
 
+  // Mouse move handler to update tooltip position
   const mousemove = function mousemove() {
     const position = d3.mouse(svg.node());
     hoverPopup
       .style('top', `${position[1] + 30}px`)
       .style('left', `${position[0]}px`);
   };
 
+  // Mouse out handler
   const mouseout = function mouseout() {
-    d3.select(this).style('fill', colorFn);
+    d3.select(this).style('fill', d => colorFn(d));
     hoverPopup.style('display', 'none');
   };
 
+  // Zoom with panning bounds
+  const zoom = d3.behavior
+    .zoom()
+    .scaleExtent([1, 4])
+    .on('zoomstart', () => {
+      svg.style('cursor', 'grabbing');
+    })
+    .on('zoom', () => {
+      const { translate, scale } = d3.event;
+      let [tx, ty] = translate;
+
+      const scaledW = width * scale;
+      const scaledH = height * scale;
+      const minX = Math.min(0, width - scaledW);
+      const maxX = 0;
+      const minY = Math.min(0, height - scaledH);
+      const maxY = 0;
+
+      tx = Math.max(Math.min(tx, maxX), minX);
+      ty = Math.max(Math.min(ty, maxY), minY);

Review Comment:
   The original code is correct. The panning bounds should use container 
dimensions (width/height), not map dimensions. This ensures the scaled content 
stays within the viewport. Using map dimensions causes the map to pan outside 
the visible container. Tested with Chile map, current implementation works as 
intended



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to