You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/01/02 13:07:00 UTC
[incubator-echarts] 05/05: fix(symbol): ignore text context clip to
fix label does not show when symbol clip is enabled.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch feat/symbol-clip
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 4266e60de89187931152c5049a4200b42704072c
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sat Jan 2 21:02:22 2021 +0800
fix(symbol): ignore text context clip to fix label does not show when symbol clip is enabled.
---
src/chart/helper/Symbol.ts | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/chart/helper/Symbol.ts b/src/chart/helper/Symbol.ts
index f2b8592..d0ebeb0 100644
--- a/src/chart/helper/Symbol.ts
+++ b/src/chart/helper/Symbol.ts
@@ -325,14 +325,30 @@ class Symbol extends graphic.Group {
}
);
+ this._sizeX = symbolSize[0] / 2;
+ this._sizeY = symbolSize[1] / 2;
+
+ // symbol clip
+ const symbolClip = data.getItemVisual(idx, 'symbolClip');
+ if (symbolClip) {
+ const clipPath = makeSymbolClipPath(symbolClip, symbolSize);
+ if (clipPath) {
+ clipPath.scaleX = 1 / this._sizeX;
+ clipPath.scaleY = 1 / this._sizeY;
+ symbolPath.setClipPath(clipPath);
+ // PENDING: ignore text clip?
+ symbolPath.getTextContent() && (symbolPath.getTextContent().ignoreClip = true);
+ }
+ }
+ else {
+ symbolPath.removeClipPath();
+ }
+
// Do not execute util needed.
function getLabelDefaultText(idx: number) {
return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);
}
- this._sizeX = symbolSize[0] / 2;
- this._sizeY = symbolSize[1] / 2;
-
const emphasisState = symbolPath.ensureState('emphasis');
emphasisState.style = emphasisItemStyle;
@@ -346,20 +362,6 @@ class Symbol extends graphic.Group {
}
this.setSymbolScale(1);
- const symbolClip = data.getItemVisual(idx, 'symbolClip');
- console.log(symbolClip)
-
- symbolPath.getClipPath() && symbolPath.removeClipPath();
-
- if (symbolClip) {
- const clipPath = makeSymbolClipPath(symbolClip, symbolSize);
- if (clipPath) {
- clipPath.scaleX = this.scaleX / this._sizeX;
- clipPath.scaleY = this.scaleY / this._sizeY;
- symbolPath.setClipPath(clipPath);
- }
- }
-
enableHoverEmphasis(this, focus, blurScope);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org