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.1.3 to 3.2.0

7

lib/animation/Animator.js

@@ -475,2 +475,6 @@ /**

for (var propName in props) {
if (!props.hasOwnProperty(propName)) {
continue;
}
if (!tracks[propName]) {

@@ -544,2 +548,5 @@ tracks[propName] = [];

for (var propName in this._tracks) {
if (!this._tracks.hasOwnProperty(propName)) {
continue;
}
var clip = createTrackClip(

@@ -546,0 +553,0 @@ this, easing, oneTrackDone,

4

lib/container/Group.js

@@ -38,3 +38,5 @@ /**

for (var key in opts) {
this[key] = opts[key];
if (opts.hasOwnProperty(key)) {
this[key] = opts[key];
}
}

@@ -41,0 +43,0 @@

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

function BoundingRect(x, y, width, height) {
if (width < 0) {
x = x + width;
width = -width;
}
if (height < 0) {
y = y + height;
height = -height;
}
/**

@@ -114,2 +124,7 @@ * @type {number}

intersect: function (b) {
if (!(b instanceof BoundingRect)) {
// Normalize negative width/height.
b = BoundingRect.create(b);
}
var a = this;

@@ -152,5 +167,26 @@ var ax0 = a.x;

this.height = other.height;
},
plain: function () {
return {
x: this.x,
y: this.y,
width: this.width,
height: this.height
};
}
};
/**
* @param {Object|module:zrender/core/BoundingRect} rect
* @param {number} rect.x
* @param {number} rect.y
* @param {number} rect.width
* @param {number} rect.height
* @return {module:zrender/core/BoundingRect}
*/
BoundingRect.create = function (rect) {
return new BoundingRect(rect.x, rect.y, rect.width, rect.height);
};
module.exports = BoundingRect;

@@ -80,9 +80,8 @@ /**

// if (webview) browser.webview = true;
if (ie) {
browser.ie = true; browser.version = ie[1];
}
if (ie) {
browser.ie = true;
browser.version = ie[1];
}
if (edge) {

@@ -89,0 +88,0 @@ browser.edge = true;

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

var Eventful = require('../mixin/Eventful');
var env = require('./env');

@@ -20,3 +21,43 @@ var isDomLevel2 = (typeof window !== 'undefined') && !!window.addEventListener;

function clientToLocal(el, e, out) {
// clientX/clientY is according to view port.
// According to the W3C Working Draft, offsetX and offsetY should be relative
// to the padding edge of the target element. The only browser using this convention
// is IE. Webkit uses the border edge, Opera uses the content edge, and FireFox does
// not support the properties.
// (see http://www.jacklmoore.com/notes/mouse-position/)
// In zr painter.dom, padding edge equals to border edge.
// FIXME
// When mousemove event triggered on ec tooltip, target is not zr painter.dom, and
// offsetX/Y is relative to e.target, where the calculation of zrX/Y via offsetX/Y
// is too complex. So css-transfrom dont support in this case temporarily.
if (!e.currentTarget || el !== e.currentTarget) {
defaultGetZrXY(el, e, out);
}
// Caution: In FireFox, layerX/layerY Mouse position relative to the closest positioned
// ancestor element, so we should make sure el is positioned (e.g., not position:static).
// BTW1, Webkit don't return the same results as FF in non-simple cases (like add
// zoom-factor, overflow / opacity layers, transforms ...)
// BTW2, (ev.offsetY || ev.pageY - $(ev.target).offset().top) is not correct in preserve-3d.
// <https://bugs.jquery.com/ticket/8523#comment:14>
// BTW3, In ff, offsetX/offsetY is always 0.
else if (env.browser.firefox && e.layerX != null && e.layerX !== e.offsetX) {
out.zrX = e.layerX;
out.zrY = e.layerY;
}
// For IE6+, chrome, safari, opera. (When will ff support offsetX?)
else if (e.offsetX != null) {
out.zrX = e.offsetX;
out.zrY = e.offsetY;
}
// For some other device, e.g., IOS safari.
else {
defaultGetZrXY(el, e, out);
}
return out;
}
function defaultGetZrXY(el, e, out) {
// This well-known method below does not support css transform.
var box = getBoundingClientRect(el);

@@ -26,3 +67,2 @@ out = out || {};

out.zrY = e.clientY - box.top;
return out;
}

@@ -29,0 +69,0 @@

@@ -28,3 +28,3 @@

mes + ' ' + (new Date() - 0)
+ '<br/>'
+ '<br/>'
+ document.getElementById('wrong-message').innerHTML;

@@ -31,0 +31,0 @@ };

@@ -17,3 +17,3 @@

'click', 'dblclick', 'mousewheel', 'mouseout',
'mouseup', 'mousedown', 'mousemove'
'mouseup', 'mousedown', 'mousemove', 'contextmenu'
];

@@ -173,3 +173,3 @@

// Common handlers
zrUtil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick'], function (name) {
zrUtil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name) {
domHandlers[name] = function (event) {

@@ -176,0 +176,0 @@ event = normalizeEvent(this.dom, event);

@@ -282,3 +282,5 @@ /**

for (var name in key) {
shape[name] = key[name];
if (key.hasOwnProperty(name)) {
shape[name] = key[name];
}
}

@@ -285,0 +287,0 @@ }

'use strict';
/**
* 水滴形状
* 椭圆形状
* @module zrender/graphic/shape/Ellipse

@@ -5,0 +5,0 @@ */

