Comparing version 5.3.1 to 5.3.2
@@ -0,1 +1,4 @@ | ||
function isSafeNum(num) { | ||
return isFinite(num); | ||
} | ||
export function createLinearGradient(ctx, obj, rect) { | ||
@@ -12,6 +15,6 @@ var x = obj.x == null ? 0 : obj.x; | ||
} | ||
x = isNaN(x) ? 0 : x; | ||
x2 = isNaN(x2) ? 1 : x2; | ||
y = isNaN(y) ? 0 : y; | ||
y2 = isNaN(y2) ? 0 : y2; | ||
x = isSafeNum(x) ? x : 0; | ||
x2 = isSafeNum(x2) ? x2 : 1; | ||
y = isSafeNum(y) ? y : 0; | ||
y2 = isSafeNum(y2) ? y2 : 0; | ||
var canvasGradient = ctx.createLinearGradient(x, y, x2, y2); | ||
@@ -32,2 +35,5 @@ return canvasGradient; | ||
} | ||
x = isSafeNum(x) ? x : 0.5; | ||
y = isSafeNum(y) ? y : 0.5; | ||
r = r >= 0 && isSafeNum(r) ? r : 0.5; | ||
var canvasGradient = ctx.createRadialGradient(x, y, 0, x, y, r); | ||
@@ -34,0 +40,0 @@ return canvasGradient; |
@@ -28,6 +28,6 @@ import LRU from '../../core/LRU.js'; | ||
else { | ||
var image_1 = platformApi.loadImage(newImageOrSrc, imageOnLoad, imageOnLoad); | ||
image_1.__zrImageSrc = newImageOrSrc; | ||
globalImageCache.put(newImageOrSrc, image_1.__cachedImgObj = { | ||
image: image_1, | ||
image = platformApi.loadImage(newImageOrSrc, imageOnLoad, imageOnLoad); | ||
image.__zrImageSrc = newImageOrSrc; | ||
globalImageCache.put(newImageOrSrc, image.__cachedImgObj = { | ||
image: image, | ||
pending: [pendingWrap] | ||
@@ -34,0 +34,0 @@ }); |
@@ -85,5 +85,5 @@ /*! | ||
export declare function registerPainter(name: string, Ctor: PainterBaseCtor): void; | ||
export declare const version = "5.3.0"; | ||
export declare const version = "5.3.2"; | ||
export interface ZRenderType extends ZRender { | ||
} | ||
export {}; |
@@ -255,3 +255,3 @@ /*! | ||
} | ||
export var version = '5.3.0'; | ||
export var version = '5.3.2'; | ||
; |
{ | ||
"name": "zrender", | ||
"version": "5.3.1", | ||
"version": "5.3.2", | ||
"description": "A lightweight graphic library providing 2d draw for Apache ECharts", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -7,2 +7,7 @@ import { LinearGradientObject } from '../graphic/LinearGradient'; | ||
function isSafeNum(num: number) { | ||
// NaN、Infinity、undefined、'xx' | ||
return isFinite(num); | ||
} | ||
export function createLinearGradient( | ||
@@ -27,6 +32,6 @@ this: void, | ||
// Fix NaN when rect is Infinity | ||
x = isNaN(x) ? 0 : x; | ||
x2 = isNaN(x2) ? 1 : x2; | ||
y = isNaN(y) ? 0 : y; | ||
y2 = isNaN(y2) ? 0 : y2; | ||
x = isSafeNum(x) ? x : 0; | ||
x2 = isSafeNum(x2) ? x2 : 1; | ||
y = isSafeNum(y) ? y : 0; | ||
y2 = isSafeNum(y2) ? y2 : 0; | ||
@@ -51,2 +56,3 @@ const canvasGradient = ctx.createLinearGradient(x, y, x2, y2); | ||
let r = obj.r == null ? 0.5 : obj.r; | ||
if (!obj.global) { | ||
@@ -58,2 +64,6 @@ x = x * width + rect.x; | ||
x = isSafeNum(x) ? x : 0.5; | ||
y = isSafeNum(y) ? y : 0.5; | ||
r = r >= 0 && isSafeNum(r) ? r : 0.5; | ||
const canvasGradient = ctx.createRadialGradient(x, y, 0, x, y, r); | ||
@@ -60,0 +70,0 @@ |
@@ -68,3 +68,3 @@ | ||
else { | ||
const image = platformApi.loadImage( | ||
image = platformApi.loadImage( | ||
newImageOrSrc, imageOnLoad, imageOnLoad | ||
@@ -71,0 +71,0 @@ ); |
@@ -475,5 +475,5 @@ /*! | ||
*/ | ||
export const version = '5.3.0'; | ||
export const version = '5.3.2'; | ||
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
4067188
390
65929
1