@antv/g6-core
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -342,3 +342,3 @@ /** | ||
var defaultFontFamily; | ||
if (typeof window !== 'undefined') defaultFontFamily = window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif';else defaultFontFamily = 'Arial, sans-serif'; | ||
if (typeof window !== 'undefined' && typeof window.getComputedStyle !== 'undefined') defaultFontFamily = window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif';else defaultFontFamily = 'Arial, sans-serif'; | ||
var labelCfg = deepMix({ | ||
@@ -345,0 +345,0 @@ fontFamily: defaultFontFamily |
@@ -68,3 +68,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
style: { | ||
fontFamily: typeof window !== 'undefined' ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
fontFamily: typeof window !== 'undefined' && window.getComputedStyle ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
} | ||
@@ -74,3 +74,3 @@ }, | ||
style: { | ||
fontFamily: typeof window !== 'undefined' ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
fontFamily: typeof window !== 'undefined' && window.getComputedStyle ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
} | ||
@@ -428,3 +428,3 @@ } | ||
if (subShape_1) { | ||
var subShapeStyles_1 = clone(subShape_1.attr()); | ||
var subShapeStyles_1 = cloneBesidesImg(subShape_1.attr()); | ||
each(style, function (v, key) { | ||
@@ -431,0 +431,0 @@ if (p === keyShapeName_1 && keyShapeStyles_1[key] && !keptAttrs[key]) { |
@@ -50,3 +50,3 @@ var subjectColor = 'rgb(95, 149, 255)'; | ||
export default { | ||
version: '0.3.2', | ||
version: '0.3.3', | ||
rootContainerClassName: 'root-container', | ||
@@ -53,0 +53,0 @@ nodeContainerClassName: 'node-container', |
@@ -35,3 +35,3 @@ import { __assign, __rest } from "tslib"; | ||
return pipes.map(function (pipe) { | ||
return (pipe === null || pipe === void 0 ? void 0 : pipe.type) || ""; | ||
return (pipe === null || pipe === void 0 ? void 0 : pipe.type) || ''; | ||
}); | ||
@@ -38,0 +38,0 @@ } |
import { __assign } from "tslib"; | ||
import { isNumber, isString } from '@antv/util'; | ||
import { modifyCSS } from '@antv/dom-util'; | ||
import { formatPadding } from '../../util/base'; | ||
@@ -237,13 +236,4 @@ import { applyMatrix, invertMatrix } from '../../util/math'; | ||
if (plugin.get('gridContainer')) { | ||
var minZoom = graph.get('minZoom'); | ||
modifyCSS(plugin.get('container'), { | ||
width: width + "px", | ||
height: height + "px" | ||
}); | ||
modifyCSS(plugin.get('gridContainer'), { | ||
width: width / minZoom + "px", | ||
height: height / minZoom + "px", | ||
left: 0, | ||
top: 0 | ||
}); | ||
// 网格定位信息初始化 | ||
plugin.positionInit(); | ||
} | ||
@@ -250,0 +240,0 @@ }); |
@@ -169,3 +169,3 @@ import EventEmitter from '@antv/event-emitter'; | ||
*/ | ||
moveTo(x: number, y: number): void; | ||
moveTo(x: number, y: number, animate?: boolean, animateCfg?: GraphAnimateConfig): void; | ||
/** | ||
@@ -172,0 +172,0 @@ * 调整视口适应视图 |
@@ -403,3 +403,3 @@ /// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
translate: (group: import("@antv/g-base").IGroup, vec: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point, animate?: boolean, animateCfg?: import("./types").GraphAnimateConfig) => void; | ||
scale: (group: import("@antv/g-base").IGroup, ratio: number | number[]) => void; | ||
@@ -406,0 +406,0 @@ rotate: (group: import("@antv/g-base").IGroup, angle: number) => void; |
@@ -368,3 +368,3 @@ import EventEmitter from '@antv/event-emitter'; | ||
*/ | ||
moveTo: (x: number, y: number) => void; | ||
moveTo: (x: number, y: number, animate?: boolean, animateCfg?: GraphAnimateConfig) => void; | ||
/** | ||
@@ -371,0 +371,0 @@ * 根据对应规则查找单个元素 |
@@ -48,3 +48,3 @@ import { __extends } from "tslib"; | ||
this.set(itemName, null); | ||
} else { | ||
} else if (value) { | ||
value.addEdge(this); | ||
@@ -51,0 +51,0 @@ this.set(itemName, value); |
@@ -378,3 +378,3 @@ import { __assign } from "tslib"; | ||
// 修改 img 通过 updateItem 实现 | ||
if (key !== 'img') { | ||
if (key !== 'img' || isString(val)) { | ||
styles_2[key] = val; | ||
@@ -381,0 +381,0 @@ } |
@@ -120,2 +120,3 @@ import { IGroup, Event as GraphEvent, BBox, AnimateCfg, ICanvas, IShape } from '@antv/g-base'; | ||
selectedState?: string; | ||
resetSelected?: boolean; | ||
onlyChangeComboSize?: boolean; | ||
@@ -533,2 +534,6 @@ includeEdges?: boolean; | ||
NODE_DRAGEND = "node:dragend", | ||
NODE_TAP = "node:tap", | ||
NODE_PANSTART = "node:panstart", | ||
NODE_PANMOVE = "node:panmove", | ||
NODE_PANEND = "node:panend", | ||
COMBO_CONTEXTMENU = "combo:contextmenu", | ||
@@ -551,2 +556,6 @@ COMBO_CLICK = "combo:click", | ||
COMBO_DRAGEND = "combo:dragend", | ||
COMBO_TAP = "combo:tap", | ||
COMBO_PANSTART = "combo:panstart", | ||
COMBO_PANMOVE = "combo:panmove", | ||
COMBO_PANEND = "combo:panend", | ||
EDGE_CONTEXTMENU = "edge:contextmenu", | ||
@@ -582,2 +591,6 @@ EDGE_CLICK = "edge:click", | ||
CANVAS_DRAGEND = "canvas:dragend", | ||
CANVAS_TAP = "canvas:tap", | ||
CANVAS_PANSTART = "canvas:panstart", | ||
CANVAS_PANMOVE = "canvas:panmove", | ||
CANVAS_PANEND = "canvas:panend", | ||
BEFORERENDER = "beforerender", | ||
@@ -622,3 +635,9 @@ AFTERRENDER = "afterrender", | ||
DRAGNODEEND = "dragnodeend", | ||
STACKCHANGE = "stackchange" | ||
STACKCHANGE = "stackchange", | ||
TAP = "tap", | ||
PINCHSTART = "pinchstart", | ||
PINCHMOVE = "pinchmove", | ||
PANSTART = "panstart", | ||
PANMOVE = "panmove", | ||
PANEND = "panend" | ||
} | ||
@@ -625,0 +644,0 @@ export declare type DefaultBehaviorType = IG6GraphEvent | string | number | object; |
@@ -63,3 +63,7 @@ export * from '../interface'; // Behavior type file | ||
G6Event["NODE_DRAG"] = "node:drag"; | ||
G6Event["NODE_DRAGEND"] = "node:dragend"; // combo, extends from nodes | ||
G6Event["NODE_DRAGEND"] = "node:dragend"; | ||
G6Event["NODE_TAP"] = "node:tap"; | ||
G6Event["NODE_PANSTART"] = "node:panstart"; | ||
G6Event["NODE_PANMOVE"] = "node:panmove"; | ||
G6Event["NODE_PANEND"] = "node:panend"; // combo, extends from nodes | ||
@@ -82,3 +86,7 @@ G6Event["COMBO_CONTEXTMENU"] = "combo:contextmenu"; | ||
G6Event["COMBO_DRAG"] = "combo:drag"; | ||
G6Event["COMBO_DRAGEND"] = "combo:dragend"; // edge events | ||
G6Event["COMBO_DRAGEND"] = "combo:dragend"; | ||
G6Event["COMBO_TAP"] = "combo:tap"; | ||
G6Event["COMBO_PANSTART"] = "combo:panstart"; | ||
G6Event["COMBO_PANMOVE"] = "combo:panmove"; | ||
G6Event["COMBO_PANEND"] = "combo:panend"; // edge events | ||
@@ -115,3 +123,7 @@ G6Event["EDGE_CONTEXTMENU"] = "edge:contextmenu"; | ||
G6Event["CANVAS_DRAG"] = "canvas:drag"; | ||
G6Event["CANVAS_DRAGEND"] = "canvas:dragend"; // timing events | ||
G6Event["CANVAS_DRAGEND"] = "canvas:dragend"; | ||
G6Event["CANVAS_TAP"] = "canvas:tap"; | ||
G6Event["CANVAS_PANSTART"] = "canvas:panstart"; | ||
G6Event["CANVAS_PANMOVE"] = "canvas:panmove"; | ||
G6Event["CANVAS_PANEND"] = "canvas:panend"; // timing events | ||
@@ -157,3 +169,10 @@ G6Event["BEFORERENDER"] = "beforerender"; | ||
G6Event["DRAGNODEEND"] = "dragnodeend"; | ||
G6Event["STACKCHANGE"] = "stackchange"; | ||
G6Event["STACKCHANGE"] = "stackchange"; // Mobile event support | ||
G6Event["TAP"] = "tap"; | ||
G6Event["PINCHSTART"] = "pinchstart"; | ||
G6Event["PINCHMOVE"] = "pinchmove"; | ||
G6Event["PANSTART"] = "panstart"; | ||
G6Event["PANMOVE"] = "panmove"; | ||
G6Event["PANEND"] = "panend"; | ||
})(G6Event || (G6Event = {})); |
@@ -21,3 +21,3 @@ /// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
translate: (group: import("@antv/g-base").IGroup, vec: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point, animate?: boolean, animateCfg?: import("..").GraphAnimateConfig) => void; | ||
scale: (group: import("@antv/g-base").IGroup, ratio: number | number[]) => void; | ||
@@ -24,0 +24,0 @@ rotate: (group: import("@antv/g-base").IGroup, angle: number) => void; |
import { Point, IGroup } from '@antv/g-base'; | ||
import { GraphData, ICircle, IEllipse, IRect, Matrix, EdgeConfig, NodeIdxMap, IBBox, Item, IPoint } from '../types'; | ||
import { GraphData, ICircle, IEllipse, IRect, Matrix, EdgeConfig, NodeIdxMap, IBBox, Item, IPoint, GraphAnimateConfig } from '../types'; | ||
/** | ||
@@ -99,3 +99,3 @@ * 对比对象,用于对象数组排序 | ||
*/ | ||
export declare const move: (group: IGroup, point: Point) => void; | ||
export declare const move: (group: IGroup, point: Point, animate?: boolean, animateCfg?: GraphAnimateConfig) => void; | ||
/** | ||
@@ -102,0 +102,0 @@ * 缩放 group |
@@ -373,3 +373,9 @@ import { mat3, vec3, ext, vec2 } from '@antv/matrix-util'; | ||
export var move = function move(group, point) { | ||
export var move = function move(group, point, animate, animateCfg) { | ||
if (animateCfg === void 0) { | ||
animateCfg = { | ||
duration: 500 | ||
}; | ||
} | ||
var matrix = group.getMatrix(); | ||
@@ -384,4 +390,24 @@ | ||
var vy = point.y - bbox.minY; | ||
var movedMatrix = transform(matrix, [['t', vx, vy]]); | ||
group.setMatrix(movedMatrix); | ||
if (animate) { | ||
var dx_1 = vx * matrix[0]; | ||
var dy_1 = vy * matrix[4]; | ||
var lastX_1 = 0; | ||
var lastY_1 = 0; | ||
var newX_1 = 0; | ||
var newY_1 = 0; | ||
group.animate(function (ratio) { | ||
newX_1 = dx_1 * ratio; | ||
newY_1 = dy_1 * ratio; | ||
matrix = transform(matrix, [['t', newX_1 - lastX_1, newY_1 - lastY_1]]); | ||
lastX_1 = newX_1; | ||
lastY_1 = newY_1; | ||
return { | ||
matrix: matrix | ||
}; | ||
}, animateCfg); | ||
} else { | ||
var movedMatrix = transform(matrix, [['t', vx, vy]]); | ||
group.setMatrix(movedMatrix); | ||
} | ||
}; | ||
@@ -388,0 +414,0 @@ /** |
@@ -352,3 +352,3 @@ "use strict"; | ||
var defaultFontFamily; | ||
if (typeof window !== 'undefined') defaultFontFamily = window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif';else defaultFontFamily = 'Arial, sans-serif'; | ||
if (typeof window !== 'undefined' && typeof window.getComputedStyle !== 'undefined') defaultFontFamily = window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif';else defaultFontFamily = 'Arial, sans-serif'; | ||
var labelCfg = (0, _util.deepMix)({ | ||
@@ -355,0 +355,0 @@ fontFamily: defaultFontFamily |
@@ -83,3 +83,3 @@ "use strict"; | ||
style: { | ||
fontFamily: typeof window !== 'undefined' ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
fontFamily: typeof window !== 'undefined' && window.getComputedStyle ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
} | ||
@@ -89,3 +89,3 @@ }, | ||
style: { | ||
fontFamily: typeof window !== 'undefined' ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
fontFamily: typeof window !== 'undefined' && window.getComputedStyle ? window.getComputedStyle(document.body, null).getPropertyValue('font-family') || 'Arial, sans-serif' : 'Arial, sans-serif' | ||
} | ||
@@ -438,3 +438,3 @@ } | ||
if (subShape_1) { | ||
var subShapeStyles_1 = (0, _util.clone)(subShape_1.attr()); | ||
var subShapeStyles_1 = (0, _graphic.cloneBesidesImg)(subShape_1.attr()); | ||
(0, _util.each)(style, function (v, key) { | ||
@@ -441,0 +441,0 @@ if (p === keyShapeName_1 && keyShapeStyles_1[key] && !keptAttrs[key]) { |
@@ -56,3 +56,3 @@ "use strict"; | ||
var _default = { | ||
version: '0.3.2', | ||
version: '0.3.3', | ||
rootContainerClassName: 'root-container', | ||
@@ -59,0 +59,0 @@ nodeContainerClassName: 'node-container', |
@@ -44,3 +44,3 @@ "use strict"; | ||
return pipes.map(function (pipe) { | ||
return (pipe === null || pipe === void 0 ? void 0 : pipe.type) || ""; | ||
return (pipe === null || pipe === void 0 ? void 0 : pipe.type) || ''; | ||
}); | ||
@@ -47,0 +47,0 @@ } |
@@ -12,4 +12,2 @@ "use strict"; | ||
var _domUtil = require("@antv/dom-util"); | ||
var _base = require("../../util/base"); | ||
@@ -249,13 +247,4 @@ | ||
if (plugin.get('gridContainer')) { | ||
var minZoom = graph.get('minZoom'); | ||
(0, _domUtil.modifyCSS)(plugin.get('container'), { | ||
width: width + "px", | ||
height: height + "px" | ||
}); | ||
(0, _domUtil.modifyCSS)(plugin.get('gridContainer'), { | ||
width: width / minZoom + "px", | ||
height: height / minZoom + "px", | ||
left: 0, | ||
top: 0 | ||
}); | ||
// 网格定位信息初始化 | ||
plugin.positionInit(); | ||
} | ||
@@ -262,0 +251,0 @@ }); |
@@ -169,3 +169,3 @@ import EventEmitter from '@antv/event-emitter'; | ||
*/ | ||
moveTo(x: number, y: number): void; | ||
moveTo(x: number, y: number, animate?: boolean, animateCfg?: GraphAnimateConfig): void; | ||
/** | ||
@@ -172,0 +172,0 @@ * 调整视口适应视图 |
@@ -403,3 +403,3 @@ /// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
translate: (group: import("@antv/g-base").IGroup, vec: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point, animate?: boolean, animateCfg?: import("./types").GraphAnimateConfig) => void; | ||
scale: (group: import("@antv/g-base").IGroup, ratio: number | number[]) => void; | ||
@@ -406,0 +406,0 @@ rotate: (group: import("@antv/g-base").IGroup, angle: number) => void; |
@@ -368,3 +368,3 @@ import EventEmitter from '@antv/event-emitter'; | ||
*/ | ||
moveTo: (x: number, y: number) => void; | ||
moveTo: (x: number, y: number, animate?: boolean, animateCfg?: GraphAnimateConfig) => void; | ||
/** | ||
@@ -371,0 +371,0 @@ * 根据对应规则查找单个元素 |
@@ -60,3 +60,3 @@ "use strict"; | ||
this.set(itemName, null); | ||
} else { | ||
} else if (value) { | ||
value.addEdge(this); | ||
@@ -63,0 +63,0 @@ this.set(itemName, value); |
@@ -392,3 +392,3 @@ "use strict"; | ||
// 修改 img 通过 updateItem 实现 | ||
if (key !== 'img') { | ||
if (key !== 'img' || (0, _util.isString)(val)) { | ||
styles_2[key] = val; | ||
@@ -395,0 +395,0 @@ } |
@@ -120,2 +120,3 @@ import { IGroup, Event as GraphEvent, BBox, AnimateCfg, ICanvas, IShape } from '@antv/g-base'; | ||
selectedState?: string; | ||
resetSelected?: boolean; | ||
onlyChangeComboSize?: boolean; | ||
@@ -533,2 +534,6 @@ includeEdges?: boolean; | ||
NODE_DRAGEND = "node:dragend", | ||
NODE_TAP = "node:tap", | ||
NODE_PANSTART = "node:panstart", | ||
NODE_PANMOVE = "node:panmove", | ||
NODE_PANEND = "node:panend", | ||
COMBO_CONTEXTMENU = "combo:contextmenu", | ||
@@ -551,2 +556,6 @@ COMBO_CLICK = "combo:click", | ||
COMBO_DRAGEND = "combo:dragend", | ||
COMBO_TAP = "combo:tap", | ||
COMBO_PANSTART = "combo:panstart", | ||
COMBO_PANMOVE = "combo:panmove", | ||
COMBO_PANEND = "combo:panend", | ||
EDGE_CONTEXTMENU = "edge:contextmenu", | ||
@@ -582,2 +591,6 @@ EDGE_CLICK = "edge:click", | ||
CANVAS_DRAGEND = "canvas:dragend", | ||
CANVAS_TAP = "canvas:tap", | ||
CANVAS_PANSTART = "canvas:panstart", | ||
CANVAS_PANMOVE = "canvas:panmove", | ||
CANVAS_PANEND = "canvas:panend", | ||
BEFORERENDER = "beforerender", | ||
@@ -622,3 +635,9 @@ AFTERRENDER = "afterrender", | ||
DRAGNODEEND = "dragnodeend", | ||
STACKCHANGE = "stackchange" | ||
STACKCHANGE = "stackchange", | ||
TAP = "tap", | ||
PINCHSTART = "pinchstart", | ||
PINCHMOVE = "pinchmove", | ||
PANSTART = "panstart", | ||
PANMOVE = "panmove", | ||
PANEND = "panend" | ||
} | ||
@@ -625,0 +644,0 @@ export declare type DefaultBehaviorType = IG6GraphEvent | string | number | object; |
@@ -86,3 +86,7 @@ "use strict"; | ||
G6Event["NODE_DRAG"] = "node:drag"; | ||
G6Event["NODE_DRAGEND"] = "node:dragend"; // combo, extends from nodes | ||
G6Event["NODE_DRAGEND"] = "node:dragend"; | ||
G6Event["NODE_TAP"] = "node:tap"; | ||
G6Event["NODE_PANSTART"] = "node:panstart"; | ||
G6Event["NODE_PANMOVE"] = "node:panmove"; | ||
G6Event["NODE_PANEND"] = "node:panend"; // combo, extends from nodes | ||
@@ -105,3 +109,7 @@ G6Event["COMBO_CONTEXTMENU"] = "combo:contextmenu"; | ||
G6Event["COMBO_DRAG"] = "combo:drag"; | ||
G6Event["COMBO_DRAGEND"] = "combo:dragend"; // edge events | ||
G6Event["COMBO_DRAGEND"] = "combo:dragend"; | ||
G6Event["COMBO_TAP"] = "combo:tap"; | ||
G6Event["COMBO_PANSTART"] = "combo:panstart"; | ||
G6Event["COMBO_PANMOVE"] = "combo:panmove"; | ||
G6Event["COMBO_PANEND"] = "combo:panend"; // edge events | ||
@@ -138,3 +146,7 @@ G6Event["EDGE_CONTEXTMENU"] = "edge:contextmenu"; | ||
G6Event["CANVAS_DRAG"] = "canvas:drag"; | ||
G6Event["CANVAS_DRAGEND"] = "canvas:dragend"; // timing events | ||
G6Event["CANVAS_DRAGEND"] = "canvas:dragend"; | ||
G6Event["CANVAS_TAP"] = "canvas:tap"; | ||
G6Event["CANVAS_PANSTART"] = "canvas:panstart"; | ||
G6Event["CANVAS_PANMOVE"] = "canvas:panmove"; | ||
G6Event["CANVAS_PANEND"] = "canvas:panend"; // timing events | ||
@@ -180,3 +192,10 @@ G6Event["BEFORERENDER"] = "beforerender"; | ||
G6Event["DRAGNODEEND"] = "dragnodeend"; | ||
G6Event["STACKCHANGE"] = "stackchange"; | ||
G6Event["STACKCHANGE"] = "stackchange"; // Mobile event support | ||
G6Event["TAP"] = "tap"; | ||
G6Event["PINCHSTART"] = "pinchstart"; | ||
G6Event["PINCHMOVE"] = "pinchmove"; | ||
G6Event["PANSTART"] = "panstart"; | ||
G6Event["PANMOVE"] = "panmove"; | ||
G6Event["PANEND"] = "panend"; | ||
})(G6Event || (exports.G6Event = G6Event = {})); |
@@ -21,3 +21,3 @@ /// <reference types="_gl-matrix@3.3.0@gl-matrix" /> | ||
translate: (group: import("@antv/g-base").IGroup, vec: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point) => void; | ||
move: (group: import("@antv/g-base").IGroup, point: import("@antv/g-base").Point, animate?: boolean, animateCfg?: import("..").GraphAnimateConfig) => void; | ||
scale: (group: import("@antv/g-base").IGroup, ratio: number | number[]) => void; | ||
@@ -24,0 +24,0 @@ rotate: (group: import("@antv/g-base").IGroup, angle: number) => void; |
import { Point, IGroup } from '@antv/g-base'; | ||
import { GraphData, ICircle, IEllipse, IRect, Matrix, EdgeConfig, NodeIdxMap, IBBox, Item, IPoint } from '../types'; | ||
import { GraphData, ICircle, IEllipse, IRect, Matrix, EdgeConfig, NodeIdxMap, IBBox, Item, IPoint, GraphAnimateConfig } from '../types'; | ||
/** | ||
@@ -99,3 +99,3 @@ * 对比对象,用于对象数组排序 | ||
*/ | ||
export declare const move: (group: IGroup, point: Point) => void; | ||
export declare const move: (group: IGroup, point: Point, animate?: boolean, animateCfg?: GraphAnimateConfig) => void; | ||
/** | ||
@@ -102,0 +102,0 @@ * 缩放 group |
@@ -424,3 +424,9 @@ "use strict"; | ||
var move = function move(group, point) { | ||
var move = function move(group, point, animate, animateCfg) { | ||
if (animateCfg === void 0) { | ||
animateCfg = { | ||
duration: 500 | ||
}; | ||
} | ||
var matrix = group.getMatrix(); | ||
@@ -435,4 +441,24 @@ | ||
var vy = point.y - bbox.minY; | ||
var movedMatrix = transform(matrix, [['t', vx, vy]]); | ||
group.setMatrix(movedMatrix); | ||
if (animate) { | ||
var dx_1 = vx * matrix[0]; | ||
var dy_1 = vy * matrix[4]; | ||
var lastX_1 = 0; | ||
var lastY_1 = 0; | ||
var newX_1 = 0; | ||
var newY_1 = 0; | ||
group.animate(function (ratio) { | ||
newX_1 = dx_1 * ratio; | ||
newY_1 = dy_1 * ratio; | ||
matrix = transform(matrix, [['t', newX_1 - lastX_1, newY_1 - lastY_1]]); | ||
lastX_1 = newX_1; | ||
lastY_1 = newY_1; | ||
return { | ||
matrix: matrix | ||
}; | ||
}, animateCfg); | ||
} else { | ||
var movedMatrix = transform(matrix, [['t', vx, vy]]); | ||
group.setMatrix(movedMatrix); | ||
} | ||
}; | ||
@@ -439,0 +465,0 @@ /** |
{ | ||
"name": "@antv/g6-core", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A Graph Visualization Framework in JavaScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -154,3 +154,2 @@ # G6: A Graph Visualization Framework in TypeScript. | ||
To become a contributor, please follow our [contributing guide](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.md). | ||
@@ -157,0 +156,0 @@ ## License |
Sorry, the diff of this file is too big to display
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
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
1097370
33031
158