提交 4df0f4ab 编写于 作者: O Ovilia

fix(decal): fix types

上级 66035d3d
......@@ -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<ItemStyleOption>,
borderColor: ZRColor,
inactiveBorderColor: ZRColor,
decal: Pattern,
decal: PatternObject,
isSelected: boolean
) {
let itemStyle;
......
......@@ -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<DecalObject, PatternObject>();
......@@ -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();
......
......@@ -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;
......
......@@ -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);
}
});
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册