DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

58c10ddc9abf4f13cd85798b4ad6bca8759884c5 — Jonni Liljamo 1 year, 7 months ago 454e2be
feat(client): modify password widget and move to egui section
3 files changed, 16 insertions(+), 7 deletions(-)

A client/src/util/egui/mod.rs
R client/src/util/{eguipwd.rs => egui/password.rs}
M client/src/util/mod.rs
A client/src/util/egui/mod.rs => client/src/util/egui/mod.rs +10 -0
@@ 0,0 1,10 @@
/*
 * This file is part of laurelin/client
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * Licensed under GPL-3.0-only.
 * See LICENSE for licensing information.
 */

mod password;
pub use password::password;

R client/src/util/eguipwd.rs => client/src/util/egui/password.rs +5 -6
@@ 13,7 13,11 @@ fn password_ui(ui: &mut egui::Ui, password: &mut String) -> egui::Response {

    let mut show_plaintext = ui.data().get_temp::<bool>(state_id).unwrap_or(false);

    let result = ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
    let result = ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
        // TODO: this was previously add_sized() with a max of ui.available_size()
        // just, a note if... some usecase breaks or something
        ui.add(egui::TextEdit::singleline(password).password(!show_plaintext));

        let response = ui
            .add(egui::SelectableLabel::new(show_plaintext, "👁"))
            .on_hover_text("Show/hide password");


@@ 21,11 25,6 @@ fn password_ui(ui: &mut egui::Ui, password: &mut String) -> egui::Response {
        if response.clicked() {
            show_plaintext = !show_plaintext;
        }

        ui.add_sized(
            ui.available_size(),
            egui::TextEdit::singleline(password).password(!show_plaintext),
        );
    });

    ui.data().insert_temp(state_id, show_plaintext);

M client/src/util/mod.rs => client/src/util/mod.rs +1 -1
@@ 6,5 6,5 @@
 * See LICENSE for licensing information.
 */

pub mod eguipwd;
pub mod egui;
pub mod sl;