Comparing version 2.1.0 to 3.0.0-beta.1
module.exports = { | ||
babelrc: { | ||
presets: [ | ||
[ | ||
"env", | ||
{ | ||
"loose": true, | ||
"modules": false | ||
} | ||
] | ||
"env", | ||
], | ||
@@ -12,0 +6,0 @@ sourceMaps: 'inline' |
module.exports = { | ||
Canvas: require('./canvas'), | ||
Group: require('./core/group'), | ||
Shape: require('./core/shape'), | ||
Rect: require('./shape/rect'), | ||
Circle: require('./shape/circle'), | ||
Ellipse: require('./shape/ellipse'), | ||
Path: require('./shape/path'), | ||
Text: require('./shape/text'), | ||
Line: require('./shape/line'), | ||
Image: require('./shape/image'), | ||
Polygon: require('./shape/polygon'), | ||
Polyline: require('./shape/polyline'), | ||
Arc: require('./shape/arc'), | ||
Fan: require('./shape/fan'), | ||
Cubic: require('./shape/cubic'), | ||
Quadratic: require('./shape/quadratic'), | ||
Marker: require('./shape/marker'), | ||
PathUtil: require('./util/path'), | ||
PathSegment: require('./shape/util/path-segment'), | ||
MatrixUtil: require('./util/matrix'), | ||
// renderers | ||
svg: require('./svg/index'), | ||
canvas: require('./canvas/index'), | ||
// utils | ||
CommonUtil: require('./util/common'), | ||
DomUtil: require('./util/dom'), | ||
Event: require('./event'), | ||
version: '____G_VERSION____' | ||
MatrixUtil: require('./util/matrix'), | ||
PathUtil: require('./util/path'), | ||
// version, etc. | ||
version: '2.1.0' | ||
}; |
@@ -1,118 +0,28 @@ | ||
var PRECISION = 0.00001; // 常量,据的精度,小于这个精度认为是0 | ||
var RADIAN = Math.PI / 180; | ||
var DEGREE = 180 / Math.PI; | ||
var Util = require('@antv/util'); | ||
module.exports = { | ||
isFunction: require('lodash/isFunction'), | ||
isObject: require('lodash/isObject'), | ||
isBoolean: require('lodash/isBoolean'), | ||
isNil: require('lodash/isNil'), | ||
isString: require('lodash/isString'), | ||
isArray: require('lodash/isArray'), | ||
isNumber: require('lodash/isNumber'), | ||
isEmpty: require('lodash/isEmpty'), // isBlank | ||
uniqueId: require('lodash/uniqueId'), | ||
clone: require('lodash/clone'), | ||
assign: require('lodash/assign'), // simpleMix | ||
merge: require('lodash/merge'), // mix | ||
upperFirst: require('lodash/upperFirst'), // ucfirst | ||
remove: require('lodash/pull'), | ||
each: require('lodash/forEach'), | ||
isEqual: require('lodash/isEqual'), | ||
toArray: require('lodash/toArray'), | ||
extend: function extend(subclass, superclass, overrides, staticOverrides) { | ||
// 如果只提供父类构造函数,则自动生成子类构造函数 | ||
if (!this.isFunction(superclass)) { | ||
overrides = superclass; | ||
superclass = subclass; | ||
subclass = function subclass() {}; | ||
} | ||
var create = Object.create ? function (proto, c) { | ||
return Object.create(proto, { | ||
constructor: { | ||
value: c | ||
} | ||
}); | ||
} : function (proto, c) { | ||
function F() {} | ||
F.prototype = proto; | ||
var o = new F(); | ||
o.constructor = c; | ||
return o; | ||
}; | ||
var superObj = create(superclass.prototype, subclass); // new superclass(),//实例化父类作为子类的prototype | ||
subclass.prototype = this.merge(superObj, subclass.prototype); // 指定子类的prototype | ||
subclass.superclass = create(superclass.prototype, superclass); | ||
this.merge(superObj, overrides); | ||
this.merge(subclass, staticOverrides); | ||
return subclass; | ||
}, | ||
augment: function augment(c) { | ||
var args = this.toArray(arguments); | ||
for (var i = 1; i < args.length; i++) { | ||
var obj = args[i]; | ||
if (this.isFunction(obj)) { | ||
obj = obj.prototype; | ||
} | ||
this.merge(c.prototype, obj); | ||
} | ||
}, | ||
/** | ||
* 判断两个数是否相等 | ||
* @param {Number} a 数 | ||
* @param {Number} b 数 | ||
* @return {Boolean} 是否相等 | ||
**/ | ||
isNumberEqual: function isNumberEqual(a, b) { | ||
return Math.abs(a - b) < PRECISION; | ||
}, | ||
/** | ||
* 获取角度对应的弧度 | ||
* @param {Number} degree 角度 | ||
* @return {Number} 弧度 | ||
**/ | ||
toRadian: function toRadian(degree) { | ||
return RADIAN * degree; | ||
}, | ||
/** | ||
* 获取弧度对应的角度 | ||
* @param {Number} radian 弧度 | ||
* @return {Number} 角度 | ||
**/ | ||
toDegree: function toDegree(radian) { | ||
return DEGREE * radian; | ||
}, | ||
/** | ||
* 广义取模运算 | ||
* @param {Number} n 被取模的值 | ||
* @param {Number} m 模 | ||
* @return {Number} 返回n 被 m 取模的结果 | ||
*/ | ||
mod: function mod(n, m) { | ||
return (n % m + m) % m; | ||
}, | ||
/** | ||
* 把a夹在min,max中间, 低于min的返回min,高于max的返回max,否则返回自身 | ||
* @param {Number} a 数 | ||
* @param {Number} min 下限 | ||
* @param {Number} max 上限 | ||
* @return {Number} 返回结果值 | ||
**/ | ||
clamp: function clamp(a, min, max) { | ||
if (a < min) { | ||
return min; | ||
} else if (a > max) { | ||
return max; | ||
} | ||
return a; | ||
} | ||
isFunction: Util.isFunction, | ||
isObject: Util.isObject, | ||
isBoolean: Util.isBoolean, | ||
isNil: Util.isNil, | ||
isString: Util.isString, | ||
isArray: Util.isArray, | ||
isNumber: Util.isNumber, | ||
isEmpty: Util.isEmpty, // isBlank | ||
uniqueId: Util.uniqueId, | ||
clone: Util.clone, | ||
assign: Util.mix, // simpleMix | ||
merge: Util.deepMix, // mix | ||
upperFirst: Util.upperFirst, // ucfirst | ||
each: Util.each, | ||
isEqual: Util.isEqual, | ||
toArray: Util.toArray, | ||
extend: Util.extend, | ||
augment: Util.augment, | ||
remove: Util.arrayUtil.pull, | ||
isNumberEqual: Util.isNumberEqual, | ||
toRadian: Util.toRadian, | ||
toDegree: Util.toDegree, | ||
mod: Util.mod, | ||
clamp: Util.clamp | ||
}; |
@@ -82,2 +82,7 @@ var Util = require('../util/index'); | ||
var steps = arr[4]; | ||
// 环半径为0时,默认无渐变,取渐变序列的最后一个颜色 | ||
if (fr === 0) { | ||
var colors = steps.match(regexColorStop); | ||
return colors[colors.length - 1].split(':')[1]; | ||
} | ||
var box = self.getBBox(); | ||
@@ -84,0 +89,0 @@ var context = self.get('context'); |
{ | ||
"name": "@antv/g", | ||
"version": "2.1.0", | ||
"version": "3.0.0-beta.1", | ||
"description": "A canvas library which providing 2d draw for G2.", | ||
@@ -10,5 +10,5 @@ "keywords": [ | ||
], | ||
"main": "build/g.js", | ||
"browser": "build/g.js", | ||
"module": "lib/index.js", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"homepage": "https://github.com/antvis/g", | ||
@@ -24,3 +24,3 @@ "author": "https://github.com/orgs/antvis/people", | ||
"devDependencies": { | ||
"@lite-js/torch": "~0.2.6", | ||
"torchjs": "~2.0.3", | ||
"babel-cli": "~6.26.0", | ||
@@ -32,3 +32,3 @@ "babel-eslint": "~7.2.3", | ||
"chai": "~4.0.1", | ||
"electron": "~1.8.4", | ||
"electron": "~2.0.2", | ||
"eslint": "~3.19.0", | ||
@@ -58,3 +58,4 @@ "eslint-config-airbnb": "~15.0.1", | ||
"dist": "rm -rf dist && mkdir dist && npm run build && npm run compress", | ||
"prepublishOnly": "npm run build-lib && npm run dist", | ||
"prepublishOnly": "npm run postinstall", | ||
"postinstall": "npm run build-lib && npm run dist", | ||
"lint": "eslint ./", | ||
@@ -73,9 +74,9 @@ "lint-fix": "eslint --fix ./", | ||
"dependencies": { | ||
"@antv/util": "~1.0.5", | ||
"d3-ease": "~1.0.3", | ||
"d3-interpolate": "~1.1.5", | ||
"d3-timer": "~1.0.6", | ||
"gl-matrix": "~2.3.2", | ||
"lodash": "~4.17.4", | ||
"gl-matrix": "~2.6.1", | ||
"wolfy87-eventemitter": "~5.1.0" | ||
} | ||
} |
@@ -162,2 +162,7 @@ # G | ||
* destroy() 销毁 | ||
* find(fn) 在当前group中递归查找满足fn的shape或group | ||
* findAll(fn) 在当前group中递归查找所有满足fn的shape和group | ||
* findById(id) 在当前group中递归查找id匹配的shape或group | ||
* findBy(fn) 接口已废弃 | ||
* find(id) 接口已废弃 | ||
@@ -297,3 +302,14 @@ ### Shape | ||
* path:路径,支持 字符串或者数组两种方式,详情参考 [svg path](https://developer.mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Paths) | ||
* arrow 是否显示箭头 ture / false | ||
* arrow 箭头设置 | ||
* true / false: 显示 / 取消默认箭头 | ||
* 支持定义Marker形状的箭头,箭头中心位于线段的端点 | ||
```js | ||
canvas.addShape('path', { | ||
attrs: { | ||
startArrow: new Marker({ | ||
attrs: { ... } | ||
}) | ||
} | ||
}); | ||
``` | ||
@@ -340,3 +356,14 @@ ```js | ||
* y2 结束点的 y 坐标 | ||
* arrow 是否显示箭头 ture / false | ||
* arrow 箭头设置 | ||
* true / false: 显示 / 取消默认箭头 | ||
* 支持定义Marker形状的箭头,箭头中心位于线段的端点 | ||
```js | ||
canvas.addShape('line', { | ||
attrs: { | ||
startArrow: new Marker({ | ||
attrs: { ... } | ||
}) | ||
} | ||
}); | ||
``` | ||
@@ -359,3 +386,4 @@ ```js | ||
y2: 300 + 280, | ||
arrow: true, // 显示箭头 | ||
startArrow: true, | ||
endArrow: true, // 显示箭头 | ||
stroke: '#00ff00' // 6位十六进制 | ||
@@ -370,3 +398,4 @@ } | ||
y1: 300 + 280, | ||
arrow: true, // 显示箭头 | ||
startArrow: true, | ||
endArrow: true, // 显示箭头 | ||
stroke: '#00f' // 3位十六进制 | ||
@@ -373,0 +402,0 @@ } |
module.exports = { | ||
Canvas: require('./canvas'), | ||
Group: require('./core/group'), | ||
Shape: require('./core/shape'), | ||
Rect: require('./shape/rect'), | ||
Circle: require('./shape/circle'), | ||
Ellipse: require('./shape/ellipse'), | ||
Path: require('./shape/path'), | ||
Text: require('./shape/text'), | ||
Line: require('./shape/line'), | ||
Image: require('./shape/image'), | ||
Polygon: require('./shape/polygon'), | ||
Polyline: require('./shape/polyline'), | ||
Arc: require('./shape/arc'), | ||
Fan: require('./shape/fan'), | ||
Cubic: require('./shape/cubic'), | ||
Quadratic: require('./shape/quadratic'), | ||
Marker: require('./shape/marker'), | ||
PathUtil: require('./util/path'), | ||
PathSegment: require('./shape/util/path-segment'), | ||
MatrixUtil: require('./util/matrix'), | ||
// renderers | ||
svg: require('./svg/index'), | ||
canvas: require('./canvas/index'), | ||
// utils | ||
CommonUtil: require('./util/common'), | ||
DomUtil: require('./util/dom'), | ||
Event: require('./event'), | ||
version: '____G_VERSION____' | ||
MatrixUtil: require('./util/matrix'), | ||
PathUtil: require('./util/path'), | ||
// version, etc. | ||
version: '2.1.0' | ||
}; |
@@ -1,115 +0,28 @@ | ||
const PRECISION = 0.00001; // 常量,据的精度,小于这个精度认为是0 | ||
const RADIAN = Math.PI / 180; | ||
const DEGREE = 180 / Math.PI; | ||
const Util = require('@antv/util'); | ||
module.exports = { | ||
isFunction: require('lodash/isFunction'), | ||
isObject: require('lodash/isObject'), | ||
isBoolean: require('lodash/isBoolean'), | ||
isNil: require('lodash/isNil'), | ||
isString: require('lodash/isString'), | ||
isArray: require('lodash/isArray'), | ||
isNumber: require('lodash/isNumber'), | ||
isEmpty: require('lodash/isEmpty'), // isBlank | ||
uniqueId: require('lodash/uniqueId'), | ||
clone: require('lodash/clone'), | ||
assign: require('lodash/assign'), // simpleMix | ||
merge: require('lodash/merge'), // mix | ||
upperFirst: require('lodash/upperFirst'), // ucfirst | ||
remove: require('lodash/pull'), | ||
each: require('lodash/forEach'), | ||
isEqual: require('lodash/isEqual'), | ||
toArray: require('lodash/toArray'), | ||
extend(subclass, superclass, overrides, staticOverrides) { | ||
// 如果只提供父类构造函数,则自动生成子类构造函数 | ||
if (!this.isFunction(superclass)) { | ||
overrides = superclass; | ||
superclass = subclass; | ||
subclass = function() {}; | ||
} | ||
const create = Object.create ? | ||
function(proto, c) { | ||
return Object.create(proto, { | ||
constructor: { | ||
value: c | ||
} | ||
}); | ||
} : | ||
function(proto, c) { | ||
function F() {} | ||
F.prototype = proto; | ||
const o = new F(); | ||
o.constructor = c; | ||
return o; | ||
}; | ||
const superObj = create(superclass.prototype, subclass); // new superclass(),//实例化父类作为子类的prototype | ||
subclass.prototype = this.merge(superObj, subclass.prototype); // 指定子类的prototype | ||
subclass.superclass = create(superclass.prototype, superclass); | ||
this.merge(superObj, overrides); | ||
this.merge(subclass, staticOverrides); | ||
return subclass; | ||
}, | ||
augment(c) { | ||
const args = this.toArray(arguments); | ||
for (let i = 1; i < args.length; i++) { | ||
let obj = args[i]; | ||
if (this.isFunction(obj)) { | ||
obj = obj.prototype; | ||
} | ||
this.merge(c.prototype, obj); | ||
} | ||
}, | ||
/** | ||
* 判断两个数是否相等 | ||
* @param {Number} a 数 | ||
* @param {Number} b 数 | ||
* @return {Boolean} 是否相等 | ||
**/ | ||
isNumberEqual(a, b) { | ||
return Math.abs((a - b)) < PRECISION; | ||
}, | ||
/** | ||
* 获取角度对应的弧度 | ||
* @param {Number} degree 角度 | ||
* @return {Number} 弧度 | ||
**/ | ||
toRadian(degree) { | ||
return RADIAN * degree; | ||
}, | ||
/** | ||
* 获取弧度对应的角度 | ||
* @param {Number} radian 弧度 | ||
* @return {Number} 角度 | ||
**/ | ||
toDegree(radian) { | ||
return DEGREE * radian; | ||
}, | ||
/** | ||
* 广义取模运算 | ||
* @param {Number} n 被取模的值 | ||
* @param {Number} m 模 | ||
* @return {Number} 返回n 被 m 取模的结果 | ||
*/ | ||
mod(n, m) { | ||
return ((n % m) + m) % m; | ||
}, | ||
/** | ||
* 把a夹在min,max中间, 低于min的返回min,高于max的返回max,否则返回自身 | ||
* @param {Number} a 数 | ||
* @param {Number} min 下限 | ||
* @param {Number} max 上限 | ||
* @return {Number} 返回结果值 | ||
**/ | ||
clamp(a, min, max) { | ||
if (a < min) { | ||
return min; | ||
} else if (a > max) { | ||
return max; | ||
} | ||
return a; | ||
} | ||
isFunction: Util.isFunction, | ||
isObject: Util.isObject, | ||
isBoolean: Util.isBoolean, | ||
isNil: Util.isNil, | ||
isString: Util.isString, | ||
isArray: Util.isArray, | ||
isNumber: Util.isNumber, | ||
isEmpty: Util.isEmpty, // isBlank | ||
uniqueId: Util.uniqueId, | ||
clone: Util.clone, | ||
assign: Util.mix, // simpleMix | ||
merge: Util.deepMix, // mix | ||
upperFirst: Util.upperFirst, // ucfirst | ||
each: Util.each, | ||
isEqual: Util.isEqual, | ||
toArray: Util.toArray, | ||
extend: Util.extend, | ||
augment: Util.augment, | ||
remove: Util.arrayUtil.pull, | ||
isNumberEqual: Util.isNumberEqual, | ||
toRadian: Util.toRadian, | ||
toDegree: Util.toDegree, | ||
mod: Util.mod, | ||
clamp: Util.clamp | ||
}; |
@@ -82,2 +82,7 @@ const Util = require('../util/index'); | ||
const steps = arr[4]; | ||
// 环半径为0时,默认无渐变,取渐变序列的最后一个颜色 | ||
if (fr === 0) { | ||
const colors = steps.match(regexColorStop); | ||
return colors[colors.length - 1].split(':')[1]; | ||
} | ||
const box = self.getBBox(); | ||
@@ -84,0 +89,0 @@ const context = self.get('context'); |
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
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
1201959
155
32083
541
1
1
+ Added@antv/util@~1.0.5
+ Added@antv/util@1.0.12(transitive)
+ Addedgl-matrix@2.6.1(transitive)
- Removedlodash@~4.17.4
- Removedgl-matrix@2.3.2(transitive)
- Removedlodash@4.17.21(transitive)
Updatedgl-matrix@~2.6.1