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
106
107
108
109
110
111
112
113
114
115
116
117
118
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Graph Visualizer</title>
<link rel="stylesheet" href="css/skeleton.css">
<link rel="stylesheet" href="css/main.css">
<style>
#visualizer-container {
width: 100%;
height: max(500px, 60vh);
background: #1a1a2e;
border-radius: 8px;
overflow: hidden;
position: relative;
}
#visualizer-container canvas {
display: block;
}
.visualizer-controls {
margin-top: 10px;
display: flex;
gap: 10px;
flex-wrap: wrap;
align-items: center;
}
.visualizer-controls button {
margin-bottom: 0;
}
.visualizer-controls button:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.status-bar {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
#presence-count {
color: #888;
font-size: 0.9rem;
}
/* Toast notification styles */
#toast-container {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 10000;
display: flex;
flex-direction: column-reverse;
gap: 8px;
pointer-events: none;
}
.toast {
padding: 10px 18px;
border-radius: 6px;
color: #fff;
font-size: 0.85rem;
opacity: 0;
transform: translateX(40px);
transition: opacity 0.3s, transform 0.3s;
pointer-events: auto;
}
.toast-visible {
opacity: 1;
transform: translateX(0);
}
.toast-info { background: rgba(78,205,196,0.9); }
.toast-success { background: rgba(46,204,113,0.85); }
.toast-error { background: rgba(255,107,107,0.9); }
</style>
</head>
<body>
<header>
<h2>Graph Visualizer</h2>
<section>
<p>A collaborative 3D graph editor</p>
</section>
</header>
<main>
<section>
<h5>3D Graph View</h5>
<div id="visualizer-container"></div>
<div class="visualizer-controls">
<button id="btn-add-node">Add Node</button>
<button id="btn-add-edge">Add Random Edge</button>
<button id="btn-connect-selected" disabled>Connect Two Nodes</button>
<button id="btn-delete-selected" disabled>Delete Selected</button>
<button id="btn-reset">Reset Graph</button>
</div>
</section>
<hr>
<section>
<div class="status-bar">
<div id="server-status">Server status: Connecting...</div>
<div id="presence-count"></div>
</div>
</section>
<footer>
<p>Drag to rotate | Scroll to zoom | Click nodes to select | Drag nodes to move | Delete key to remove | Select 2 nodes to connect</p>
</footer>
</main>
</body>
<script type="text/javascript" src="js/jquery-3.7.1.min.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.162.0/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.162.0/examples/jsm/"
}
}
</script>
<script type="module" src="js/visualizer.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</html>
|