Mercurial > MadButterfly
diff nodejs/svg.js @ 1408:c918b79892ab
Add component class which is sued to access the objects in different frame for the same screen object. We will treat the object as the same if the duplicated-src are the same or it is the grpup defined by duplicated-src.
author | wycc |
---|---|
date | Wed, 06 Apr 2011 07:51:06 +0800 |
parents | 18215e577fe0 |
children | 6fa411fd9549 13e126941bdd |
line wrap: on
line diff
--- a/nodejs/svg.js Wed Apr 06 07:48:29 2011 +0800 +++ b/nodejs/svg.js Wed Apr 06 07:51:06 2011 +0800 @@ -1037,13 +1037,40 @@ this.parseGroup(m,root,id, n) } +function getName(n) +{ + var attr = n.attr('mbname'); + var name; + + if (attr) { + name = attr.value(); + if (name != '') return name; + } + attr = n.attr('label'); + + if (attr) { + name = attr.value(); + if (name != '') return name; + } + attr = n.attr('id'); + + if (attr) { + name = attr.value(); + if (name != '') return name; + } + + return ''; + +} + loadSVG.prototype._check_duplicate_src=function(n,coord) { - var id = n.attr('id'); - coord.id = id; + var id = getName(n); if (id) { - coord.id = id.value(); + coord.id = id; + coord.refid = id; } else { coord.id = "NA"; + coord.refid ="NA"; } if (n.name()=="use") { n.coord.isuse = true @@ -1061,6 +1088,7 @@ sys.puts("duplicated"); } this.mb_rt.mbnames[id].target = coord; + coord.refid = this.mb_rt.mbnames[id].id; } catch(e) { sys.puts("id "+id+" is not defined"); }