@antv/g
Advanced tools
Comparing version 3.1.0-beta.8 to 3.1.0-beta.9
@@ -272,2 +272,5 @@ var Util = require('./util/index'); | ||
}, | ||
_drawSync: function _drawSync() { | ||
this._cfg.painter.drawSync(this); | ||
}, | ||
destroy: function destroy() { | ||
@@ -274,0 +277,0 @@ var cfg = this._cfg; |
@@ -215,4 +215,2 @@ var Util = require('../util/index'); | ||
item.set('timeline', cfg.timeline); | ||
item.set('canvas', cfg.canvas); | ||
item.set('renderer', cfg.renderer); | ||
} | ||
@@ -219,0 +217,0 @@ }, |
var Util = require('../../util/index'); | ||
var MatrixUtil = require('../../util/matrix'); | ||
var ReservedProps = { delay: 'delay', rotate: 'rotate', id: 'id' }; | ||
var ReservedProps = { delay: 'delay', rotate: 'rotate' }; | ||
@@ -6,0 +6,0 @@ function getFromAttrs(toAttrs, shape) { |
@@ -14,5 +14,2 @@ var Util = require('../../util/index'); | ||
this.attr(Util.assign(this.getDefaultAttrs(), attrs)); | ||
if (!this._attrs.id) { | ||
this._attrs.id = Util.uniqueId('g_'); | ||
} | ||
return this; | ||
@@ -19,0 +16,0 @@ }, |
@@ -335,3 +335,3 @@ var Util = require('../../util/index'); | ||
var box = this._cfg.el.getBBox(); | ||
return Inside.box(box.minX, box.maxX, box.minY, box.maxY, x, y); | ||
return Inside.box(box.x, box.x + box.width, box.y, box.y + box.height, x, y); | ||
}; | ||
@@ -338,0 +338,0 @@ |
@@ -41,3 +41,3 @@ var Util = require('../../util/index'); | ||
for (var j = 0; j < toPathPoint.length; j++) { | ||
if (Util.isNumber(toPathPoint[j]) && fromPathPoint) { | ||
if (Util.isNumber(toPathPoint[j]) && fromPathPoint && Util.isNumber(fromPathPoint[j])) { | ||
interf = interpolate(fromPathPoint[j], toPathPoint[j]); | ||
@@ -86,8 +86,6 @@ cPathPoint.push(interf(ratio)); | ||
ratio = 1; | ||
if (animator.callback) { | ||
animator.callback(); | ||
} | ||
isFinished = true; | ||
} | ||
} | ||
_update(shape, animator, ratio); | ||
@@ -124,2 +122,5 @@ return isFinished; | ||
isFinished = false; | ||
if (animator.callback) { | ||
animator.callback(); | ||
} | ||
} | ||
@@ -126,0 +127,0 @@ } |
@@ -26,3 +26,3 @@ module.exports = { | ||
// version, etc. | ||
version: '3.1.0-beta.8' | ||
version: '3.1.0-beta.9' | ||
}; |
@@ -57,2 +57,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
Painter.prototype.drawSync = function drawSync(model) { | ||
this.beforeDraw(); | ||
this._drawGroup(model); | ||
}; | ||
Painter.prototype._drawGroup = function _drawGroup(group) { | ||
@@ -59,0 +64,0 @@ if (group._cfg.removed || group._cfg.destroyed || !group._cfg.visible) { |
@@ -15,4 +15,3 @@ var TAG_MAP = { | ||
var target = e.target || e.srcElement; | ||
var id = target.id; | ||
if (!id || !TAG_MAP[target.tagName]) { | ||
if (!TAG_MAP[target.tagName]) { | ||
var parent = target.parentNode; | ||
@@ -22,10 +21,10 @@ while (parent && !TAG_MAP[parent.tagName]) { | ||
} | ||
id = parent.id; | ||
target = parent; | ||
} | ||
if (this._attrs.id === id) { | ||
if (this._cfg.el === target) { | ||
return this; | ||
} | ||
return this.find(function (item) { | ||
return item._attrs && item._attrs.id === id; | ||
return item._cfg && item._cfg.el === target; | ||
}); | ||
}; |
@@ -121,2 +121,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
Painter.prototype.drawSync = function drawSync(model) { | ||
this._drawChildren(model._cfg.children, false); | ||
}; | ||
Painter.prototype._drawGroup = function _drawGroup(model, redraw) { | ||
@@ -172,3 +176,3 @@ var cfg = model._cfg; | ||
if (redraw && el) { | ||
el.parentNode.removeChild(el); | ||
el.parentNode && el.parentNode.removeChild(el); | ||
el = null; | ||
@@ -175,0 +179,0 @@ } |
{ | ||
"name": "@antv/g", | ||
"version": "3.1.0-beta.8", | ||
"version": "3.1.0-beta.9", | ||
"description": "A canvas library which providing 2d draw for G2.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -259,3 +259,6 @@ # G | ||
* height 高度 | ||
* radius 圆角 | ||
* radius 圆角: 支持整数或数组形式, 分别对应左上、右上、右下、左下角的半径。 | ||
* radius缩写为 1或 [ 1 ] 相当于 [ 1, 1, 1, 1 ] | ||
* radius 缩写为 [ 1, 2 ] 相当于 [ 1, 2, 1, 2 ] | ||
* radius 缩写为 [ 1, 2, 3 ] 相当于 [ 1, 2, 3, 2 ] | ||
@@ -262,0 +265,0 @@ ```js |
@@ -281,2 +281,5 @@ const Util = require('./util/index'); | ||
}, | ||
_drawSync() { | ||
this._cfg.painter.drawSync(this); | ||
}, | ||
destroy() { | ||
@@ -283,0 +286,0 @@ const cfg = this._cfg; |
@@ -211,4 +211,2 @@ const Util = require('../util/index'); | ||
item.set('timeline', cfg.timeline); | ||
item.set('canvas', cfg.canvas); | ||
item.set('renderer', cfg.renderer); | ||
} | ||
@@ -215,0 +213,0 @@ }, |
const Util = require('../../util/index'); | ||
const MatrixUtil = require('../../util/matrix'); | ||
const ReservedProps = { delay: 'delay', rotate: 'rotate', id: 'id' }; | ||
const ReservedProps = { delay: 'delay', rotate: 'rotate' }; | ||
@@ -6,0 +6,0 @@ function getFromAttrs(toAttrs, shape) { |
@@ -14,5 +14,2 @@ const Util = require('../../util/index'); | ||
this.attr(Util.assign(this.getDefaultAttrs(), attrs)); | ||
if (!this._attrs.id) { | ||
this._attrs.id = Util.uniqueId('g_'); | ||
} | ||
return this; | ||
@@ -19,0 +16,0 @@ }, |
@@ -339,3 +339,3 @@ const Util = require('../../util/index'); | ||
const box = this._cfg.el.getBBox(); | ||
return Inside.box(box.minX, box.maxX, box.minY, box.maxY, x, y); | ||
return Inside.box(box.x, box.x + box.width, box.y, box.y + box.height, x, y); | ||
}; | ||
@@ -342,0 +342,0 @@ |
@@ -38,3 +38,3 @@ const Util = require('../../util/index'); | ||
for (let j = 0; j < toPathPoint.length; j++) { | ||
if (Util.isNumber(toPathPoint[j]) && fromPathPoint) { | ||
if (Util.isNumber(toPathPoint[j]) && fromPathPoint && Util.isNumber(fromPathPoint[j])) { | ||
interf = interpolate(fromPathPoint[j], toPathPoint[j]); | ||
@@ -83,8 +83,6 @@ cPathPoint.push(interf(ratio)); | ||
ratio = 1; | ||
if (animator.callback) { | ||
animator.callback(); | ||
} | ||
isFinished = true; | ||
} | ||
} | ||
_update(shape, animator, ratio); | ||
@@ -119,2 +117,5 @@ return isFinished; | ||
isFinished = false; | ||
if (animator.callback) { | ||
animator.callback(); | ||
} | ||
} | ||
@@ -121,0 +122,0 @@ } |
@@ -26,3 +26,3 @@ module.exports = { | ||
// version, etc. | ||
version: '3.1.0-beta.8' | ||
version: '3.1.0-beta.9' | ||
}; |
@@ -66,2 +66,6 @@ const Util = require('../../util'); | ||
} | ||
drawSync(model) { | ||
this.beforeDraw(); | ||
this._drawGroup(model); | ||
} | ||
_drawGroup(group) { | ||
@@ -68,0 +72,0 @@ if (group._cfg.removed || group._cfg.destroyed || !group._cfg.visible) { |
@@ -14,5 +14,4 @@ const TAG_MAP = { | ||
module.exports = function getShape(x, y, e) { | ||
const target = e.target || e.srcElement; | ||
let id = target.id; | ||
if (!id || !TAG_MAP[target.tagName]) { | ||
let target = e.target || e.srcElement; | ||
if (!TAG_MAP[target.tagName]) { | ||
let parent = target.parentNode; | ||
@@ -22,10 +21,10 @@ while (parent && !TAG_MAP[parent.tagName]) { | ||
} | ||
id = parent.id; | ||
target = parent; | ||
} | ||
if (this._attrs.id === id) { | ||
if (this._cfg.el === target) { | ||
return this; | ||
} | ||
return this.find(item => { | ||
return item._attrs && item._attrs.id === id; | ||
return item._cfg && item._cfg.el === target; | ||
}); | ||
}; |
@@ -111,2 +111,5 @@ const Util = require('../../util'); | ||
} | ||
drawSync(model) { | ||
this._drawChildren(model._cfg.children, false); | ||
} | ||
_drawGroup(model, redraw) { | ||
@@ -160,3 +163,3 @@ const cfg = model._cfg; | ||
if (redraw && el) { | ||
el.parentNode.removeChild(el); | ||
el.parentNode && el.parentNode.removeChild(el); | ||
el = null; | ||
@@ -163,0 +166,0 @@ } |
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
1041739
27406
544