提交 12588bd9 编写于 作者: L lang

力导向默认关闭 worker, 布局比例调整

上级 e4177ea4
......@@ -2870,7 +2870,7 @@ indicator : [
</tr>
<tr>
<td> <b>{boolean}</b> useWorker </td>
<td> true </td>
<td> false </td>
<td> 是否在浏览器支持 web worker 的时候把布局计算放入 web worker 中 </td>
</tr>
<tr>
......
......@@ -105,7 +105,7 @@ option = {
minRadius : 15,
maxRadius : 25,
gravity: 1.1,
scaling: 1.2,
scaling: 1.1,
linkSymbol: 'arrow',
nodes:[
{category:0, name: '乔布斯', value : 10},
......
......@@ -77,6 +77,7 @@ option = {
webkitDepData.scaling = 1.1;
webkitDepData.steps = 20;
webkitDepData.large = true;
webkitDepData.useWorker = true;
webkitDepData.coolDown = 0.995;
webkitDepData.itemStyle = {
normal : {
......
......@@ -363,8 +363,8 @@ define(function (require) {
var config = {
center: center,
width: width,
height: height,
width: serie.ratioScaling ? width : size,
height: serie.ratioScaling ? height : size,
scaling: serie.scaling || 1.0,
gravity: serie.gravity || 1.0,
barnesHutOptimize: serie.large
......
......@@ -642,13 +642,13 @@ define(function(require) {
// vec2.sub(v, this._rootRegion.centerOfMass, node.position);
// vec2.negate(v, node.position);
vec2.sub(v, this.center, node.position);
// if (this.width > this.height) {
// // Stronger gravity on y axis
// v[1] *= this.width / this.height;
// } else {
// // Stronger gravity on x axis
// v[0] *= this.height / this.width;
// }
if (this.width > this.height) {
// Stronger gravity on y axis
v[1] *= this.width / this.height;
} else {
// Stronger gravity on x axis
v[0] *= this.height / this.width;
}
var d = vec2.len(v) / 100;
if (this.strongGravity) {
......
......@@ -796,13 +796,16 @@ define(function() {
minRadius : 10,
maxRadius : 20,
// 是否根据屏幕比例拉伸
ratioScaling: false,
// 在 500+ 顶点的图上建议设置 large 为 true, 会使用 Barnes-Hut simulation
// 同时开启 useWorker 并且把 steps 值调大
// 关于Barnes-Hut simulation: http://en.wikipedia.org/wiki/Barnes–Hut_simulation
large: false,
// 为 false 的时候强制关闭 web worker
useWorker: true,
// 是否在浏览器支持 worker 的时候使用 web worker
useWorker: false,
// 每一帧 force 迭代的次数,仅在启用webworker的情况下有用
steps: 1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册