You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2021/04/08 09:02:23 UTC

[echarts] 02/04: fix: [geo svg] add notion for the issue of cut label.

This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a commit to branch fix/geo-location
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 710984fa29ee649448f4cc0dd8b8b213032cc4af
Author: 100pah <su...@gmail.com>
AuthorDate: Thu Apr 8 13:43:28 2021 +0800

    fix: [geo svg] add notion for the issue of cut label.
---
 src/coord/geo/GeoSVGResource.ts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/coord/geo/GeoSVGResource.ts b/src/coord/geo/GeoSVGResource.ts
index 8018f39..e0e6d59 100644
--- a/src/coord/geo/GeoSVGResource.ts
+++ b/src/coord/geo/GeoSVGResource.ts
@@ -236,6 +236,12 @@ export class GeoSVGResource implements GeoResource {
             rootFromParse.y = viewBoxTransform.y;
         }
 
+        // SVG needs to clip based on `viewBox`. And some SVG files really rely on this feature.
+        // They do not strictly confine all of the content inside a display rect, but deliberately
+        // use a `viewBox` to define a displayable rect.
+        // PENDING:
+        // The drawback of the `setClipPath` here is: the region label (genereted by echarts) near the
+        // edge might also be clipped, because region labels are put as `textContent` of the SVG path.
         root.setClipPath(new Rect({
             shape: boundingRect.plain()
         }));

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org