Comparing version 5.0.3 to 5.0.4
@@ -5,2 +5,1 @@ export * from './lib/zrender'; | ||
import './lib/svg/svg'; | ||
import './lib/vml/vml'; |
@@ -602,5 +602,5 @@ import { devicePixelRatio } from '../config'; | ||
var imageLayer = new Layer('image', this, opts.pixelRatio || this.dpr); | ||
var ctx = imageLayer.ctx; | ||
imageLayer.initContext(); | ||
imageLayer.clear(false, opts.backgroundColor || this._backgroundColor); | ||
var ctx = imageLayer.ctx; | ||
if (opts.pixelRatio <= this.dpr) { | ||
@@ -610,11 +610,10 @@ this.refresh(); | ||
var height_1 = imageLayer.dom.height; | ||
var ctx_1 = imageLayer.ctx; | ||
this.eachLayer(function (layer) { | ||
if (layer.__builtin__) { | ||
ctx_1.drawImage(layer.dom, 0, 0, width_1, height_1); | ||
ctx.drawImage(layer.dom, 0, 0, width_1, height_1); | ||
} | ||
else if (layer.renderToCanvas) { | ||
imageLayer.ctx.save(); | ||
layer.renderToCanvas(imageLayer.ctx); | ||
imageLayer.ctx.restore(); | ||
ctx.save(); | ||
layer.renderToCanvas(ctx); | ||
ctx.restore(); | ||
} | ||
@@ -621,0 +620,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
export declare type EventCallback<Ctx, Impl, EvtParam = unknown> = (this: CbThis<Ctx, Impl>, eventParam?: EvtParam, ...args: unknown[]) => boolean | void; | ||
export declare type EventCallback<Ctx, Impl, EvtParam = unknown> = (this: CbThis<Ctx, Impl>, eventParam: EvtParam, ...args: unknown[]) => boolean | void; | ||
export declare type EventQuery = string | Object; | ||
@@ -3,0 +3,0 @@ declare type CbThis<Ctx, Impl> = unknown extends Ctx ? Impl : Ctx; |
@@ -38,2 +38,5 @@ export declare type Dictionary<T> = { | ||
export declare type ElementEventNameWithOn = 'onclick' | 'ondblclick' | 'onmousewheel' | 'onmouseout' | 'onmouseup' | 'onmousedown' | 'onmousemove' | 'oncontextmenu' | 'ondrag' | 'ondragstart' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondrop'; | ||
export declare type RenderedEvent = { | ||
elapsedTime: number; | ||
}; | ||
export declare type PropType<TObj, TProp extends keyof TObj> = TObj[TProp]; | ||
@@ -40,0 +43,0 @@ export declare type AllPropTypes<T> = PropType<T, keyof T>; |
@@ -0,1 +1,2 @@ | ||
import { extend } from '../core/util'; | ||
var DebugRect = (function () { | ||
@@ -5,4 +6,4 @@ function DebugRect(style) { | ||
dom.className = 'ec-debug-dirty-rect'; | ||
style = Object.assign({}, style); | ||
Object.assign(style, { | ||
style = extend({}, style); | ||
extend(style, { | ||
backgroundColor: 'rgba(0, 0, 255, 0.2)', | ||
@@ -9,0 +10,0 @@ border: '1px solid #00f' |
@@ -84,5 +84,11 @@ import { normalizeArcAngles } from '../../core/PathProxy'; | ||
var endAngle = shape.endAngle; | ||
var tmpAngles = [startAngle, endAngle]; | ||
normalizeArcAngles(tmpAngles, !clockwise); | ||
var arc = mathAbs(tmpAngles[0] - tmpAngles[1]); | ||
var arc; | ||
if (startAngle === endAngle) { | ||
arc = 0; | ||
} | ||
else { | ||
var tmpAngles = [startAngle, endAngle]; | ||
normalizeArcAngles(tmpAngles, !clockwise); | ||
arc = mathAbs(tmpAngles[0] - tmpAngles[1]); | ||
} | ||
var x = shape.cx; | ||
@@ -89,0 +95,0 @@ var y = shape.cy; |
@@ -12,3 +12,2 @@ import Path from './graphic/Path'; | ||
clear(): void; | ||
getViewportRoot(): HTMLElement; | ||
getType: () => string; | ||
@@ -15,0 +14,0 @@ getWidth(): number; |
import { __extends } from "tslib"; | ||
import Definable from './Definable'; | ||
import * as zrUtil from '../../core/util'; | ||
import LRU from '../../core/LRU'; | ||
import { createOrUpdateImage } from '../../graphic/helper/image'; | ||
@@ -141,2 +140,1 @@ import WeakMap from '../../core/WeakMap'; | ||
export default PatternManager; | ||
var patternSizeCache = new LRU(50); |
@@ -77,7 +77,5 @@ import { __extends } from "tslib"; | ||
var shadowDomsPool = this._shadowDomPool; | ||
var currentUsedShadow = 0; | ||
for (var key in this._shadowDomMap) { | ||
var dom = this._shadowDomMap[key]; | ||
shadowDomsPool.push(dom); | ||
currentUsedShadow++; | ||
} | ||
@@ -84,0 +82,0 @@ this._shadowDomMap = {}; |
@@ -193,3 +193,2 @@ import { createElement } from './core'; | ||
var item = diff[i]; | ||
var isAdd = item.added; | ||
if (item.removed) { | ||
@@ -196,0 +195,0 @@ continue; |
@@ -91,5 +91,5 @@ /*! | ||
export declare function registerPainter(name: string, Ctor: PainterBaseCtor): void; | ||
export declare const version = "5.0.3"; | ||
export declare const version = "5.0.4"; | ||
export interface ZRenderType extends ZRender { | ||
} | ||
export {}; |
@@ -265,3 +265,3 @@ /*! | ||
} | ||
export var version = '5.0.3'; | ||
export var version = '5.0.4'; | ||
; |
{ | ||
"name": "zrender", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "A lightweight canvas library.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
ZRender | ||
======= | ||
A lightweight graphic library which provides 2d draw for [Apache ECharts](https://github.com/apache/incubator-echarts). | ||
A lightweight graphic library which provides 2d draw for [Apache ECharts](https://github.com/apache/echarts). | ||
[![Build Status](https://travis-ci.com/ecomfe/zrender.svg?branch=master)](https://travis-ci.com/ecomfe/zrender) [![](https://img.shields.io/npm/dw/zrender.svg?label=npm%20downloads&style=flat)](https://www.npmjs.com/package/zrender) ![Commits Since 4.0.0](https://img.shields.io/github/commits-since/ecomfe/zrender/4.0.0.svg?colorB=%234c1&style=flat) | ||
## Document | ||
## Documentation | ||
@@ -10,0 +10,0 @@ [https://ecomfe.github.io/zrender-doc/public/](https://ecomfe.github.io/zrender-doc/public/) |
@@ -929,6 +929,7 @@ import {devicePixelRatio} from '../config'; | ||
const imageLayer = new Layer('image', this, opts.pixelRatio || this.dpr); | ||
const ctx = imageLayer.ctx; | ||
imageLayer.initContext(); | ||
imageLayer.clear(false, opts.backgroundColor || this._backgroundColor); | ||
const ctx = imageLayer.ctx; | ||
if (opts.pixelRatio <= this.dpr) { | ||
@@ -939,3 +940,2 @@ this.refresh(); | ||
const height = imageLayer.dom.height; | ||
const ctx = imageLayer.ctx; | ||
this.eachLayer(function (layer) { | ||
@@ -946,5 +946,5 @@ if (layer.__builtin__) { | ||
else if (layer.renderToCanvas) { | ||
imageLayer.ctx.save(); | ||
layer.renderToCanvas(imageLayer.ctx); | ||
imageLayer.ctx.restore(); | ||
ctx.save(); | ||
layer.renderToCanvas(ctx); | ||
ctx.restore(); | ||
} | ||
@@ -951,0 +951,0 @@ }); |
// Return true to cancel bubble | ||
export type EventCallback<Ctx, Impl, EvtParam = unknown> = ( | ||
this: CbThis<Ctx, Impl>, eventParam?: EvtParam, ...args: unknown[] | ||
this: CbThis<Ctx, Impl>, eventParam: EvtParam, ...args: unknown[] | ||
) => boolean | void | ||
@@ -228,2 +228,3 @@ export type EventQuery = string | Object | ||
case 0: | ||
// @ts-ignore | ||
hItem.h.call(hItem.ctx); | ||
@@ -283,2 +284,3 @@ break; | ||
case 0: | ||
// @ts-ignore | ||
hItem.h.call(ctx); | ||
@@ -285,0 +287,0 @@ break; |
import * as matrix from './matrix'; | ||
import * as vector from './vector'; | ||
import { Dictionary } from './types'; | ||
import { logError } from './util'; | ||
@@ -6,0 +4,0 @@ const mIdentity = matrix.identity; |
@@ -73,4 +73,6 @@ export type Dictionary<T> = { | ||
export type RenderedEvent = { | ||
elapsedTime: number | ||
}; | ||
// Useful type methods | ||
@@ -77,0 +79,0 @@ export type PropType<TObj, TProp extends keyof TObj> = TObj[TProp]; |
@@ -180,3 +180,5 @@ import { Dictionary, ArrayLike, KeyOfDistributive } from './types'; | ||
>(target: T, source: S): T & S { | ||
// @ts-ignore | ||
if (Object.assign) { | ||
// @ts-ignore | ||
Object.assign(target, source); | ||
@@ -183,0 +185,0 @@ } |
import type { ZRenderType } from '../zrender'; | ||
import type CanvasPainter from '../canvas/Painter'; | ||
import type BoundingRect from '../core/BoundingRect'; | ||
import { Dictionary } from '../core/types'; | ||
import { extend } from '../core/util'; | ||
@@ -16,4 +16,4 @@ class DebugRect { | ||
style = Object.assign({}, style); | ||
Object.assign(style, { | ||
style = extend({}, style); | ||
extend(style, { | ||
backgroundColor: 'rgba(0, 0, 255, 0.2)', | ||
@@ -20,0 +20,0 @@ border: '1px solid #00f' |
@@ -129,6 +129,13 @@ import PathProxy, { normalizeArcAngles } from '../../core/PathProxy'; | ||
// FIXME: whether normalizing angles is required? | ||
const tmpAngles = [startAngle, endAngle]; | ||
normalizeArcAngles(tmpAngles, !clockwise); | ||
const arc = mathAbs(tmpAngles[0] - tmpAngles[1]); | ||
// PENDING: whether normalizing angles is required? | ||
let arc: number; | ||
// FIXME: there may be a precision issue in `normalizeArcAngles` | ||
if (startAngle === endAngle) { | ||
arc = 0; | ||
} | ||
else { | ||
const tmpAngles = [startAngle, endAngle]; | ||
normalizeArcAngles(tmpAngles, !clockwise); | ||
arc = mathAbs(tmpAngles[0] - tmpAngles[1]); | ||
} | ||
@@ -135,0 +142,0 @@ const x = shape.cx; |
@@ -24,3 +24,2 @@ import Path from './graphic/Path'; | ||
getViewportRoot(): HTMLElement | ||
getType: () => string | ||
@@ -27,0 +26,0 @@ |
@@ -226,3 +226,3 @@ // TODO | ||
if (isNaN(x0) || isNaN(y0) || isNaN(rx) || isNaN(ry) || isNaN(psi) || isNaN(degree) || isNaN(x) || isNaN(y)) { | ||
if (isNaN(x0) || isNaN(y0) || isNaN(rx) || isNaN(ry) || isNaN(psi) || isNaN(degree) || isNaN(x) || isNaN(y)) { | ||
return ''; | ||
@@ -229,0 +229,0 @@ } |
@@ -10,3 +10,2 @@ /** | ||
import {PatternObject} from '../../graphic/Pattern'; | ||
import LRU from '../../core/LRU'; | ||
import {createOrUpdateImage} from '../../graphic/helper/image'; | ||
@@ -222,5 +221,2 @@ import WeakMap from '../../core/WeakMap'; | ||
const patternSizeCache = new LRU<CachedImageObj>(50); | ||
type CachedImageObj = { | ||
@@ -227,0 +223,0 @@ width: number, |
@@ -10,5 +10,3 @@ /** | ||
import { Dictionary } from '../../core/types'; | ||
import { each } from '../../core/util'; | ||
type DisplayableExtended = Displayable & { | ||
@@ -139,7 +137,7 @@ _shadowDom: SVGElement | ||
let currentUsedShadow = 0; | ||
// let currentUsedShadow = 0; | ||
for (let key in this._shadowDomMap) { | ||
const dom = this._shadowDomMap[key]; | ||
shadowDomsPool.push(dom); | ||
currentUsedShadow++; | ||
// currentUsedShadow++; | ||
} | ||
@@ -146,0 +144,0 @@ |
@@ -24,5 +24,3 @@ /** | ||
import Storage from '../Storage'; | ||
import { GradientObject } from '../graphic/Gradient'; | ||
import { PainterBase } from '../PainterBase'; | ||
import {PatternObject} from '../graphic/Pattern'; | ||
@@ -282,3 +280,3 @@ function parseInt10(val: string) { | ||
const item = diff[i]; | ||
const isAdd = item.added; | ||
// const isAdd = item.added; | ||
if (item.removed) { | ||
@@ -285,0 +283,0 @@ continue; |
@@ -19,3 +19,3 @@ /*! | ||
import Element, {ElementEventCallback, ElementEvent} from './Element'; | ||
import { Dictionary, ElementEventName } from './core/types'; | ||
import { Dictionary, ElementEventName, RenderedEvent } from './core/types'; | ||
import { LayerConfig } from './canvas/Layer'; | ||
@@ -267,3 +267,3 @@ import { GradientObject } from './graphic/Gradient'; | ||
elapsedTime: end - start | ||
}); | ||
} as RenderedEvent); | ||
} | ||
@@ -525,5 +525,5 @@ else if (this._sleepAfterStill > 0) { | ||
*/ | ||
export const version = '5.0.3'; | ||
export const version = '5.0.4'; | ||
export interface ZRenderType extends ZRender {}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4506371
466
63925