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

Merged
merged 12 commits into from
Feb 1, 2025
Prev Previous commit
Next Next commit
fix: optional SpeedMultiplier on setNetwork
V-SANT committed Jan 23, 2025

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 70e7ee9808d23439df2d11a6c3a10855d03dca2c
10 changes: 8 additions & 2 deletions src/context.ts
Original file line number Diff line number Diff line change
@@ -31,10 +31,15 @@ export class GlobalContext {
return this.ipGenerator.getNextIp();
}

private setNetwork(datagraph: DataGraph, layer: Layer) {
private setNetwork(
datagraph: DataGraph,
layer: Layer,
speedMultiplier?: SpeedMultiplier,
) {
this.datagraph = datagraph;
this.viewport.clear();
this.viewgraph = new ViewGraph(this.datagraph, this.viewport, layer);
this.viewgraph.setSpeed(speedMultiplier?.value || 1);
this.setIpGenerator();
}

@@ -87,7 +92,8 @@ export class GlobalContext {

changeViewGraph(selectedLayer: string) {
const layer = layerFromName(selectedLayer);
this.setNetwork(this.datagraph, layer);
const speedMultiplier = this.getCurrentSpeed();
this.setNetwork(this.datagraph, layer, speedMultiplier);
}

changeSpeedMultiplier(speedMultiplier: number) {