Skip to content

Commit

Permalink
vspc reset for blockdag
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Jan 21, 2024
1 parent 2326155 commit a24d4bf
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
2 changes: 2 additions & 0 deletions core/src/modules/block_dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ impl ModuleT for BlockDag {
ui.space();
ui.checkbox(&mut self.settings.show_vspc, i18n("Show VSPC"));
ui.space();
// ui.checkbox(&mut self.settings.reset_vspc, i18n("Reset VSPC"));
// ui.space();
ui.checkbox(&mut self.settings.show_grid, i18n("Show Grid"));
ui.space();
ui.checkbox(&mut self.settings.show_daa, i18n("Show DAA"));
Expand Down
2 changes: 2 additions & 0 deletions core/src/modules/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ impl Overview {
.show(ui, |ui| {
// egui::special_emojis
// use egui_phosphor::light::{DISCORD_LOGO,GITHUB_LOGO};

#[cfg(not(target_arch = "wasm32"))]
ui.hyperlink_to_tab(
format!("• {}",i18n("Kaspa NG Web App")),
"https://kaspa-ng.org"
Expand Down
21 changes: 12 additions & 9 deletions core/src/primitives/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct BlockDagGraphSettings {
pub graph_length_daa: usize,
pub center_vspc: bool,
pub balance_vspc: bool,
pub reset_vspc: bool,
pub show_vspc: bool,
pub show_daa: bool,
pub show_grid: bool,
Expand All @@ -23,6 +24,7 @@ impl Default for BlockDagGraphSettings {
graph_length_daa: 1024,
center_vspc: false,
balance_vspc: true,
reset_vspc: true,
show_vspc: true,
show_daa: true,
show_grid: true,
Expand Down Expand Up @@ -167,15 +169,16 @@ impl DaaBucket {
}

pub fn reset(&mut self, settings: &BlockDagGraphSettings) {
self.blocks.iter_mut().for_each(|block| {
// block.dst_y = hash_to_y_coord(&block.data.header.hash, settings.y_scale);
block.settled = false;
if block.vspc && settings.center_vspc {
block.dst_y = 0.0;
} else {
block.dst_y = hash_to_y_coord(&block.data.header.hash, settings.y_scale);
}
});
if settings.reset_vspc {
self.blocks.iter_mut().for_each(|block| {
block.settled = false;
if block.vspc && settings.center_vspc {
block.dst_y = 0.0;
} else {
block.dst_y = hash_to_y_coord(&block.data.header.hash, settings.y_scale);
}
});
}

self.update(settings);
}
Expand Down
15 changes: 8 additions & 7 deletions resources/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"languages": {
"pt": "Português",
"hi": "Hindi",
"nl": "Dutch",
"fi": "Finnish",
"vi": "Vietnamese",
"fil": "Filipino",
"lt": "Lithuanian",
"fi": "Finnish",
"nl": "Dutch",
"sv": "Swedish",
"es": "Español",
"pa": "Panjabi",
"fa": "Farsi",
"uk": "Ukrainian",
"es": "Español",
"af": "Afrikaans",
"et": "Esti",
"en": "English",
Expand Down Expand Up @@ -59,16 +59,16 @@
"translations": {
"pt": {},
"hi": {},
"fi": {},
"nl": {},
"vi": {},
"fil": {},
"lt": {},
"nl": {},
"fi": {},
"sv": {},
"es": {},
"pa": {},
"fa": {},
"uk": {},
"fa": {},
"af": {},
"et": {},
"en": {
Expand Down Expand Up @@ -147,6 +147,7 @@
"Disabled": "Disabled",
"Open Data Folder": "Open Data Folder",
"Very dangerous (may be cracked within few seconds)": "Very dangerous (may be cracked within few seconds)",
"Reset VSPC": "Reset VSPC",
"Secret is too weak": "Secret is too weak",
"Please note, copying to clipboard carries a risk of exposing your mnemonic to malware.": "Please note, copying to clipboard carries a risk of exposing your mnemonic to malware.",
"No public node selected - please select a public node": "No public node selected - please select a public node",
Expand Down Expand Up @@ -257,8 +258,8 @@
"Database Blocks": "Database Blocks",
"Not Connected": "Not Connected",
"Use all available system memory": "Use all available system memory",
"Headers": "Headers",
"Address:": "Address:",
"Headers": "Headers",
"Custom": "Custom",
"Mainnet (Main Kaspa network)": "Mainnet (Main Kaspa network)",
"Please enter the wallet secret": "Please enter the wallet secret",
Expand Down

0 comments on commit a24d4bf

Please sign in to comment.