提交 c854eff7 编写于 作者: P pissang

fix(treemap): optimize treemap label display in zoom animation

上级 a1ce5681
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册