我正在创建一系列矩形节点,我想输入有关数组中每个节点的数据。我想知道如何在Raphael中创建数组以及如何在其中输入数据。 我创建了以下代码:
drawNode(290, 80);
function drawNode(x,y)
{
id=0;
a = new node(x,y,id);
a.drawNode();
}
var node = function(x,y,id){
this.x=x;
this.y=y;
this.id=id;
this.drawNode = function(){
var st = paper.set();
a = paper.rect(this.x,this.y, 100, 40, 2);
a.addnote = paper.image('images/note.png', this.x+20, this.y-5, 10, 10)
a.text = paper.text(this.x+50, this.y+20, "Add Text"),
a.add = paper.image('images/plus.png', this.x+77, this.y+12, 20, 20)
a.del = paper.image('images/minus.png', this.x+5, this.y+17, 20, 10)
a.attr({fill: '#8EDFF0', stroke: '#6AB0F2'});
a.drag(this.move, this.dragger, this.up);
st.push(a,a.text,a.add,a.addnote);
a.add.click(this.add);
a.del.click(this.del);
}
我想在数组中输入x,y坐标及其id等节点信息。请帮忙。