Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zrender

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zrender - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

8

lib/container/Group.js

@@ -279,3 +279,2 @@ /**

// TODO Caching
// TODO Transform
var rect = null;

@@ -294,2 +293,9 @@ var tmpRect = new BoundingRect(0, 0, 0, 0);

var transform = child.getLocalTransform(tmpMat);
// TODO
// The boundingRect cacluated by transforming original
// rect may be bigger than the actual bundingRect when rotation
// is used. (Consider a circle rotated aginst its center, where
// the actual boundingRect should be the same as that not be
// rotated.) But we can not find better approach to calculate
// actual boundingRect yet, considering performance.
if (transform) {

@@ -296,0 +302,0 @@ tmpRect.copy(childRect);

35

lib/core/BoundingRect.js

@@ -12,3 +12,2 @@ 'use strict';

var mathMin = Math.min;
var mathAbs = Math.abs;
var mathMax = Math.max;

@@ -75,4 +74,6 @@ /**

applyTransform: (function () {
var min = [];
var max = [];
var lt = [];
var rb = [];
var lb = [];
var rt = [];
return function (m) {

@@ -85,14 +86,18 @@ // In case usage like this

}
min[0] = this.x;
min[1] = this.y;
max[0] = this.x + this.width;
max[1] = this.y + this.height;
lt[0] = lb[0] = this.x;
lt[1] = rt[1] = this.y;
rb[0] = rt[0] = this.x + this.width;
rb[1] = lb[1] = this.y + this.height;
v2ApplyTransform(min, min, m);
v2ApplyTransform(max, max, m);
v2ApplyTransform(lt, lt, m);
v2ApplyTransform(rb, rb, m);
v2ApplyTransform(lb, lb, m);
v2ApplyTransform(rt, rt, m);
this.x = mathMin(min[0], max[0]);
this.y = mathMin(min[1], max[1]);
this.width = mathAbs(max[0] - min[0]);
this.height = mathAbs(max[1] - min[1]);
this.x = mathMin(lt[0], rb[0], lb[0], rt[0]);
this.y = mathMin(lt[1], rb[1], lb[1], rt[1]);
var maxX = mathMax(lt[0], rb[0], lb[0], rt[0]);
var maxY = mathMax(lt[1], rb[1], lb[1], rt[1]);
this.width = maxX - this.x;
this.height = maxY - this.y;
};

@@ -126,2 +131,6 @@ })(),

intersect: function (b) {
if (!b) {
return false;
}
if (!(b instanceof BoundingRect)) {

@@ -128,0 +137,0 @@ // Normalize negative width/height.

@@ -55,2 +55,4 @@ /**

var weChat = (/micromessenger/i).test(ua);
// Todo: clean this up with a better OS/browser seperation:

@@ -78,6 +80,9 @@ // - discern (more) between multiple browsers on android

// if (chrome) browser.chrome = true, browser.version = chrome[1];
if (firefox) browser.firefox = true, browser.version = firefox[1];
if (firefox) {
browser.firefox = true;
browser.version = firefox[1];
}
// if (safari && (ua.match(/Safari/) || !!os.ios)) browser.safari = true;
// if (webview) browser.webview = true;
if (ie) {

@@ -87,3 +92,3 @@ browser.ie = true;

}
if (edge) {

@@ -94,2 +99,8 @@ browser.edge = true;

// It is difficult to detect WeChat in Win Phone precisely, because ua can
// not be set on win phone. So we do not consider Win Phone.
if (weChat) {
browser.weChat = true;
}
// os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||

@@ -96,0 +107,0 @@ // (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));

@@ -34,3 +34,3 @@ 'use strict';

// is too complex. So css-transfrom dont support in this case temporarily.
if (calculate) {
if (calculate || !env.canvasSupported) {
defaultGetZrXY(el, e, out);

@@ -37,0 +37,0 @@ }

@@ -14,6 +14,19 @@ /**

'[object CanvasPattern]': 1,
// In node-canvas Image can be Canvas.Image
'[object Image]': 1
// For node-canvas
'[object Image]': 1,
'[object Canvas]': 1
};
var TYPED_ARRAY = {
'[object Int8Array]': 1,
'[object Uint8Array]': 1,
'[object Uint8ClampedArray]': 1,
'[object Int16Array]': 1,
'[object Uint16Array]': 1,
'[object Int32Array]': 1,
'[object Uint32Array]': 1,
'[object Float32Array]': 1,
'[object Float64Array]': 1
};
var objToString = Object.prototype.toString;

@@ -29,31 +42,44 @@

/**
* Those data types can be cloned:
* Plain object, Array, TypedArray, number, string, null, undefined.
* Those data types will be assgined using the orginal data:
* BUILTIN_OBJECT
* Instance of user defined class will be cloned to a plain object, without
* properties in prototype.
* Other data types is not supported (not sure what will happen).
*
* Caution: do not support clone Date, for performance consideration.
* (There might be a large number of date in `series.data`).
* So date should not be modified in and out of echarts.
*
* @param {*} source
* @return {*} 拷贝后的新对象
* @return {*} new
*/
function clone(source) {
if (typeof source == 'object' && source !== null) {
var result = source;
if (source instanceof Array) {
result = [];
for (var i = 0, len = source.length; i < len; i++) {
result[i] = clone(source[i]);
}
if (source == null || typeof source != 'object') {
return source;
}
var result = source;
var typeStr = objToString.call(source);
if (typeStr === '[object Array]') {
result = [];
for (var i = 0, len = source.length; i < len; i++) {
result[i] = clone(source[i]);
}
else if (
!isBuildInObject(source)
// 是否为 dom 对象
&& !isDom(source)
) {
result = {};
for (var key in source) {
if (source.hasOwnProperty(key)) {
result[key] = clone(source[key]);
}
}
else if (TYPED_ARRAY[typeStr]) {
result = source.constructor.from(source);
}
else if (!BUILTIN_OBJECT[typeStr] && !isDom(source)) {
result = {};
for (var key in source) {
if (source.hasOwnProperty(key)) {
result[key] = clone(source[key]);
}
}
return result;
}
return source;
return result;
}

@@ -423,4 +449,5 @@

function isDom(value) {
return value && value.nodeType === 1
&& typeof(value.nodeName) == 'string';
return typeof value === 'object'
&& typeof value.nodeType === 'number'
&& typeof value.ownerDocument === 'object';
}

@@ -427,0 +454,0 @@

@@ -115,2 +115,6 @@

// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
this._lastTouchMoment = new Date();

@@ -120,5 +124,4 @@

// 平板补充一次findHover
// this._mobileFindFixed(event);
// Trigger mousemove and mousedown
// In touch device, trigger `mousemove`(`mouseover`) should
// be triggered.
domHandlers.mousemove.call(this, event);

@@ -140,2 +143,6 @@

// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
processGesture(this, event, 'change');

@@ -160,2 +167,6 @@

// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
processGesture(this, event, 'end');

@@ -165,2 +176,10 @@

// Do not trigger `mouseout` here, in spite of `mousemove`(`mouseover`) is
// triggered in `touchstart`. This seems to be illogical, but by this mechanism,
// we can conveniently implement "hover style" in both PC and touch device just
// by listening to `mouseover` to add "hover style" and listening to `mouseout`
// to remove "hover style" on an element, without any additional code for
// compatibility. (`mouseout` will not be triggered in `touchend`, so "hover
// style" will remain for user view)
// click event should always be triggered no matter whether

@@ -167,0 +186,0 @@ // there is gestrue event. System click can not be prevented.

@@ -139,3 +139,3 @@ /**

// Draw rect text
if (style.text || style.text === 0) {
if (style.text != null) {
// var rect = this.getBoundingRect();

@@ -142,0 +142,0 @@ this.drawRectText(ctx, this.getBoundingRect());

@@ -28,3 +28,4 @@ 'use strict';

pinchScale: event.pinchScale,
wheelDelta: event.zrDelta
wheelDelta: event.zrDelta,
zrByTouch: event.zrByTouch
};

@@ -31,0 +32,0 @@ }

@@ -266,2 +266,7 @@ /**

/**
* @event module:zrender/mixin/Eventful#ondrag
* @type {Function}
* @default null
*/
/**
* @event module:zrender/mixin/Eventful#ondragstart

@@ -268,0 +273,0 @@ * @type {Function}

@@ -180,3 +180,3 @@ // TODO

if (style.text) {
if (style.text != null) {
svgTextDrawRectText(el, el.getBoundingRect());

@@ -229,3 +229,3 @@ }

if (style.text) {
if (style.text != null) {
svgTextDrawRectText(el, el.getBoundingRect());

@@ -243,3 +243,4 @@ }

var text = style.text;
// Convert to string
text != null && (text += '');
if (!text) {

@@ -338,3 +339,3 @@ return;

var style = el.style;
if (style.text) {
if (style.text != null) {
// 强制设置 textPosition

@@ -341,0 +342,0 @@ style.textPosition = [0, 0];

@@ -501,3 +501,3 @@ // http://www.w3.org/TR/NOTE-VML

// Text
if (style.text) {
if (style.text != null) {
this.drawRectText(vmlRoot, this.getBoundingRect());

@@ -731,3 +731,3 @@ }

// Text
if (style.text) {
if (style.text != null) {
this.drawRectText(vmlRoot, this.getBoundingRect());

@@ -826,2 +826,4 @@ }

var text = style.text;
// Convert to string
text != null && (text += '');
if (!text) {

@@ -1037,3 +1039,3 @@ return;

var style = this.style;
if (style.text) {
if (style.text != null) {
this.drawRectText(vmlRoot, {

@@ -1040,0 +1042,0 @@ x: style.x || 0, y: style.y || 0,

@@ -14,2 +14,3 @@ /*!

var env = require('./core/env');
var zrUtil = require('./core/util');

@@ -34,3 +35,3 @@ var Handler = require('./Handler');

*/
zrender.version = '3.2.1';
zrender.version = '3.2.2';

@@ -144,10 +145,3 @@ /**

stage: {
update: function () {
if (self._needsRefresh) {
self.refreshImmediately();
}
if (self._needsRefreshHover) {
self.refreshHoverImmediately();
}
}
update: zrUtil.bind(this.flush, this)
}

@@ -247,2 +241,14 @@ });

/**
* Perform all refresh
*/
flush: function () {
if (this._needsRefresh) {
this.refreshImmediately();
}
if (this._needsRefreshHover) {
this.refreshHoverImmediately();
}
},
/**
* Add element to hover layer

@@ -249,0 +255,0 @@ * @param {module:zrender/Element} el

{
"name": "zrender",
"version": "3.2.1",
"version": "3.2.2",
"description": "A lightweight canvas library.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -279,3 +279,2 @@ /**

// TODO Caching
// TODO Transform
var rect = null;

@@ -294,2 +293,9 @@ var tmpRect = new BoundingRect(0, 0, 0, 0);

var transform = child.getLocalTransform(tmpMat);
// TODO
// The boundingRect cacluated by transforming original
// rect may be bigger than the actual bundingRect when rotation
// is used. (Consider a circle rotated aginst its center, where
// the actual boundingRect should be the same as that not be
// rotated.) But we can not find better approach to calculate
// actual boundingRect yet, considering performance.
if (transform) {

@@ -296,0 +302,0 @@ tmpRect.copy(childRect);

@@ -12,3 +12,2 @@ /**

var mathMin = Math.min;
var mathAbs = Math.abs;
var mathMax = Math.max;

@@ -75,4 +74,6 @@ /**

applyTransform: (function () {
var min = [];
var max = [];
var lt = [];
var rb = [];
var lb = [];
var rt = [];
return function (m) {

@@ -85,14 +86,18 @@ // In case usage like this

}
min[0] = this.x;
min[1] = this.y;
max[0] = this.x + this.width;
max[1] = this.y + this.height;
lt[0] = lb[0] = this.x;
lt[1] = rt[1] = this.y;
rb[0] = rt[0] = this.x + this.width;
rb[1] = lb[1] = this.y + this.height;
v2ApplyTransform(min, min, m);
v2ApplyTransform(max, max, m);
v2ApplyTransform(lt, lt, m);
v2ApplyTransform(rb, rb, m);
v2ApplyTransform(lb, lb, m);
v2ApplyTransform(rt, rt, m);
this.x = mathMin(min[0], max[0]);
this.y = mathMin(min[1], max[1]);
this.width = mathAbs(max[0] - min[0]);
this.height = mathAbs(max[1] - min[1]);
this.x = mathMin(lt[0], rb[0], lb[0], rt[0]);
this.y = mathMin(lt[1], rb[1], lb[1], rt[1]);
var maxX = mathMax(lt[0], rb[0], lb[0], rt[0]);
var maxY = mathMax(lt[1], rb[1], lb[1], rt[1]);
this.width = maxX - this.x;
this.height = maxY - this.y;
};

@@ -126,2 +131,6 @@ })(),

intersect: function (b) {
if (!b) {
return false;
}
if (!(b instanceof BoundingRect)) {

@@ -128,0 +137,0 @@ // Normalize negative width/height.

@@ -55,2 +55,4 @@ /**

var weChat = (/micromessenger/i).test(ua);
// Todo: clean this up with a better OS/browser seperation:

@@ -78,6 +80,9 @@ // - discern (more) between multiple browsers on android

// if (chrome) browser.chrome = true, browser.version = chrome[1];
if (firefox) browser.firefox = true, browser.version = firefox[1];
if (firefox) {
browser.firefox = true;
browser.version = firefox[1];
}
// if (safari && (ua.match(/Safari/) || !!os.ios)) browser.safari = true;
// if (webview) browser.webview = true;
if (ie) {

@@ -87,3 +92,3 @@ browser.ie = true;

}
if (edge) {

@@ -94,2 +99,8 @@ browser.edge = true;

// It is difficult to detect WeChat in Win Phone precisely, because ua can
// not be set on win phone. So we do not consider Win Phone.
if (weChat) {
browser.weChat = true;
}
// os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||

@@ -96,0 +107,0 @@ // (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));

@@ -35,3 +35,3 @@ /**

// is too complex. So css-transfrom dont support in this case temporarily.
if (calculate) {
if (calculate || !env.canvasSupported) {
defaultGetZrXY(el, e, out);

@@ -38,0 +38,0 @@ }

@@ -14,6 +14,19 @@ /**

'[object CanvasPattern]': 1,
// In node-canvas Image can be Canvas.Image
'[object Image]': 1
// For node-canvas
'[object Image]': 1,
'[object Canvas]': 1
};
var TYPED_ARRAY = {
'[object Int8Array]': 1,
'[object Uint8Array]': 1,
'[object Uint8ClampedArray]': 1,
'[object Int16Array]': 1,
'[object Uint16Array]': 1,
'[object Int32Array]': 1,
'[object Uint32Array]': 1,
'[object Float32Array]': 1,
'[object Float64Array]': 1
};
var objToString = Object.prototype.toString;

@@ -29,31 +42,44 @@

/**
* Those data types can be cloned:
* Plain object, Array, TypedArray, number, string, null, undefined.
* Those data types will be assgined using the orginal data:
* BUILTIN_OBJECT
* Instance of user defined class will be cloned to a plain object, without
* properties in prototype.
* Other data types is not supported (not sure what will happen).
*
* Caution: do not support clone Date, for performance consideration.
* (There might be a large number of date in `series.data`).
* So date should not be modified in and out of echarts.
*
* @param {*} source
* @return {*} 拷贝后的新对象
* @return {*} new
*/
function clone(source) {
if (typeof source == 'object' && source !== null) {
var result = source;
if (source instanceof Array) {
result = [];
for (var i = 0, len = source.length; i < len; i++) {
result[i] = clone(source[i]);
}
if (source == null || typeof source != 'object') {
return source;
}
var result = source;
var typeStr = objToString.call(source);
if (typeStr === '[object Array]') {
result = [];
for (var i = 0, len = source.length; i < len; i++) {
result[i] = clone(source[i]);
}
else if (
!isBuildInObject(source)
// 是否为 dom 对象
&& !isDom(source)
) {
result = {};
for (var key in source) {
if (source.hasOwnProperty(key)) {
result[key] = clone(source[key]);
}
}
else if (TYPED_ARRAY[typeStr]) {
result = source.constructor.from(source);
}
else if (!BUILTIN_OBJECT[typeStr] && !isDom(source)) {
result = {};
for (var key in source) {
if (source.hasOwnProperty(key)) {
result[key] = clone(source[key]);
}
}
return result;
}
return source;
return result;
}

@@ -423,4 +449,5 @@

function isDom(value) {
return value && value.nodeType === 1
&& typeof(value.nodeName) == 'string';
return typeof value === 'object'
&& typeof value.nodeType === 'number'
&& typeof value.ownerDocument === 'object';
}

@@ -427,0 +454,0 @@

@@ -115,2 +115,6 @@ define(function (require) {

// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
this._lastTouchMoment = new Date();

@@ -120,5 +124,4 @@

// 平板补充一次findHover
// this._mobileFindFixed(event);
// Trigger mousemove and mousedown
// In touch device, trigger `mousemove`(`mouseover`) should
// be triggered.
domHandlers.mousemove.call(this, event);

@@ -140,2 +143,6 @@

// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
processGesture(this, event, 'change');

@@ -160,2 +167,6 @@

// Mark touch, which is useful in distinguish touch and
// mouse event in upper applicatoin.
event.zrByTouch = true;
processGesture(this, event, 'end');

@@ -165,2 +176,10 @@

// Do not trigger `mouseout` here, in spite of `mousemove`(`mouseover`) is
// triggered in `touchstart`. This seems to be illogical, but by this mechanism,
// we can conveniently implement "hover style" in both PC and touch device just
// by listening to `mouseover` to add "hover style" and listening to `mouseout`
// to remove "hover style" on an element, without any additional code for
// compatibility. (`mouseout` will not be triggered in `touchend`, so "hover
// style" will remain for user view)
// click event should always be triggered no matter whether

@@ -167,0 +186,0 @@ // there is gestrue event. System click can not be prevented.

@@ -139,3 +139,3 @@ /**

// Draw rect text
if (style.text || style.text === 0) {
if (style.text != null) {
// var rect = this.getBoundingRect();

@@ -142,0 +142,0 @@ this.drawRectText(ctx, this.getBoundingRect());

@@ -29,3 +29,4 @@ /**

pinchScale: event.pinchScale,
wheelDelta: event.zrDelta
wheelDelta: event.zrDelta,
zrByTouch: event.zrByTouch
};

@@ -32,0 +33,0 @@ }

@@ -266,2 +266,7 @@ /**

/**
* @event module:zrender/mixin/Eventful#ondrag
* @type {Function}
* @default null
*/
/**
* @event module:zrender/mixin/Eventful#ondragstart

@@ -268,0 +273,0 @@ * @type {Function}

@@ -180,3 +180,3 @@ // TODO

if (style.text) {
if (style.text != null) {
svgTextDrawRectText(el, el.getBoundingRect());

@@ -229,3 +229,3 @@ }

if (style.text) {
if (style.text != null) {
svgTextDrawRectText(el, el.getBoundingRect());

@@ -243,3 +243,4 @@ }

var text = style.text;
// Convert to string
text != null && (text += '');
if (!text) {

@@ -338,3 +339,3 @@ return;

var style = el.style;
if (style.text) {
if (style.text != null) {
// 强制设置 textPosition

@@ -341,0 +342,0 @@ style.textPosition = [0, 0];

@@ -501,3 +501,3 @@ // http://www.w3.org/TR/NOTE-VML

// Text
if (style.text) {
if (style.text != null) {
this.drawRectText(vmlRoot, this.getBoundingRect());

@@ -731,3 +731,3 @@ }

// Text
if (style.text) {
if (style.text != null) {
this.drawRectText(vmlRoot, this.getBoundingRect());

@@ -826,2 +826,4 @@ }

var text = style.text;
// Convert to string
text != null && (text += '');
if (!text) {

@@ -1037,3 +1039,3 @@ return;

var style = this.style;
if (style.text) {
if (style.text != null) {
this.drawRectText(vmlRoot, {

@@ -1040,0 +1042,0 @@ x: style.x || 0, y: style.y || 0,

@@ -14,2 +14,3 @@ /*!

var env = require('./core/env');
var zrUtil = require('./core/util');

@@ -34,3 +35,3 @@ var Handler = require('./Handler');

*/
zrender.version = '3.2.1';
zrender.version = '3.2.2';

@@ -144,10 +145,3 @@ /**

stage: {
update: function () {
if (self._needsRefresh) {
self.refreshImmediately();
}
if (self._needsRefreshHover) {
self.refreshHoverImmediately();
}
}
update: zrUtil.bind(this.flush, this)
}

@@ -247,2 +241,14 @@ });

/**
* Perform all refresh
*/
flush: function () {
if (this._needsRefresh) {
this.refreshImmediately();
}
if (this._needsRefreshHover) {
this.refreshHoverImmediately();
}
},
/**
* Add element to hover layer

@@ -249,0 +255,0 @@ * @param {module:zrender/Element} el

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc