File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ struct controls {
4545 wxStaticText* min_hole_text;
4646 wxStaticText* minimize_text;
4747 wxSpinCtrl* quantity_spinner;
48+ std::optional<int > quantity_spinner_last_value{ 1 };
4849 wxSpinCtrl* min_hole_spinner;
4950 wxCheckBox* minimize_checkbox;
5051 wxStaticText* rotation_text;
Original file line number Diff line number Diff line change @@ -86,8 +86,10 @@ void main_window::on_select_parts(const std::vector<std::size_t>& indices) {
8686 }
8787 if (quantity.has_value ()) {
8888 _controls.quantity_spinner ->SetValue (*quantity);
89+ _controls.quantity_spinner_last_value .emplace (*quantity);
8990 } else {
9091 _controls.quantity_spinner ->SetValue (" " );
92+ _controls.quantity_spinner_last_value .reset ();
9193 }
9294 if (min_hole.has_value ()) {
9395 _controls.min_hole_spinner ->SetValue (*min_hole);
@@ -425,9 +427,13 @@ void main_window::bind_all_controls() {
425427 _controls.sinterbox_result_button ->Bind (wxEVT_BUTTON, &main_window::on_sinterbox_result, this );
426428
427429 _controls.quantity_spinner ->Bind (wxEVT_SPINCTRL, [this ](wxSpinEvent& event) {
428- for (auto & current_part : _current_parts) {
429- current_part.part ->quantity = event.GetPosition ();
430- _parts_list.reload_quantity (current_part.index );
430+ if (not _controls.quantity_spinner_last_value .has_value () and event.GetPosition () == 0 ) {
431+ _controls.quantity_spinner ->SetValue (" " );
432+ } else {
433+ for (auto & current_part : _current_parts) {
434+ current_part.part ->quantity = event.GetPosition ();
435+ _parts_list.reload_quantity (current_part.index );
436+ }
431437 }
432438 event.Skip ();
433439 });
You can’t perform that action at this time.
0 commit comments