leoclo commented on issue #18344:
URL: https://github.com/apache/echarts/issues/18344#issuecomment-2234984012

   Thats because its connecting dots on the other side of the world.
   This should adjust getPolygon to check it.
   
   function getPolygon(api, coords, bounds){
       let points = [];
       let is_visible = false;
   
       let point_pixel_ref = api.coord([0, 0])[0];
       for (let i = 0; i < coords.length; i++) {
           let point_pixel = api.coord(coords[i]);
           if(point_pixel[0] < point_pixel_ref && coords[i][0] > 0){
               continue;
           }
   
           if(point_pixel[0] > point_pixel_ref && coords[i][0] < 0){
               continue;
           }
   
           if(bounds){
               if(bounds.contains({lng: coords[i][0],lat: coords[i][1]})){
                   is_visible = true;
               }
           }
           points.push(point_pixel);
       }
   
       if(!is_visible){
           return {
               type: 'polygon',
               shape: {
                   points: []
               },
           };
       }
   
       // 
https://ecomfe.github.io/zrender-doc/public/api.html#zrenderdisplayable
   
   
       let style = api.style();
   
       return {
           type: 'polygon',
           shape: {
               points: points
           },
           style: style,
           styleEmphasis: {
               shadowBlur: 4, fontWeight: 'bold',
           }
       }
   }
   
   
   So the if with point pixel ref is checking it.
   Its basically checking if would be connecting negative longitude with 
positive longitude.


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