@@ -114,4 +114,6 @@ /**

for (var name in optsStates) {
var state = optsStates[name];
this._addState(name, state);
if (optsStates.hasOwnProperty(name)) {
var state = optsStates[name];
this._addState(name, state);
}
}

@@ -169,3 +171,5 @@ }

for (var name in this._states) {
this._extendFromInitial(this._states[name]);
if (this._states.hasOwnProperty(name)) {
this._extendFromInitial(this._states[name]);
}
}

@@ -296,2 +300,5 @@ }

for (var key in state[propName]) {
if (!state[propName].hasOwnProperty(key)) {
continue;
}
var path = propName + '.' + key;

@@ -298,0 +305,0 @@ if (propPathMap[path]) {

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

'click', 'dblclick', 'mousewheel', 'mouseout',
'mouseup', 'mousedown', 'mousemove'
'mouseup', 'mousedown', 'mousemove', 'contextmenu'
];

@@ -44,7 +44,8 @@ /**

* @extends module:zrender/mixin/Eventful
* @param {HTMLElement} root Main HTML element for painting.
* @param {module:zrender/Storage} storage Storage instance.
* @param {module:zrender/Painter} painter Painter instance.
* @param {module:zrender/dom/HandlerProxy} proxy HandlerProxy instance.
* @param {HTMLElement} painterRoot painter.root (not painter.getViewportRoot()).
*/
var Handler = function(storage, painter, proxy) {
var Handler = function(storage, painter, proxy, painterRoot) {
Eventful.call(this);

@@ -56,3 +57,6 @@

this.painterRoot = painterRoot;
proxy = proxy || new EmptyProxy();
/**

@@ -131,5 +135,17 @@ * Proxy of event. can be Dom, WebGLSurface, etc.

this.trigger('globalout', {
event: event
});
// There might be some doms created by upper layer application
// at the same level of painter.getViewportRoot() (e.g., tooltip
// dom created by echarts), where 'globalout' event should not
// be triggered when mouse enters these doms. (But 'mouseout'
// should be triggered at the original hovered element as usual).
var element = event.toElement || event.relatedTarget;
var innerDom;
do {
element = element && element.parentNode;
}
while (element && element.nodeType != 9 && !(
innerDom = element === this.painterRoot
));
!innerDom && this.trigger('globalout', {event: event});
},

@@ -240,3 +256,3 @@

// Common handlers
util.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick'], function (name) {
util.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name) {
Handler.prototype[name] = function (event) {

@@ -243,0 +259,0 @@ // Find hover again to avoid click event is dispatched manually. Or click is triggered without mouseover

@@ -74,2 +74,5 @@ /**

domStyle['-webkit-tap-highlight-color'] = 'rgba(0,0,0,0)';
domStyle['padding'] = 0;
domStyle['margin'] = 0;
domStyle['border-width'] = 0;
}

@@ -76,0 +79,0 @@

@@ -224,2 +224,6 @@ 'use strict';

for (var name in target) {
if (!target.hasOwnProperty(name)) {
continue;
}
if (source[name] != null) {

@@ -226,0 +230,0 @@ if (isObject(target[name]) && !util.isArrayLike(target[name])) {

@@ -102,9 +102,14 @@ 'use strict';

var domRoot = document.createElement('div');
var domRootStyle = domRoot.style;
// domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
domRootStyle.position = 'relative';
domRootStyle.overflow = 'hidden';
domRootStyle.width = width + 'px';
domRootStyle.height = height + 'px';
domRoot.style.cssText = [
'position:relative',
'overflow:hidden',
'width:' + width + 'px',
'height:' + height + 'px',
'padding:0',
'margin:0',
'border-width:0'
].join(';') + ';';
return domRoot;

@@ -125,3 +130,3 @@ }

opts = opts || {};
this._opts = opts = util.extend({}, opts || {});

@@ -178,4 +183,4 @@ /**

if (!singleCanvas) {
this._width = this._getWidth();
this._height = this._getHeight();
this._width = this._getSize(0);
this._height = this._getSize(1);

@@ -885,5 +890,10 @@ var domRoot = this._domRoot = createRoot(

width = width || this._getWidth();
height = height || this._getHeight();
// Save input w/h
var opts = this._opts;
width != null && (opts.width = width);
height != null && (opts.height = height);
width = this._getSize(0);
height = this._getSize(1);
domRoot.style.display = '';

@@ -897,4 +907,9 @@

for (var id in this._layers) {
this._layers[id].resize(width, height);
if (this._layers.hasOwnProperty(id)) {
this._layers[id].resize(width, height);
}
}
util.each(this._progressiveLayers, function (layer) {
layer.resize(width, height);
});

@@ -975,19 +990,21 @@ this.refresh(true);

_getWidth: function () {
var root = this.root;
var stl = document.defaultView.getComputedStyle(root);
_getSize: function (whIdx) {
var opts = this._opts;
var wh = ['width', 'height'][whIdx];
var cwh = ['clientWidth', 'clientHeight'][whIdx];
var plt = ['paddingLeft', 'paddingTop'][whIdx];
var prb = ['paddingRight', 'paddingBottom'][whIdx];
// FIXME Better way to get the width and height when element has not been append to the document
return ((root.clientWidth || parseInt10(stl.width) || parseInt10(root.style.width))
- (parseInt10(stl.paddingLeft) || 0)
- (parseInt10(stl.paddingRight) || 0)) | 0;
},
if (opts[wh] != null && opts[wh] !== 'auto') {
return parseFloat(opts[wh]);
}
_getHeight: function () {
var root = this.root;
var stl = document.defaultView.getComputedStyle(root);
return ((root.clientHeight || parseInt10(stl.height) || parseInt10(root.style.height))
- (parseInt10(stl.paddingTop) || 0)
- (parseInt10(stl.paddingBottom) || 0)) | 0;
return (
(root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh]))
- (parseInt10(stl[plt]) || 0)
- (parseInt10(stl[prb]) || 0)
) | 0;
},

@@ -994,0 +1011,0 @@

@@ -121,7 +121,7 @@ /**

resize: function () {
var width = this._getWidth();
var height = this._getHeight();
resize: function (width, height) {
var width = width == null ? this._getWidth() : width;
var height = height == null ? this._getHeight() : height;
if (this._width != width && this._height != height) {
if (this._width != width || this._height != height) {
this._width = width;

@@ -153,3 +153,5 @@ this._height = height;

clear: function () {
this.root.removeChild(this.vmlViewport);
if (this._vmlViewport) {
this.root.removeChild(this._vmlViewport);
}
},

@@ -156,0 +158,0 @@

@@ -29,6 +29,7 @@ /*!

var zrender = {};
/**
* @type {string}
*/
zrender.version = '3.1.3';
zrender.version = '3.2.0';

@@ -41,2 +42,4 @@ /**

* @param {number} [opts.devicePixelRatio]
* @param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
* @param {number|string} [opts.height] Can be 'auto' (the same as null/undefined)
* @return {module:zrender/ZRender}

@@ -60,3 +63,5 @@ */

for (var key in instances) {
instances[key].dispose();
if (instances.hasOwnProperty(key)) {
instances[key].dispose();
}
}

@@ -97,2 +102,4 @@ instances = {};

* @param {number} [opts.devicePixelRatio]
* @param {number} [opts.width] Can be 'auto' (the same as null/undefined)
* @param {number} [opts.height] Can be 'auto' (the same as null/undefined)
*/

@@ -132,3 +139,3 @@ var ZRender = function(id, dom, opts) {

var handerProxy = !env.node ? new HandlerProxy(painter.getViewportRoot()) : null;
this.handler = new Handler(storage, painter, handerProxy);
this.handler = new Handler(storage, painter, handerProxy, painter.root);

@@ -293,5 +300,9 @@ /**

* Should be invoked when container size is changed
* @param {Object} [opts]
* @param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
* @param {number|string} [opts.height] Can be 'auto' (the same as null/undefined)
*/
resize: function() {
this.painter.resize();
resize: function(opts) {
opts = opts || {};
this.painter.resize(opts.width, opts.height);
this.handler.resize();

@@ -298,0 +309,0 @@ },

{
"name": "zrender",
"version": "3.1.3",
"version": "3.2.0",
"description": "A lightweight canvas library.",

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

@@ -475,2 +475,6 @@ /**

for (var propName in props) {
if (!props.hasOwnProperty(propName)) {
continue;
}
if (!tracks[propName]) {

@@ -544,2 +548,5 @@ tracks[propName] = [];

for (var propName in this._tracks) {
if (!this._tracks.hasOwnProperty(propName)) {
continue;
}
var clip = createTrackClip(

@@ -546,0 +553,0 @@ this, easing, oneTrackDone,

@@ -38,3 +38,5 @@ /**

for (var key in opts) {
this[key] = opts[key];
if (opts.hasOwnProperty(key)) {
this[key] = opts[key];
}
}

@@ -41,0 +43,0 @@

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

function BoundingRect(x, y, width, height) {
if (width < 0) {
x = x + width;
width = -width;
}
if (height < 0) {
y = y + height;
height = -height;
}
/**

@@ -114,2 +124,7 @@ * @type {number}

intersect: function (b) {
if (!(b instanceof BoundingRect)) {
// Normalize negative width/height.
b = BoundingRect.create(b);
}
var a = this;

@@ -152,6 +167,27 @@ var ax0 = a.x;

this.height = other.height;
},
plain: function () {
return {
x: this.x,
y: this.y,
width: this.width,
height: this.height
};
}
};
/**
* @param {Object|module:zrender/core/BoundingRect} rect
* @param {number} rect.x
* @param {number} rect.y
* @param {number} rect.width
* @param {number} rect.height
* @return {module:zrender/core/BoundingRect}
*/
BoundingRect.create = function (rect) {
return new BoundingRect(rect.x, rect.y, rect.width, rect.height);
};
return BoundingRect;
});

@@ -80,9 +80,8 @@ /**

// if (webview) browser.webview = true;
if (ie) {
browser.ie = true; browser.version = ie[1];
}
if (ie) {
browser.ie = true;
browser.version = ie[1];
}
if (edge) {

@@ -89,0 +88,0 @@ browser.edge = true;

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

var Eventful = require('../mixin/Eventful');
var env = require('./env');

@@ -21,3 +22,43 @@ var isDomLevel2 = (typeof window !== 'undefined') && !!window.addEventListener;

function clientToLocal(el, e, out) {
// clientX/clientY is according to view port.
// According to the W3C Working Draft, offsetX and offsetY should be relative
// to the padding edge of the target element. The only browser using this convention
// is IE. Webkit uses the border edge, Opera uses the content edge, and FireFox does
// not support the properties.
// (see http://www.jacklmoore.com/notes/mouse-position/)
// In zr painter.dom, padding edge equals to border edge.
// FIXME
// When mousemove event triggered on ec tooltip, target is not zr painter.dom, and
// offsetX/Y is relative to e.target, where the calculation of zrX/Y via offsetX/Y
// is too complex. So css-transfrom dont support in this case temporarily.
if (!e.currentTarget || el !== e.currentTarget) {
defaultGetZrXY(el, e, out);
}
// Caution: In FireFox, layerX/layerY Mouse position relative to the closest positioned
// ancestor element, so we should make sure el is positioned (e.g., not position:static).
// BTW1, Webkit don't return the same results as FF in non-simple cases (like add
// zoom-factor, overflow / opacity layers, transforms ...)
// BTW2, (ev.offsetY || ev.pageY - $(ev.target).offset().top) is not correct in preserve-3d.
// <https://bugs.jquery.com/ticket/8523#comment:14>
// BTW3, In ff, offsetX/offsetY is always 0.
else if (env.browser.firefox && e.layerX != null && e.layerX !== e.offsetX) {
out.zrX = e.layerX;
out.zrY = e.layerY;
}
// For IE6+, chrome, safari, opera. (When will ff support offsetX?)
else if (e.offsetX != null) {
out.zrX = e.offsetX;
out.zrY = e.offsetY;
}
// For some other device, e.g., IOS safari.
else {
defaultGetZrXY(el, e, out);
}
return out;
}
function defaultGetZrXY(el, e, out) {
// This well-known method below does not support css transform.
var box = getBoundingClientRect(el);

@@ -27,3 +68,2 @@ out = out || {};

out.zrY = e.clientY - box.top;
return out;
}

@@ -30,0 +70,0 @@

@@ -29,3 +29,3 @@ define(

mes + ' ' + (new Date() - 0)
+ '<br/>'
+ '<br/>'
+ document.getElementById('wrong-message').innerHTML;

@@ -32,0 +32,0 @@ };

@@ -17,3 +17,3 @@ define(function (require) {

'click', 'dblclick', 'mousewheel', 'mouseout',
'mouseup', 'mousedown', 'mousemove'
'mouseup', 'mousedown', 'mousemove', 'contextmenu'
];

@@ -173,3 +173,3 @@

// Common handlers
zrUtil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick'], function (name) {
zrUtil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name) {
domHandlers[name] = function (event) {

@@ -176,0 +176,0 @@ event = normalizeEvent(this.dom, event);

@@ -282,3 +282,5 @@ /**

for (var name in key) {
shape[name] = key[name];
if (key.hasOwnProperty(name)) {
shape[name] = key[name];
}
}

@@ -285,0 +287,0 @@ }

/**
* 水滴形状
* 椭圆形状
* @module zrender/graphic/shape/Ellipse

@@ -4,0 +4,0 @@ */

@@ -114,4 +114,6 @@ /**

for (var name in optsStates) {
var state = optsStates[name];
this._addState(name, state);
if (optsStates.hasOwnProperty(name)) {
var state = optsStates[name];
this._addState(name, state);
}
}

@@ -169,3 +171,5 @@ }

for (var name in this._states) {
this._extendFromInitial(this._states[name]);
if (this._states.hasOwnProperty(name)) {
this._extendFromInitial(this._states[name]);
}
}

@@ -296,2 +300,5 @@ }

for (var key in state[propName]) {
if (!state[propName].hasOwnProperty(key)) {
continue;
}
var path = propName + '.' + key;

@@ -298,0 +305,0 @@ if (propPathMap[path]) {

@@ -38,3 +38,3 @@ /**

'click', 'dblclick', 'mousewheel', 'mouseout',
'mouseup', 'mousedown', 'mousemove'
'mouseup', 'mousedown', 'mousemove', 'contextmenu'
];

@@ -45,7 +45,8 @@ /**

* @extends module:zrender/mixin/Eventful
* @param {HTMLElement} root Main HTML element for painting.
* @param {module:zrender/Storage} storage Storage instance.
* @param {module:zrender/Painter} painter Painter instance.
* @param {module:zrender/dom/HandlerProxy} proxy HandlerProxy instance.
* @param {HTMLElement} painterRoot painter.root (not painter.getViewportRoot()).
*/
var Handler = function(storage, painter, proxy) {
var Handler = function(storage, painter, proxy, painterRoot) {
Eventful.call(this);

@@ -57,3 +58,6 @@

this.painterRoot = painterRoot;
proxy = proxy || new EmptyProxy();
/**

@@ -132,5 +136,17 @@ * Proxy of event. can be Dom, WebGLSurface, etc.

this.trigger('globalout', {
event: event
});
// There might be some doms created by upper layer application
// at the same level of painter.getViewportRoot() (e.g., tooltip
// dom created by echarts), where 'globalout' event should not
// be triggered when mouse enters these doms. (But 'mouseout'
// should be triggered at the original hovered element as usual).
var element = event.toElement || event.relatedTarget;
var innerDom;
do {
element = element && element.parentNode;
}
while (element && element.nodeType != 9 && !(
innerDom = element === this.painterRoot
));
!innerDom && this.trigger('globalout', {event: event});
},

@@ -241,3 +257,3 @@

// Common handlers
util.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick'], function (name) {
util.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name) {
Handler.prototype[name] = function (event) {

@@ -244,0 +260,0 @@ // Find hover again to avoid click event is dispatched manually. Or click is triggered without mouseover

@@ -74,2 +74,5 @@ /**

domStyle['-webkit-tap-highlight-color'] = 'rgba(0,0,0,0)';
domStyle['padding'] = 0;
domStyle['margin'] = 0;
domStyle['border-width'] = 0;
}

@@ -76,0 +79,0 @@

@@ -225,2 +225,6 @@ /**

for (var name in target) {
if (!target.hasOwnProperty(name)) {
continue;
}
if (source[name] != null) {

@@ -227,0 +231,0 @@ if (isObject(target[name]) && !util.isArrayLike(target[name])) {

@@ -102,9 +102,14 @@ /**

var domRoot = document.createElement('div');
var domRootStyle = domRoot.style;
// domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
domRootStyle.position = 'relative';
domRootStyle.overflow = 'hidden';
domRootStyle.width = width + 'px';
domRootStyle.height = height + 'px';
domRoot.style.cssText = [
'position:relative',
'overflow:hidden',
'width:' + width + 'px',
'height:' + height + 'px',
'padding:0',
'margin:0',
'border-width:0'
].join(';') + ';';
return domRoot;

@@ -125,3 +130,3 @@ }

opts = opts || {};
this._opts = opts = util.extend({}, opts || {});

@@ -178,4 +183,4 @@ /**

if (!singleCanvas) {
this._width = this._getWidth();
this._height = this._getHeight();
this._width = this._getSize(0);
this._height = this._getSize(1);

@@ -885,5 +890,10 @@ var domRoot = this._domRoot = createRoot(

width = width || this._getWidth();
height = height || this._getHeight();
// Save input w/h
var opts = this._opts;
width != null && (opts.width = width);
height != null && (opts.height = height);
width = this._getSize(0);
height = this._getSize(1);
domRoot.style.display = '';

@@ -897,4 +907,9 @@

for (var id in this._layers) {
this._layers[id].resize(width, height);
if (this._layers.hasOwnProperty(id)) {
this._layers[id].resize(width, height);
}
}
util.each(this._progressiveLayers, function (layer) {
layer.resize(width, height);
});

@@ -975,19 +990,21 @@ this.refresh(true);

_getWidth: function () {
var root = this.root;
var stl = document.defaultView.getComputedStyle(root);
_getSize: function (whIdx) {
var opts = this._opts;
var wh = ['width', 'height'][whIdx];
var cwh = ['clientWidth', 'clientHeight'][whIdx];
var plt = ['paddingLeft', 'paddingTop'][whIdx];
var prb = ['paddingRight', 'paddingBottom'][whIdx];
// FIXME Better way to get the width and height when element has not been append to the document
return ((root.clientWidth || parseInt10(stl.width) || parseInt10(root.style.width))
- (parseInt10(stl.paddingLeft) || 0)
- (parseInt10(stl.paddingRight) || 0)) | 0;
},
if (opts[wh] != null && opts[wh] !== 'auto') {
return parseFloat(opts[wh]);
}
_getHeight: function () {
var root = this.root;
var stl = document.defaultView.getComputedStyle(root);
return ((root.clientHeight || parseInt10(stl.height) || parseInt10(root.style.height))
- (parseInt10(stl.paddingTop) || 0)
- (parseInt10(stl.paddingBottom) || 0)) | 0;
return (
(root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh]))
- (parseInt10(stl[plt]) || 0)
- (parseInt10(stl[prb]) || 0)
) | 0;
},

@@ -994,0 +1011,0 @@

@@ -121,7 +121,7 @@ /**

resize: function () {
var width = this._getWidth();
var height = this._getHeight();
resize: function (width, height) {
var width = width == null ? this._getWidth() : width;
var height = height == null ? this._getHeight() : height;
if (this._width != width && this._height != height) {
if (this._width != width || this._height != height) {
this._width = width;

@@ -153,3 +153,5 @@ this._height = height;

clear: function () {
this.root.removeChild(this.vmlViewport);
if (this._vmlViewport) {
this.root.removeChild(this._vmlViewport);
}
},

@@ -156,0 +158,0 @@

@@ -29,6 +29,7 @@ /*!

var zrender = {};
/**
* @type {string}
*/
zrender.version = '3.1.3';
zrender.version = '3.2.0';

@@ -41,2 +42,4 @@ /**

* @param {number} [opts.devicePixelRatio]
* @param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
* @param {number|string} [opts.height] Can be 'auto' (the same as null/undefined)
* @return {module:zrender/ZRender}

@@ -60,3 +63,5 @@ */

for (var key in instances) {
instances[key].dispose();
if (instances.hasOwnProperty(key)) {
instances[key].dispose();
}
}

@@ -97,2 +102,4 @@ instances = {};

* @param {number} [opts.devicePixelRatio]
* @param {number} [opts.width] Can be 'auto' (the same as null/undefined)
* @param {number} [opts.height] Can be 'auto' (the same as null/undefined)
*/

@@ -132,3 +139,3 @@ var ZRender = function(id, dom, opts) {

var handerProxy = !env.node ? new HandlerProxy(painter.getViewportRoot()) : null;
this.handler = new Handler(storage, painter, handerProxy);
this.handler = new Handler(storage, painter, handerProxy, painter.root);

@@ -293,5 +300,9 @@ /**

* Should be invoked when container size is changed
* @param {Object} [opts]
* @param {number|string} [opts.width] Can be 'auto' (the same as null/undefined)
* @param {number|string} [opts.height] Can be 'auto' (the same as null/undefined)
*/
resize: function() {
this.painter.resize();
resize: function(opts) {
opts = opts || {};
this.painter.resize(opts.width, opts.height);
this.handler.resize();

@@ -298,0 +309,0 @@ },

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