提交 5d6fd877 编写于 作者: O Ovilia

feat(decal): support "none" to disable decal

上级 3e7bdc37
...@@ -23,13 +23,17 @@ const decalKeys = [ ...@@ -23,13 +23,17 @@ const decalKeys = [
/** /**
* Create or update pattern image from decal options * Create or update pattern image from decal options
* *
* @param {InnerDecalObject} decalObject decal options * @param {InnerDecalObject | 'none'} decalObject decal options, 'none' if no decal
* @return {Pattern} pattern with generated image * @return {Pattern} pattern with generated image, null if no decal
*/ */
export function createOrUpdatePatternFromDecal( export function createOrUpdatePatternFromDecal(
decalObject: InnerDecalObject, decalObject: InnerDecalObject | 'none',
api: ExtensionAPI api: ExtensionAPI
): PatternObject { ): PatternObject {
if (decalObject === 'none') {
return null;
}
const dpr = api.getDevicePixelRatio(); const dpr = api.getDevicePixelRatio();
const zr = api.getZr(); const zr = api.getZr();
const isSVG = zr.painter.type === 'svg'; const isSVG = zr.painter.type === 'svg';
......
...@@ -871,7 +871,7 @@ export interface SymbolOptionMixin<T = unknown> { ...@@ -871,7 +871,7 @@ export interface SymbolOptionMixin<T = unknown> {
export interface ItemStyleOption extends ShadowOptionMixin, BorderOptionMixin { export interface ItemStyleOption extends ShadowOptionMixin, BorderOptionMixin {
color?: ZRColor color?: ZRColor
opacity?: number opacity?: number
decal?: DecalObject[] decal?: DecalObject | 'none'
} }
/** /**
......
...@@ -128,15 +128,25 @@ under the License. ...@@ -128,15 +128,25 @@ under the License.
if (i === 0) { if (i === 0) {
s.itemStyle = itemStyle; s.itemStyle = itemStyle;
} }
else if (i === 1) {
s.itemStyle = {
decal: 'none'
};
}
else if (i === 2) {
s.data = [{
value: s.data[0],
itemStyle: {
decal: 'none'
}
}];
}
series.push(s); series.push(s);
var p = { var p = {
name: 'pie' + i, name: 'pie' + i,
value: i * 5 + 10 value: i * 5 + 10
}; };
if (i === 0) {
p.itemStyle = itemStyle;
}
pieData.push(p); pieData.push(p);
legendNames.push('bar' + i, 'pie' + i); legendNames.push('bar' + i, 'pie' + i);
...@@ -175,7 +185,8 @@ under the License. ...@@ -175,7 +185,8 @@ under the License.
title: [ title: [
'It should use decal when aria.show is true', 'It should use decal when aria.show is true',
'(1) Each bar and pie piece should have different decal', '(1) Each bar and pie piece should have different decal',
'(2) The first bar and pie piece decal should be blue' '(2) The first bar decal should be blue',
'(3) The second and third bar should not have decal'
], ],
option: option option: option
// height: 300, // height: 300,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册