-
Maximilian Giller authoredMaximilian Giller authored
settingstool.js 677 B
import { graph, state } from "../editor";
import {
SettingsMenu,
LABELS_KEY,
RESIMULATE_KEY,
PHYSICS_DELAY_KEY,
} from "./menus/settingsmenu";
import Tool from "./tool";
export default class SettingsTool extends Tool {
constructor(key) {
super("Settings", "settings", key, new SettingsMenu(), true);
}
onMenuChange(key, value) {
if (key === LABELS_KEY) {
state.setLabelVisibility(value);
} else if (key === RESIMULATE_KEY) {
graph.restartSimulation();
} else if (key === PHYSICS_DELAY_KEY) {
graph.physicsDelay = Number(value) * 1000; // Convert seconds to ms
}
}
}