@antv/g6-core
Advanced tools
Comparing version 0.6.17 to 0.6.18
@@ -50,3 +50,3 @@ var subjectColor = 'rgb(95, 149, 255)'; | ||
export default { | ||
version: '0.6.17', | ||
version: '0.6.18', | ||
rootContainerClassName: 'root-container', | ||
@@ -53,0 +53,0 @@ nodeContainerClassName: 'node-container', |
@@ -27,3 +27,3 @@ import { GraphData } from '../../types'; | ||
setDataFromGraph(): GraphData; | ||
protected reLayoutMethod(layoutMethod: any, layoutCfg: any): Promise<void>; | ||
protected abstract execLayoutMethod(layoutCfg: any, order: any): Promise<void>; | ||
relayout(reloadData?: boolean): boolean; | ||
@@ -30,0 +30,0 @@ protected filterLayoutData(data: any, cfg: any): any; |
@@ -43,10 +43,18 @@ import { __assign, __rest } from "tslib"; | ||
LayoutController.prototype.isLayoutTypeSame = function (cfg) { | ||
var current = this.getLayoutCfgType(cfg); // already has pipes | ||
var current = this.getLayoutCfgType(cfg); | ||
var preHasPipies = Array.isArray(this.layoutType); | ||
var currentHasPipes = Array.isArray(current); // already has pipes, and the new one is pipes | ||
if (Array.isArray(this.layoutType)) { | ||
if (preHasPipies && currentHasPipes) { | ||
return this.layoutType.every(function (type, index) { | ||
return type === current[index]; | ||
}); | ||
} | ||
} // only one of the pre and current is pipes | ||
if (Array.isArray(current) || Array.isArray(this.layoutType)) { | ||
return false; | ||
} // both of the pre and current are not pipes | ||
return (cfg === null || cfg === void 0 ? void 0 : cfg.type) === this.layoutType; | ||
@@ -168,31 +176,2 @@ }; // 绘制 | ||
}; | ||
}; | ||
LayoutController.prototype.reLayoutMethod = function (layoutMethod, layoutCfg) { | ||
var _this = this; | ||
return new Promise(function (reslove, reject) { | ||
var graph = _this.graph; | ||
var layoutType = layoutCfg === null || layoutCfg === void 0 ? void 0 : layoutCfg.type; // 每个布局方法都需要注册 | ||
layoutCfg.onLayoutEnd = function () { | ||
graph.emit('aftersublayout', { | ||
type: layoutType | ||
}); | ||
reslove(); | ||
}; | ||
layoutMethod.init(_this.data); | ||
if (layoutType === 'force') { | ||
layoutMethod.ticking = false; | ||
layoutMethod.forceSimulation.stop(); | ||
} | ||
graph.emit('beforesublayout', { | ||
type: layoutType | ||
}); | ||
layoutMethod.execute(); | ||
if (layoutMethod.isCustomLayout && layoutCfg.onLayoutEnd) layoutCfg.onLayoutEnd(); | ||
}); | ||
}; // 重新布局 | ||
@@ -227,3 +206,3 @@ | ||
var relayoutPromise = _this.reLayoutMethod(layoutMethod, currentCfg); | ||
var relayoutPromise = _this.execLayoutMethod(layoutMethod, currentCfg); | ||
@@ -230,0 +209,0 @@ if (index === layoutMethods.length - 1) { |
@@ -56,3 +56,3 @@ "use strict"; | ||
var _default = { | ||
version: '0.6.17', | ||
version: '0.6.18', | ||
rootContainerClassName: 'root-container', | ||
@@ -59,0 +59,0 @@ nodeContainerClassName: 'node-container', |
@@ -27,3 +27,3 @@ import { GraphData } from '../../types'; | ||
setDataFromGraph(): GraphData; | ||
protected reLayoutMethod(layoutMethod: any, layoutCfg: any): Promise<void>; | ||
protected abstract execLayoutMethod(layoutCfg: any, order: any): Promise<void>; | ||
relayout(reloadData?: boolean): boolean; | ||
@@ -30,0 +30,0 @@ protected filterLayoutData(data: any, cfg: any): any; |
@@ -52,10 +52,18 @@ "use strict"; | ||
LayoutController.prototype.isLayoutTypeSame = function (cfg) { | ||
var current = this.getLayoutCfgType(cfg); // already has pipes | ||
var current = this.getLayoutCfgType(cfg); | ||
var preHasPipies = Array.isArray(this.layoutType); | ||
var currentHasPipes = Array.isArray(current); // already has pipes, and the new one is pipes | ||
if (Array.isArray(this.layoutType)) { | ||
if (preHasPipies && currentHasPipes) { | ||
return this.layoutType.every(function (type, index) { | ||
return type === current[index]; | ||
}); | ||
} | ||
} // only one of the pre and current is pipes | ||
if (Array.isArray(current) || Array.isArray(this.layoutType)) { | ||
return false; | ||
} // both of the pre and current are not pipes | ||
return (cfg === null || cfg === void 0 ? void 0 : cfg.type) === this.layoutType; | ||
@@ -177,31 +185,2 @@ }; // 绘制 | ||
}; | ||
}; | ||
LayoutController.prototype.reLayoutMethod = function (layoutMethod, layoutCfg) { | ||
var _this = this; | ||
return new Promise(function (reslove, reject) { | ||
var graph = _this.graph; | ||
var layoutType = layoutCfg === null || layoutCfg === void 0 ? void 0 : layoutCfg.type; // 每个布局方法都需要注册 | ||
layoutCfg.onLayoutEnd = function () { | ||
graph.emit('aftersublayout', { | ||
type: layoutType | ||
}); | ||
reslove(); | ||
}; | ||
layoutMethod.init(_this.data); | ||
if (layoutType === 'force') { | ||
layoutMethod.ticking = false; | ||
layoutMethod.forceSimulation.stop(); | ||
} | ||
graph.emit('beforesublayout', { | ||
type: layoutType | ||
}); | ||
layoutMethod.execute(); | ||
if (layoutMethod.isCustomLayout && layoutCfg.onLayoutEnd) layoutCfg.onLayoutEnd(); | ||
}); | ||
}; // 重新布局 | ||
@@ -236,3 +215,3 @@ | ||
var relayoutPromise = _this.reLayoutMethod(layoutMethod, currentCfg); | ||
var relayoutPromise = _this.execLayoutMethod(layoutMethod, currentCfg); | ||
@@ -239,0 +218,0 @@ if (index === layoutMethods.length - 1) { |
{ | ||
"name": "@antv/g6-core", | ||
"version": "0.6.17", | ||
"version": "0.6.18", | ||
"description": "A Graph Visualization Framework in JavaScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
1157422
34034