-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgod.js
105 lines (102 loc) · 3.58 KB
/
god.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
class God{
constructor(gName,x,y,image,width,height,cardType,godType,domain,description){
this.greekName = gName;
this.x = x;
this.y = y;
this.image = image;
this.width = width;
this.height = height;
this.cardType = cardType;
this.godType = godType;
this.domain = domain;
this.description = description;
this.childLink = new Set();
this.spouse = [];
this.childRect = new Set();
this.rectID = gName+"Rect";
this.children = [];
}
clickCard(){
console.log("clicked");
}
//God cards
view(){
var picHeight = this.width-20;
var tooltipText = this.greekName+" has "+this.childRect.size+" children.";
var tooltip = tree.append("svg")
.attr("id",this.greekName+"Tooltip")
.style("visibility",'hidden');
tooltip.append("rect")
.attr("class","tooltipRect")
.attr("width",this.width+tooltipText.length*6)
.attr("height",30)
.attr("godName",this.greekName)
.attr("x",this.x-tooltipText.length*3)
.attr("y",this.y-35)
.attr("rx", 6)
.attr("ry", 6);
tooltip.append("text")
.text(tooltipText)
.attr("class",'tooltipText')
.attr("x",this.x+(this.width/2))
.attr("y",this.y-20);
tree.append("rect") //add card
.attr("x",this.x)
.attr("y",this.y)
.attr("rx", 6)
.attr("ry", 6)
.attr("godName",this.greekName)
.attr("id",this.rectID)
.attr("class",this.godType)
.attr("width",this.width)
.attr("height",this.height)
if(this.cardType === "small"){
tree.append("text") //text
.text(this.greekName)
.attr("class","text-"+this.godType)
.attr("x",this.x+(this.width/2))
.attr("y",this.y+(this.height/2)-5);
tree.append("text") //text
.text(this.domain)
.attr("class","domain-"+this.godType+" "+"domain")
.attr("id","domain-"+this.greekName)
.attr("x",this.x+(this.width/2))
.attr("y",this.y+(this.height/2)+10);
tree.append("rect")//hitbox
.attr("x",this.x-5)
.attr("y",this.y-5)
.attr("godName",this.greekName)
.attr("class","hitbox")
.attr("domain",this.domain)
.attr("description",this.description)
.attr("width",this.width+5)
.attr("height",this.height+5)
}else{
tree.append("svg:image")//image
.attr("xlink:href",this.image)
.attr("x", this.x+10)
.attr("y", this.y+10)
.attr("height",picHeight);
tree.append("text") //name text
.text(this.greekName)
.attr("class","text-"+this.godType)
.attr("x",this.x+(this.width/2))
.attr("y",this.y+picHeight+30);
tree.append("text") //domain text
.text(this.domain)
.attr("class","domain-"+this.godType+" "+"domain")
.attr("id","domain-"+this.greekName)
.attr("x",this.x+(this.width/2))
.attr("y",this.y+picHeight+50);
tree.append("rect")//hitbox
.attr("x",this.x-5)
.attr("y",this.y-5)
.attr("godName",this.greekName)
.attr("class","hitbox")
.attr("domain",this.domain)
.attr("description",this.description)
.attr("width",this.width+10)
.attr("height",this.height+10)
}
}
}