Repository navigation
Expand file tree
/
Copy pathTransactionPanel.js
More file actions
72 lines (53 loc) · 1.63 KB
/
Copy pathTransactionPanel.js
File metadata and controls
72 lines (53 loc) · 1.63 KB
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
class TransactionPanel {
constructor(_key,_value, _position,_w,_h,_c) {
this.w = _w;
this.h = _h;
this.key = _key;
this.value = _value;
this.position = _position
this.windowColour = _c;
this.strokeColour = color(255);
}
render() {
push();
this.renderPanelBoarder();
this.renderText();
pop();
}
renderPanelBoarder() {
push();
if(this.isMouseOver() == true) {
this.strokeColour = color(0,255,255);
} else {
this.strokeColour = color(255);
}
stroke(this.strokeColour);
fill(this.windowColour);
rect(this.position.x,this.position.y , this.w, this.h);
pop();
}
renderText() {
push();
fill(255);
text(`${this.key}: ${this.value}`, this.position.x + 5, this.position.y+15);
pop();
}
isMouseOver() {
if(mouseX > this.position.x && mouseX < this.position.x + this.w
&& mouseY > this.position.y && mouseY < this.position.y + this.h){
return true;
}
}
isClicked(_addressURLBase,_hashURLBase) {
console.log(this.values);
if(this.key === "to") {
window.open(`${_addressURLBase}${this.value}`,"_blank");
} else if(this.key === "from") {
window.open(`${_addressURLBase}${this.value}`,"_blank");
} else if(this.key === "hash") {
window.open(`${_hashURLBase}${this.value}`,"_blank");
} else {
return;
}
}
}