View unanswered posts | View active topics It is currently 2019-12-10 5:45



Reply to topic  [ 1 post ] 
 关于group嵌套group,浏览器特别卡问题 
Author Message
新手上路

Joined: 2019-11-20 15:22
Posts: 1
Post 关于group嵌套group,浏览器特别卡问题
请问一下,group嵌套group 为什么浏览器这么卡呢? 最外层一个group,里面只有不到200 个group ,里面的每个group只有一个node,为什么这么卡呢?效果图如下请看附件,是我用法有问题吗?

部分代码截取:

if (null != _item.group) {
var root_group = null;
if(null != _item.rootGroup) {
root_group = createRootGroup(_item.rootGroup);
}
var group = createGroup(_item.group,_item.groupIsExpanded,_item.groupName1,_item.groupName2);
if (null != root_group) {
group.setParent(root_group);
console.log("sign");
}
if (null != group) {
node.setParent(group);
}
}




function createRootGroup(gid) {
var _rootgroup = this.box.getDataById(gid);
var _expanded = false;

if (undefined == _rootgroup) {
_rootgroup = new twaver.Group(gid);
_rootgroup.s('group.fill.color', '#F5F5F5');
_rootgroup.s('whole.alpha', 0.8);
_rootgroup.s('group.fill',true);
_rootgroup.s('group.outline.width',2);
_rootgroup.s('group.outline.pattern', 12, 3);
_rootgroup.s('group.outline.color','#ec6c00');
_rootgroup.s('select.style', 'none');
_rootgroup.s('group.shape', 'roundrect');
_rootgroup.s('group.deep', 0);
_rootgroup.s('label.font', '14px "Microsoft Yahei"');
if(undefined != gid) {
_rootgroup.setName2(gid);
}
_rootgroup.setExpanded(_expanded);

this.box.add(_rootgroup);
}
return _rootgroup;
}




function createGroup(gid,expanded,group1,group2) {
var group = this.box.getDataById(gid);
var _expanded = false;
if (undefined == group) {
var group = new twaver.Group(gid);
group.s('group.fill.color', '#F5F5F5');
group.s('whole.alpha', 0.8);
group.s('group.fill',true);
group.s('group.outline.width',2);
group.s('group.outline.pattern', 12, 3);
group.s('group.outline.color','#ec6c00');
group.s('select.style', 'none');
group.s('group.shape', 'roundrect');
group.s('group.deep', 0);
group.s('label.font', '14px "Microsoft Yahei"');
if(undefined != expanded) {
if("false" == expanded)
_expanded = false;
else if("true" == expanded)
_expanded = true;
}
if(undefined != group1) {
group.setName2(group1);
}
if (undefined != group2) {
group.setName(group2);
}
group.setExpanded(_expanded);

this.box.add(group);
}
return group;
}





if (null != root_group) {
group.setParent(root_group);
console.log("sign");
}

这段代码 console.log("sign"); 这个打印特别慢,把上面group.setParent(root_group); 去掉,加载就正常了,但是达不到嵌套的效果了,请麻烦解答一下,谢谢!


Attachments:
topo.png
topo.png [ 355.28 KiB | Viewed 68 times ]
2019-11-20 15:38
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron