Socket
Socket
Sign inDemoInstall

@antv/g

Package Overview
Dependencies
Maintainers
7
Versions
349
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g - npm Package Compare versions

Comparing version 3.1.3 to 3.2.0

.idea/inspectionProfiles/Project_Default.xml

4

lib/core/group.js

@@ -295,3 +295,3 @@ var Util = require('../util/index');

if (boxMinX < minX) {
if (boxMinX < minX && boxMinX > 0) {
minX = boxMinX;

@@ -304,3 +304,3 @@ }

if (boxMinY < minY) {
if (boxMinY < minY && boxMaxY > 0) {
minY = boxMinY;

@@ -307,0 +307,0 @@ }

var Util = require('../../util/index');
var MatrixUtil = require('../../util/matrix');
var ReservedProps = {

@@ -30,5 +28,5 @@ delay: 'delay',

if (k === 'transform') {
rst.matrix = MatrixUtil.transform(shape.getMatrix(), props[k]);
rst.matrix = Util.transform(shape.getMatrix(), props[k]);
} else if (k === 'rotate') {
rst.matrix = MatrixUtil.transform(shape.getMatrix(), [['r', props[k]]]);
rst.matrix = Util.transform(shape.getMatrix(), [['r', props[k]]]);
} else if (k === 'matrix') {

@@ -45,11 +43,23 @@ rst.matrix = props[k];

function checkExistedAttrs(animators, animator) {
var delay = animator.delay;
var hasOwnProperty = Object.prototype.hasOwnProperty;
Util.each(animator.toAttrs, function (v, k) {
Util.each(animators, function (animator) {
if (hasOwnProperty.call(animator.toAttrs, k)) {
delete animator.toAttrs[k];
delete animator.fromAttrs[k];
if (delay < animator.startTime + animator.duration) {
if (hasOwnProperty.call(animator.toAttrs, k)) {
delete animator.toAttrs[k];
delete animator.fromAttrs[k];
}
}
});
});
if (animator.toMatrix) {
Util.each(animators, function (animator) {
if (delay < animator.startTime + animator.duration && animator.toMatrix) {
delete animator.toMatrix;
}
});
}
return animators;

@@ -56,0 +66,0 @@ }

@@ -5,8 +5,2 @@ var Util = require('../../util/index');

var mat3 = require('../../util/matrix').mat3;
var vec2 = require('../../util/matrix').vec2;
var vec3 = require('../../util/matrix').vec3;
var mathUtl = {

@@ -80,6 +74,6 @@ arc: require('../../shapes/math/arc'),

var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
mat3.scale(m, m, [scaleX, scaleY]);
mat3.translate(m, m, [cx, cy]);
var inm = mat3.invert([], m);
vec3.transformMat3(p, p, inm);
Util.mat3.scale(m, m, [scaleX, scaleY]);
Util.mat3.translate(m, m, [cx, cy]);
var inm = Util.mat3.invert([], m);
Util.vec3.transformMat3(p, p, inm);

@@ -115,3 +109,3 @@ if (fill && stroke) {

var subv = [x - cx, y - cy];
var angle = vec2.angleTo(v1, subv);
var angle = Util.vec2.angleTo(v1, subv);

@@ -122,3 +116,3 @@ function _isPointInFill() {

if (Util.isNumberEqual(angle, angle1)) {
var ls = vec2.squaredLength(subv);
var ls = Util.vec2.squaredLength(subv);

@@ -125,0 +119,0 @@ if (rs * rs <= ls && ls <= re * re) {

@@ -1,8 +0,4 @@

var Util = require('../../util/index');
var Util = require('../../util/index'); // 是否未改变
var mat3 = require('../../util/matrix').mat3;
var vec3 = require('../../util/matrix').vec3; // 是否未改变
function isUnchanged(m) {

@@ -23,3 +19,3 @@ return m[0] === 1 && m[1] === 0 && m[3] === 0 && m[4] === 1 && m[6] === 0 && m[7] === 0;

} else {
mat3.multiply(m1, m1, m2);
Util.mat3.multiply(m1, m1, m2);
}

@@ -36,3 +32,3 @@ }

var matrix = this._attrs.matrix;
mat3.translate(matrix, matrix, [tx, ty]);
Util.mat3.translate(matrix, matrix, [tx, ty]);
this.clearTotalMatrix();

@@ -44,3 +40,3 @@ this.attr('matrix', matrix);

var matrix = this._attrs.matrix;
mat3.rotate(matrix, matrix, radian);
Util.mat3.rotate(matrix, matrix, radian);
this.clearTotalMatrix();

@@ -52,3 +48,3 @@ this.attr('matrix', matrix);

var matrix = this._attrs.matrix;
mat3.scale(matrix, matrix, [s1, s2]);
Util.mat3.scale(matrix, matrix, [s1, s2]);
this.clearTotalMatrix();

@@ -96,3 +92,3 @@ this.attr('matrix', matrix);

case 'm':
self.attr('matrix', mat3.multiply([], matrix, t[1]));
self.attr('matrix', Util.mat3.multiply([], matrix, t[1]));
self.clearTotalMatrix();

@@ -128,3 +124,3 @@ break;

vec3.transformMat3(v, v, m);
Util.vec3.transformMat3(v, v, m);
return this;

@@ -147,3 +143,3 @@ },

Util.each(parents, function (child) {
mat3.multiply(m, child.attr('matrix'), m);
Util.mat3.multiply(m, child.attr('matrix'), m);
});

@@ -185,6 +181,6 @@ return m;

} else {
var inm = mat3.invert([], m);
var inm = Util.mat3.invert([], m);
if (inm) {
vec3.transformMat3(v, v, inm);
Util.vec3.transformMat3(v, v, inm);
}

@@ -191,0 +187,0 @@ }

@@ -19,10 +19,5 @@ module.exports = {

PathSegment: require('./shapes/util/path-segment'),
// utils
CommonUtil: require('./util/common'),
DomUtil: require('./util/dom'),
MatrixUtil: require('./util/matrix'),
PathUtil: require('./util/path'),
Event: require('./event'),
// version, etc.
version: '3.1.3'
version: '3.2.0'
};

@@ -5,4 +5,2 @@ var Util = require('../util/index');

var mat3 = require('../util/matrix').mat3;
var Ellipse = function Ellipse(cfg) {

@@ -56,4 +54,4 @@ Ellipse.superclass.constructor.call(this, cfg);

var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
mat3.scale(m, m, [scaleX, scaleY]);
mat3.translate(m, m, [cx, cy]);
Util.mat3.scale(m, m, [scaleX, scaleY]);
Util.mat3.translate(m, m, [cx, cy]);
context.beginPath();

@@ -60,0 +58,0 @@ context.save();

var Util = require('../../util/index');
var vec2 = require('../../util/matrix').vec2;
function circlePoint(cx, cy, r, angle) {

@@ -78,4 +76,4 @@ return {

var v1 = [1, 0];
var subv = vec2.subtract([], v, v0);
var angle = vec2.angleTo(v1, subv);
var subv = Util.vec2.subtract([], v, v0);
var angle = Util.vec2.angleTo(v1, subv);
angle = nearAngle(angle, startAngle, endAngle, clockwise);

@@ -89,3 +87,3 @@ var vpoint = [r * Math.cos(angle) + cx, r * Math.sin(angle) + cy];

var d = vec2.distance(vpoint, v);
var d = Util.vec2.distance(vpoint, v);
return d;

@@ -92,0 +90,0 @@ }

var Util = require('../../util/index');
var vec2 = require('../../util/matrix').vec2;
var vec2 = Util.vec2;

@@ -5,0 +5,0 @@ function cubicAt(p0, p1, p2, p3, t) {

@@ -1,2 +0,2 @@

var vec2 = require('../../util/matrix').vec2;
var vec2 = require('../../util/index').vec2;

@@ -3,0 +3,0 @@ module.exports = {

var Util = require('../../util/index');
var vec2 = require('../../util/matrix').vec2;
var vec2 = Util.vec2;

@@ -5,0 +5,0 @@ function quadraticAt(p0, p1, p2, t) {

@@ -11,6 +11,4 @@ var Util = require('../../util/index');

var vec3 = require('../../util/matrix').vec3;
var mat3 = require('../../util/matrix').mat3;
var vec3 = Util.vec3;
var mat3 = Util.mat3;
var ARR_CMD = ['m', 'l', 'c', 'a', 'q', 'h', 'v', 't', 's', 'z'];

@@ -81,2 +79,10 @@

if (vRatio(u, v) <= -1) {
dTheta = Math.PI;
}
if (vRatio(u, v) >= 1) {
dTheta = 0;
}
if (fs === 0 && dTheta > 0) {

@@ -83,0 +89,0 @@ dTheta = dTheta - 2 * Math.PI;

@@ -32,3 +32,13 @@ var Util = require('@antv/util/lib');

mod: Util.mod,
clamp: Util.clamp
clamp: Util.clamp,
createDom: Util.createDom,
modifyCSS: Util.modifyCSS,
requestAnimationFrame: Util.requestAnimationFrame,
getRatio: function getRatio() {
return window.devicePixelRatio ? window.devicePixelRatio : 2;
},
mat3: Util.mat3,
vec2: Util.vec2,
vec3: Util.vec3,
transform: Util.transform
};

@@ -15,2 +15,3 @@ var Util = require('./common');

};
module.exports = {

@@ -29,3 +30,2 @@ getBoundingClientRect: function getBoundingClientRect(node, defaultValue) {

}
return defaultValue || null;

@@ -46,3 +46,2 @@ },

}
return dom.currentStyle[name];

@@ -53,3 +52,2 @@ } catch (e) {

}
return null;

@@ -66,3 +64,2 @@ }

}
return dom;

@@ -78,7 +75,5 @@ },

var name = FRAGMENT_REG.test(str) && RegExp.$1;
if (!(name in CONTAINERS)) {
name = '*';
}
var container = CONTAINERS[name];

@@ -103,7 +98,5 @@ str = str.replace(/(^\s*)|(\s*$)/g, '');

var width = this.getStyle(el, 'width', defaultValue);
if (width === 'auto') {
width = el.offsetWidth;
}
return parseFloat(width);

@@ -120,7 +113,5 @@ },

var height = this.getStyle(el, 'height', defaultValue);
if (height === 'auto') {
height = el.offsetHeight;
}
return parseFloat(height);

@@ -127,0 +118,0 @@ },

var CommonUtil = require('./common');
var DomUtil = require('./dom');
var Util = {};
CommonUtil.merge(Util, CommonUtil, DomUtil, {
CommonUtil.merge(Util, CommonUtil, {
mixin: function mixin(c, mixins) {

@@ -8,0 +6,0 @@ var Param = c.CFG ? 'CFG' : 'ATTRS';

var CommonUtil = require('./common');
var mat3 = require('@antv/gl-matrix/lib/gl-matrix/mat3');
var vec3 = require('@antv/gl-matrix/lib/gl-matrix/vec3');
var vec2 = require('@antv/gl-matrix/lib/gl-matrix/vec2');

@@ -19,12 +16,8 @@

*/
vec2.direction = function (v1, v2) {
return v1[0] * v2[1] - v2[0] * v1[1];
};
vec2.angleTo = function (v1, v2, direct) {
var angle = vec2.angle(v1, v2);
var angleLargeThanPI = vec2.direction(v1, v2) >= 0;
if (direct) {

@@ -41,6 +34,4 @@ if (angleLargeThanPI) {

}
return Math.PI * 2 - angle;
};
vec2.vertical = function (out, v, flag) {

@@ -87,15 +78,11 @@ if (flag) {

break;
case 's':
mat3.scale(m, m, [t[1], t[2]]);
break;
case 'r':
mat3.rotate(m, m, t[1]);
break;
case 'm':
mat3.multiply(m, m, t[1]);
break;
default:

@@ -102,0 +89,0 @@ return false;

{
"name": "@antv/g",
"version": "3.1.3",
"version": "3.2.0",
"description": "A canvas library which providing 2d draw for G2.",

@@ -59,2 +59,3 @@ "keywords": [

"test": "torch --compile --renderer --recursive ./test/unit",
"test-bugs": "torch --compile --renderer --recursive ./test/bugs",
"test-live": "torch --compile --renderer --interactive --recursive ./test/unit/"

@@ -65,3 +66,4 @@ },

"lint",
"test"
"test",
"test-bugs"
],

@@ -72,3 +74,3 @@ "silent": false

"@antv/gl-matrix": "~2.7.1",
"@antv/util": "~1.0.11",
"@antv/util": "~1.2.3",
"d3-ease": "~1.0.3",

@@ -75,0 +77,0 @@ "d3-interpolate": "~1.1.5",

@@ -258,3 +258,3 @@ const Util = require('../util/index');

if (boxMinX < minX) {
if (boxMinX < minX && boxMinX > 0) {
minX = boxMinX;

@@ -267,3 +267,3 @@ }

if (boxMinY < minY) {
if (boxMinY < minY && boxMaxY > 0) {
minY = boxMinY;

@@ -270,0 +270,0 @@ }

const Util = require('../../util/index');
const MatrixUtil = require('../../util/matrix');

@@ -23,5 +22,5 @@ const ReservedProps = { delay: 'delay', rotate: 'rotate' };

if (k === 'transform') {
rst.matrix = MatrixUtil.transform(shape.getMatrix(), props[k]);
rst.matrix = Util.transform(shape.getMatrix(), props[k]);
} else if (k === 'rotate') {
rst.matrix = MatrixUtil.transform(shape.getMatrix(), [[ 'r', props[k] ]]);
rst.matrix = Util.transform(shape.getMatrix(), [[ 'r', props[k] ]]);
} else if (k === 'matrix') {

@@ -37,11 +36,21 @@ rst.matrix = props[k];

function checkExistedAttrs(animators, animator) {
const delay = animator.delay;
const hasOwnProperty = Object.prototype.hasOwnProperty;
Util.each(animator.toAttrs, (v, k) => {
Util.each(animators, animator => {
if (hasOwnProperty.call(animator.toAttrs, k)) {
delete animator.toAttrs[k];
delete animator.fromAttrs[k];
if (delay < animator.startTime + animator.duration) {
if (hasOwnProperty.call(animator.toAttrs, k)) {
delete animator.toAttrs[k];
delete animator.fromAttrs[k];
}
}
});
});
if (animator.toMatrix) {
Util.each(animators, animator => {
if (delay < (animator.startTime + animator.duration) && animator.toMatrix) {
delete animator.toMatrix;
}
});
}
return animators;

@@ -48,0 +57,0 @@ }

const Util = require('../../util/index');
const Inside = require('../../shapes/util/inside');
const mat3 = require('../../util/matrix').mat3;
const vec2 = require('../../util/matrix').vec2;
const vec3 = require('../../util/matrix').vec3;
const mathUtl = {

@@ -69,6 +67,6 @@ arc: require('../../shapes/math/arc'),

const m = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
mat3.scale(m, m, [ scaleX, scaleY ]);
mat3.translate(m, m, [ cx, cy ]);
const inm = mat3.invert([], m);
vec3.transformMat3(p, p, inm);
Util.mat3.scale(m, m, [ scaleX, scaleY ]);
Util.mat3.translate(m, m, [ cx, cy ]);
const inm = Util.mat3.invert([], m);
Util.vec3.transformMat3(p, p, inm);

@@ -104,3 +102,3 @@ if (fill && stroke) {

const subv = [ x - cx, y - cy ];
const angle = vec2.angleTo(v1, subv);
const angle = Util.vec2.angleTo(v1, subv);

@@ -111,3 +109,3 @@ function _isPointInFill() {

if (Util.isNumberEqual(angle, angle1)) {
const ls = vec2.squaredLength(subv);
const ls = Util.vec2.squaredLength(subv);
if (rs * rs <= ls && ls <= re * re) {

@@ -114,0 +112,0 @@ return true;

const Util = require('../../util/index');
const mat3 = require('../../util/matrix').mat3;
const vec3 = require('../../util/matrix').vec3;

@@ -21,3 +19,3 @@ // 是否未改变

} else {
mat3.multiply(m1, m1, m2);
Util.mat3.multiply(m1, m1, m2);
}

@@ -34,3 +32,3 @@ }

const matrix = this._attrs.matrix;
mat3.translate(matrix, matrix, [ tx, ty ]);
Util.mat3.translate(matrix, matrix, [ tx, ty ]);
this.clearTotalMatrix();

@@ -42,3 +40,3 @@ this.attr('matrix', matrix);

const matrix = this._attrs.matrix;
mat3.rotate(matrix, matrix, radian);
Util.mat3.rotate(matrix, matrix, radian);
this.clearTotalMatrix();

@@ -50,3 +48,3 @@ this.attr('matrix', matrix);

const matrix = this._attrs.matrix;
mat3.scale(matrix, matrix, [ s1, s2 ]);
Util.mat3.scale(matrix, matrix, [ s1, s2 ]);
this.clearTotalMatrix();

@@ -92,3 +90,3 @@ this.attr('matrix', matrix);

case 'm':
self.attr('matrix', mat3.multiply([], matrix, t[1]));
self.attr('matrix', Util.mat3.multiply([], matrix, t[1]));
self.clearTotalMatrix();

@@ -121,3 +119,3 @@ break;

}
vec3.transformMat3(v, v, m);
Util.vec3.transformMat3(v, v, m);
return this;

@@ -140,3 +138,3 @@ },

Util.each(parents, function(child) {
mat3.multiply(m, child.attr('matrix'), m);
Util.mat3.multiply(m, child.attr('matrix'), m);
});

@@ -175,5 +173,5 @@ return m;

} else {
const inm = mat3.invert([], m);
const inm = Util.mat3.invert([], m);
if (inm) {
vec3.transformMat3(v, v, inm);
Util.vec3.transformMat3(v, v, inm);
}

@@ -180,0 +178,0 @@ }

@@ -19,10 +19,5 @@ module.exports = {

PathSegment: require('./shapes/util/path-segment'),
// utils
CommonUtil: require('./util/common'),
DomUtil: require('./util/dom'),
MatrixUtil: require('./util/matrix'),
PathUtil: require('./util/path'),
Event: require('./event'),
// version, etc.
version: '3.1.3'
version: '3.2.0'
};
const Util = require('../util/index');
const Shape = require('../core/shape');
const mat3 = require('../util/matrix').mat3;

@@ -58,4 +57,4 @@ const Ellipse = function(cfg) {

const m = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
mat3.scale(m, m, [ scaleX, scaleY ]);
mat3.translate(m, m, [ cx, cy ]);
Util.mat3.scale(m, m, [ scaleX, scaleY ]);
Util.mat3.translate(m, m, [ cx, cy ]);
context.beginPath();

@@ -62,0 +61,0 @@ context.save();

const Util = require('../../util/index');
const vec2 = require('../../util/matrix').vec2;

@@ -66,4 +65,4 @@ function circlePoint(cx, cy, r, angle) {

const v1 = [ 1, 0 ];
const subv = vec2.subtract([], v, v0);
let angle = vec2.angleTo(v1, subv);
const subv = Util.vec2.subtract([], v, v0);
let angle = Util.vec2.angleTo(v1, subv);

@@ -76,3 +75,3 @@ angle = nearAngle(angle, startAngle, endAngle, clockwise);

}
const d = vec2.distance(vpoint, v);
const d = Util.vec2.distance(vpoint, v);
return d;

@@ -79,0 +78,0 @@ }

const Util = require('../../util/index');
const vec2 = require('../../util/matrix').vec2;
const vec2 = Util.vec2;

@@ -4,0 +4,0 @@ function cubicAt(p0, p1, p2, p3, t) {

@@ -1,2 +0,2 @@

const vec2 = require('../../util/matrix').vec2;
const vec2 = require('../../util/index').vec2;

@@ -3,0 +3,0 @@ module.exports = {

const Util = require('../../util/index');
const vec2 = require('../../util/matrix').vec2;
const vec2 = Util.vec2;

@@ -4,0 +4,0 @@ function quadraticAt(p0, p1, p2, t) {

@@ -6,4 +6,4 @@ const Util = require('../../util/index');

const Ellipse = require('../math/ellipse');
const vec3 = require('../../util/matrix').vec3;
const mat3 = require('../../util/matrix').mat3;
const vec3 = Util.vec3;
const mat3 = Util.mat3;

@@ -47,2 +47,3 @@ const ARR_CMD = [ 'm', 'l', 'c', 'a', 'q', 'h', 'v', 't', 's', 'z' ];

const lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
if (lambda > 1) {

@@ -72,2 +73,9 @@ rx *= Math.sqrt(lambda);

let dTheta = vAngle(u, v);
if (vRatio(u, v) <= -1) {
dTheta = Math.PI;
}
if (vRatio(u, v) >= 1) {
dTheta = 0;
}
if (fs === 0 && dTheta > 0) {

@@ -74,0 +82,0 @@ dTheta = dTheta - 2 * Math.PI;

@@ -28,3 +28,13 @@ const Util = require('@antv/util/lib');

mod: Util.mod,
clamp: Util.clamp
clamp: Util.clamp,
createDom: Util.createDom,
modifyCSS: Util.modifyCSS,
requestAnimationFrame: Util.requestAnimationFrame,
getRatio: function getRatio() {
return window.devicePixelRatio ? window.devicePixelRatio : 2;
},
mat3: Util.mat3,
vec2: Util.vec2,
vec3: Util.vec3,
transform: Util.transform
};
const CommonUtil = require('./common');
const DomUtil = require('./dom');
const Util = {};
CommonUtil.merge(Util, CommonUtil, DomUtil, {
CommonUtil.merge(Util, CommonUtil, {
mixin(c, mixins) {

@@ -8,0 +6,0 @@ const Param = c.CFG ? 'CFG' : 'ATTRS';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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