You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/07/27 07:52:36 UTC
[incubator-echarts] branch next updated: fix(treemap): optimize
treemap label display in zoom animation
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/next by this push:
new c854eff fix(treemap): optimize treemap label display in zoom animation
c854eff is described below
commit c854eff7979c3d0191dbef58b5f1bbc60317854a
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Jul 27 15:51:59 2020 +0800
fix(treemap): optimize treemap label display in zoom animation
---
src/chart/treemap/TreemapView.ts | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/chart/treemap/TreemapView.ts b/src/chart/treemap/TreemapView.ts
index 1601e01..3dce265 100644
--- a/src/chart/treemap/TreemapView.ts
+++ b/src/chart/treemap/TreemapView.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import {bind, each, indexOf, curry, extend, retrieve} from 'zrender/src/core/util';
+import {bind, each, indexOf, curry, extend, retrieve, normalizeCssArray} from 'zrender/src/core/util';
import * as graphic from '../../util/graphic';
import {
isHighDownDispatcher,
@@ -56,7 +56,6 @@ import { ColorString, ECElement } from '../../util/types';
import { windowOpen } from '../../util/format';
import { TextStyleProps } from 'zrender/src/graphic/Text';
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle';
-import { rectCoordAxisHandleRemove } from '../../component/axis/axisSplitHelper';
const Group = graphic.Group;
const Rect = graphic.Rect;
@@ -973,19 +972,30 @@ function renderNode(
}
);
+ const textEl = rectEl.getTextContent();
+ const textStyle = textEl.style;
+ const textPadding = normalizeCssArray(textStyle.padding || 0);
+
if (upperLabelRect) {
rectEl.setTextConfig({
layoutRect: upperLabelRect
});
- const textEl = rectEl.getTextContent();
(textEl as ECElement).disableLabelLayout = true;
}
+ else {
+ textEl.beforeUpdate = function () {
+ const width = Math.max(rectEl.shape.width - textPadding[1] - textPadding[3], 0);
+ const height = Math.max(rectEl.shape.height - textPadding[0] - textPadding[2], 0);
+ if (textStyle.width !== width || textStyle.height !== height) {
+ textEl.setStyle({
+ width,
+ height
+ });
+ }
+ };
+ }
- const textEl = rectEl.getTextContent();
- const textStyle = textEl.style;
textStyle.truncateMinChar = 2;
- textStyle.width = width;
- textStyle.height = height;
textStyle.lineOverflow = 'truncate';
addDrillDownIcon(textStyle, upperLabelRect, thisLayout);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org