Browse Source

canvas state

main
Stephanie Gredell 5 months ago
parent
commit
8ddc2af15b
  1. 13
      static/difficulty-select.html
  2. 15
      static/index.html
  3. 2
      static/states/CanvasState.js
  4. 4
      static/states/CanvasStateMachine.js
  5. 6
      static/states/ConnectionState.js
  6. 2
      static/success.html

13
static/difficulty-select.html

@ -607,19 +607,6 @@
window.location.href = '/game-modes'; window.location.href = '/game-modes';
} }
}); });
// Add hover sound effects (you'd need actual audio files)
document.querySelectorAll('.difficulty-card').forEach(card => {
card.addEventListener('mouseenter', () => {
// Play hover sound
console.log('🔊 Hover sound effect');
});
card.addEventListener('click', () => {
// Play click sound
console.log('🔊 Click sound effect');
});
});
</script> </script>
</body> </body>
</html> </html>

15
static/index.html

@ -1020,21 +1020,6 @@
</footer> </footer>
<script> <script>
// Form handling
document.getElementById('betaForm').addEventListener('submit', function(e) {
e.preventDefault();
const email = this.querySelector('input[type="email"]').value;
// Simulate API call
setTimeout(() => {
document.getElementById('successMessage').style.display = 'block';
this.style.display = 'none';
// Track conversion (in real app, send to analytics)
console.log('Beta signup:', email);
}, 500);
});
// Smooth scrolling // Smooth scrolling
document.querySelectorAll('a[href^="#"]').forEach(anchor => { document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) { anchor.addEventListener('click', function (e) {

2
static/states/CanvasState.js

@ -12,7 +12,6 @@ export class CanvasState {
*/ */
enter(app) { enter(app) {
// Override in concrete states // Override in concrete states
console.log(`Entering ${this.constructor.name}`);
} }
/** /**
@ -21,7 +20,6 @@ export class CanvasState {
*/ */
exit(app) { exit(app) {
// Override in concrete states // Override in concrete states
console.log(`Exiting ${this.constructor.name}`);
} }
/** /**

4
static/states/CanvasStateMachine.js

@ -31,12 +31,10 @@ export class CanvasStateMachine {
const newState = this.states[stateName]; const newState = this.states[stateName];
if (!newState) { if (!newState) {
console.error(`Unknown state: ${stateName}`);
return; return;
} }
if (this.currentState === newState) { if (this.currentState === newState) {
console.log(`Already in ${stateName} state`);
return; return;
} }
@ -50,8 +48,6 @@ export class CanvasStateMachine {
this.currentState = newState; this.currentState = newState;
this.currentState.enter(this.app); this.currentState.enter(this.app);
console.log(`State transition: ${previousState?.getStateName() || 'none'} -> ${newState.getStateName()}`);
// Notify any listeners about state change // Notify any listeners about state change
this.onStateChanged(previousState, newState); this.onStateChanged(previousState, newState);
} }

6
static/states/ConnectionState.js

@ -50,13 +50,11 @@ export class ConnectionState extends CanvasState {
// First click - start connection // First click - start connection
app.connectionStart = node; app.connectionStart = node;
node.group.classList.add('selected'); node.group.classList.add('selected');
console.log('Connection started from:', node.type);
} else if (app.connectionStart === node) { } else if (app.connectionStart === node) {
// Clicked same node - cancel connection // Clicked same node - cancel connection
app.connectionStart.group.classList.remove('selected'); app.connectionStart.group.classList.remove('selected');
app.connectionStart = null; app.connectionStart = null;
console.log('Connection cancelled');
} else { } else {
// Second click - complete connection // Second click - complete connection
@ -69,7 +67,6 @@ export class ConnectionState extends CanvasState {
handleNodeDoubleClick(app, node) { handleNodeDoubleClick(app, node) {
// In connection mode, double-click does nothing // In connection mode, double-click does nothing
// Properties panel is disabled in this state // Properties panel is disabled in this state
console.log('Properties panel disabled in connection mode');
} }
handleCanvasClick(app, event) { handleCanvasClick(app, event) {
@ -77,7 +74,6 @@ export class ConnectionState extends CanvasState {
if (app.connectionStart) { if (app.connectionStart) {
app.connectionStart.group.classList.remove('selected'); app.connectionStart.group.classList.remove('selected');
app.connectionStart = null; app.connectionStart = null;
console.log('Connection cancelled by canvas click');
} }
// Don't clear node selections in connection mode // Don't clear node selections in connection mode
@ -101,8 +97,6 @@ export class ConnectionState extends CanvasState {
Connection.tlsCheckbox.checked = false; Connection.tlsCheckbox.checked = false;
Connection.capacityInput.value = '1000'; Connection.capacityInput.value = '1000';
Connection.modal.style.display = 'block'; Connection.modal.style.display = 'block';
console.log(`Connection setup: ${startNode.type} -> ${endNode.type}`);
} }
getCursor() { getCursor() {

2
static/success.html

@ -648,8 +648,6 @@ input[name="tab"] {
window.location.href = '/game-modes'; window.location.href = '/game-modes';
} }
}); });
console.log("✅ SYSTEM SUCCESS SCREEN DISPLAYED");
</script> </script>
</div> </div>
</body> </body>

Loading…
Cancel
Save