Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 43 additions & 28 deletions djmaxplus/src/components/config_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,20 @@ impl ConfigEditor {

if self.should_update_notetime {
self.should_update_notetime = false;
let effective_sub_length = if config.lanecover_visible {
current_lanecover_config.sub_length as u32
} else {
0
};

self.notetime_ms_display = format!(
"{}ms",
27 * (1000 - current_lanecover_config.sub_length as u32)
27 * (1000 - effective_sub_length)
/ current_lanecover_config.hi_speed as u32
);
self.notetime_df_display = format!(
"{}dF",
162 * (1000 - current_lanecover_config.sub_length as u32)
162 * (1000 - effective_sub_length)
/ current_lanecover_config.hi_speed as u32
/ 10
);
Expand All @@ -241,32 +247,37 @@ impl ConfigEditor {
ui.push_style_color(imgui::StyleColor::WindowBg, [0.0, 0.0, 0.0, 0.5]);
let style_lanecover_windowbordersize =
ui.push_style_var(StyleVar::WindowBorderSize(0.));
ui.window("##lanecover_sublength")
.flags(
WindowFlags::NO_DECORATION
| WindowFlags::NO_INPUTS
| WindowFlags::NO_SCROLL_WITH_MOUSE
| WindowFlags::NO_MOVE
| WindowFlags::ALWAYS_AUTO_RESIZE,
)
.position(
[
lanecover.position()[0]
- lanecover.size()[0] * lanecover.position_pivot()[0],
lanecover.position()[1],
],
Condition::Always,
)
.position_pivot([0.0, 1.0])
.build(|| {
let sub_length = config.lanecover_configs[lanecover.config_index].sub_length;

if self.sublength_display.0 != sub_length {
self.sublength_display = (sub_length, format!("{}", sub_length))
}
if config.lanecover_visible {
ui.window("##lanecover_sublength")
.flags(
WindowFlags::NO_DECORATION
| WindowFlags::NO_INPUTS
| WindowFlags::NO_SCROLL_WITH_MOUSE
| WindowFlags::NO_MOVE
| WindowFlags::ALWAYS_AUTO_RESIZE,
)
.position(
[
lanecover.position()[0]
- lanecover.size()[0] * lanecover.position_pivot()[0],
lanecover.position()[1],
],
Condition::Always,
)
.position_pivot([0.0, 1.0])
.build(|| {
let sub_length =
config.lanecover_configs[lanecover.config_index].sub_length;

if self.sublength_display.0 != sub_length {
self.sublength_display = (sub_length, format!("{}", sub_length))
}

ui.text(&self.sublength_display.1);
});
}

ui.text(&self.sublength_display.1);
});
ui.window("##lanecover_notetime")
.flags(
WindowFlags::NO_DECORATION
Expand All @@ -279,11 +290,15 @@ impl ConfigEditor {
[
lanecover.position()[0]
+ lanecover.size()[0] * (1. - lanecover.position_pivot()[0]),
lanecover.position()[1],
if config.lanecover_visible {
lanecover.position()[1]
} else {
0.0
},
],
Condition::Always,
)
.position_pivot([1.0, 1.0])
.position_pivot([1.0, if config.lanecover_visible { 1.0 } else { 0.0 }])
.build(|| {
ui.text(&self.notetime_ms_display);
ui.same_line();
Expand Down
1 change: 1 addition & 0 deletions djmaxplus/src/components/hotkey_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl HotkeyHandler {

if open_editor_hotkey_down {
config.lanecover_visible ^= true; // flip
config_editor.should_update_notetime |= config_editor.visible;
self.editor_hotkey_doubletap_state = DoubletapState::SecondDown;
}
}
Expand Down