diff --git a/src/component/legend/LegendView.ts b/src/component/legend/LegendView.ts index a1ae3f8de54c29e6637c895cd963e81c82686eed..6ed07dc546260edbb92b96d8db4951d2e3c7f2a6 100644 --- a/src/component/legend/LegendView.ts +++ b/src/component/legend/LegendView.ts @@ -42,6 +42,7 @@ import Displayable, { DisplayableState } from 'zrender/src/graphic/Displayable'; import { PathStyleProps } from 'zrender/src/graphic/Path'; import { parse, stringify } from 'zrender/src/tool/color'; import {Pattern} from 'zrender/src/export'; +import {PatternObject} from 'zrender/src/graphic/Pattern'; const curry = zrUtil.curry; const each = zrUtil.each; @@ -336,7 +337,7 @@ class LegendView extends ComponentView { itemAlign: LegendOption['align'], color: ZRColor, borderColor: ZRColor, - decal: Pattern, + decal: PatternObject, selectMode: LegendOption['selectedMode'] ) { const itemWidth = legendModel.get('itemWidth'); @@ -554,7 +555,7 @@ function setSymbolStyle( legendModelItemStyle: Model, borderColor: ZRColor, inactiveBorderColor: ZRColor, - decal: Pattern, + decal: PatternObject, isSelected: boolean ) { let itemStyle; diff --git a/src/util/decal.ts b/src/util/decal.ts index 52e928523a247cbff503b134898e8e7e07b941fd..dafaf12328b405e147092ab1a7ef797220e36d48 100644 --- a/src/util/decal.ts +++ b/src/util/decal.ts @@ -8,7 +8,7 @@ import {util} from 'zrender/src/export'; import ExtensionAPI from '../ExtensionAPI'; import type SVGPainter from 'zrender/src/svg/Painter'; import { brushSingle } from 'zrender/src/canvas/graphic'; -import {DecalObject, DecalDashArrayX, DecalDashArrayY} from './types'; +import {DecalDashArrayX, DecalDashArrayY, InnerDecalObject, DecalObject} from './types'; const decalMap = new WeakMap(); @@ -24,11 +24,11 @@ const decalKeys = [ /** * Create or update pattern image from decal options * - * @param {DecalObject} decalObject decal options + * @param {InnerDecalObject} decalObject decal options * @return {Pattern} pattern with generated image */ export function createOrUpdatePatternFromDecal( - decalObject: DecalObject, + decalObject: InnerDecalObject, api: ExtensionAPI ): PatternObject { const dpr = api.getDevicePixelRatio(); diff --git a/src/util/types.ts b/src/util/types.ts index 240de4aed4eb19d0c72913157ec3da5d9ba14e54..5879eee919d2268e35adfec05694c2ec1ab7b09e 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -685,10 +685,12 @@ export interface DecalObject { maxTileWidth?: number, // boundary of largest tile height maxTileHeight?: number +}; +export interface InnerDecalObject extends DecalObject { // If option has changed dirty?: boolean -}; +} export interface MediaQuery { minWidth?: number; diff --git a/src/visual/aria.ts b/src/visual/aria.ts index 7e86c114d2dad4c4e454ccb48589164cf96fe60c..21c8b370b91f0c3d5cedb8bf42728b86b95f4ce1 100644 --- a/src/visual/aria.ts +++ b/src/visual/aria.ts @@ -26,7 +26,7 @@ import SeriesModel from '../model/Series'; import {AriaOption} from '../component/aria'; import {TitleOption} from '../component/title'; import {makeInner} from '../util/model'; -import {Dictionary, DecalObject} from '../util/types'; +import {Dictionary, DecalObject, InnerDecalObject} from '../util/types'; import {LocaleOption} from '../locale'; const defaultOption: AriaOption = { @@ -129,7 +129,7 @@ export default function (ecModel: GlobalModel, api: ExtensionAPI) { const decal = style.decal ? zrUtil.defaults(style.decal, paletteDecal) : paletteDecal; - decal.dirty = true; + (decal as InnerDecalObject).dirty = true; data.setVisual('decal', decal); } }); diff --git a/src/visual/style.ts b/src/visual/style.ts index 8f77c3c07adfda766d62e4d38cf34312b2988919..7df2233b63496fddcf729b58436ae8d25b5f9eb5 100644 --- a/src/visual/style.ts +++ b/src/visual/style.ts @@ -18,7 +18,7 @@ */ import { isFunction, extend, createHashMap } from 'zrender/src/core/util'; -import { StageHandler, CallbackDataParams, ZRColor, Dictionary, DecalObject } from '../util/types'; +import { StageHandler, CallbackDataParams, ZRColor, Dictionary, InnerDecalObject } from '../util/types'; import makeStyleMapper from '../model/mixin/makeStyleMapper'; import { ITEM_STYLE_KEY_MAP } from '../model/mixin/itemStyle'; import { LINE_STYLE_KEY_MAP } from '../model/mixin/lineStyle'; @@ -76,7 +76,7 @@ const seriesStyleTask: StageHandler = { const globalStyle = getStyle(styleModel); - const decalOption = styleModel.getShallow('decal') as DecalObject; + const decalOption = styleModel.getShallow('decal') as InnerDecalObject; if (decalOption) { data.setVisual('decal', decalOption); decalOption.dirty = true;