bito-code-review[bot] commented on code in PR #35859:
URL: https://github.com/apache/superset/pull/35859#discussion_r2682014343


##########
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:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Incorrect zoom panning bounds</b></div>
   <div id="fix">
   
   The zoom panning bounds use container width/height * scale, but should use 
the map's actual pixel dimensions * scale to correctly constrain panning. For 
maps not filling the container (e.g., tall maps), this allows over-panning or 
restricts valid pans. Store bounds in zoomStates and retrieve in the zoom 
handler.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #95794b</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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