Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packet speed #108

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Packet speed #108

wants to merge 10 commits into from

Conversation

V-SANT
Copy link
Collaborator

@V-SANT V-SANT commented Jan 24, 2025

This pull request introduces a new feature to control the speed of network simulations via a speed multiplier. The changes involve updating several files to incorporate this functionality, including the addition of a new SpeedMultiplier class, modifications to the GlobalContext and ViewGraph classes, and updates to the user interface to include a speed control slider.

Key Changes:

Core Functionality:

  • Speed Multiplier Class: Added a new SpeedMultiplier class to manage speed values and provide utility methods for parsing and formatting (src/types/devices/speedMultiplier.ts).
  • GlobalContext Class: Updated the GlobalContext class to handle speed multipliers, including methods to set and get the current speed, and to update the speed multiplier when loading the context (src/context.ts). [1] [2]

View Graph:

  • ViewGraph Class: Modified the ViewGraph class to incorporate speed multipliers, including methods to set and get the speed, and to normalize packet speed based on edge length (src/types/graphs/viewgraph.ts). [1] [2]

User Interface:

  • Speed Control Slider: Added a speed control slider to the user interface, allowing users to adjust the simulation speed. This includes changes to the HTML structure, event handling in JavaScript, and styling in CSS (src/index.ejs, src/index.ts, src/styles/speed-wheel.css). [1] [2] [3]

Persistence:

  • Local Storage: Updated local storage functionality to save and load the speed multiplier, ensuring the speed setting persists across sessions (src/types/viewportManager.ts). [1] [2]

// The longer the edge, the slower the progress increment
const normalizedSpeed = this.speed / edgeLength;

// Update progress with normalized speed
if (!Packet.animationPaused) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have this be a speed of 0 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants