선택한 행 hover를 더 진하게 하고 누를 수 있는 곳에 손 모양 커서를 씀
선택한 행에 마우스를 올리면 선택 색보다 덜 투명한 파란색(BLUE 18%)으로 그림. 버튼, 도구 막대, 위로 버튼, 제목 표시줄 버튼, 파일 목록 행, 체크박스에 마우스를 올리면 손 모양 커서를 보여 줌. 사용할 수 없거나 누를 수 없는 곳, 목록의 빈 곳 (끌어서 선택), 제목 표시줄의 끌기 영역, 입력란은 그대로 둠. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
33b51f69641832b95c0ef9886ed3b9bed5b29662- 부모
- 3319254
변경된 파일 4개
+89-10| @@ -1252,6 +1252,7 @@ impl ArchiveApp { | ||
| 1252 | 1252 | }, |
| 1253 | 1253 | ) |
| 1254 | 1254 | .on_hover_text(&row.name); |
| 1255 | 추가: theme::pointer(&response); | |
| 1255 | 1256 | response.widget_info(|| { |
| 1256 | 1257 | egui::WidgetInfo::selected( |
| 1257 | 1258 | egui::Role::ListBoxOption, |
| @@ -1823,6 +1824,7 @@ impl ArchiveApp { | ||
| 1823 | 1824 | &mut self.checked_destination, |
| 1824 | 1825 | "기존 풀 위치 폴더를 확인했습니다", |
| 1825 | 1826 | ); |
| 1827 | 추가: theme::pointer(&response); | |
| 1826 | 1828 | theme::focus(&response); |
| 1827 | 1829 | } |
| 1828 | 1830 | ui.horizontal(|ui| { |
| @@ -2131,6 +2133,7 @@ impl ArchiveApp { | ||
| 2131 | 2133 | egui::Sense::click(), |
| 2132 | 2134 | ); |
| 2133 | 2135 | let response = response.on_hover_text(&row.name); |
| 2136 | 추가: theme::pointer(&response); | |
| 2134 | 2137 | response.widget_info(|| { |
| 2135 | 2138 | egui::WidgetInfo::labeled( |
| 2136 | 2139 | egui::Role::ListBoxOption, |
| @@ -2197,6 +2200,7 @@ impl ArchiveApp { | ||
| 2197 | 2200 | |
| 2198 | 2201 | // 암호: 체크하면 바로 아래에 암호와 암호 확인 칸을 보여 줌. |
| 2199 | 2202 | let check = ui.checkbox(&mut self.aes256, "암호로 보호하기"); |
| 2203 | 추가: theme::pointer(&check); | |
| 2200 | 2204 | theme::focus(&check); |
| 2201 | 2205 | if self.aes256 { |
| 2202 | 2206 | let label_width = 72.0; |
| @@ -14,6 +14,8 @@ pub const SELECTED: Color32 = Color32::from_rgb(232, 240, 254); | ||
| 14 | 14 | pub const ROW_SELECTED: Color32 = Color32::from_rgba_unmultiplied_const(37, 99, 235, 31); |
| 15 | 15 | /// 파일 목록에서 마우스를 올린 행의 배경. 선택한 행보다 조금 더 투명함 (BLUE 6%). |
| 16 | 16 | pub const ROW_HOVER: Color32 = Color32::from_rgba_unmultiplied_const(37, 99, 235, 15); |
| 17 | 추가: /// 선택한 행에 마우스를 올렸을 때의 배경. 선택 색보다 덜 투명함 (BLUE 18%). | |
| 18 | 추가: pub const ROW_SELECTED_HOVER: Color32 = Color32::from_rgba_unmultiplied_const(37, 99, 235, 46); | |
| 17 | 19 | pub const DROP: Color32 = Color32::from_rgb(238, 244, 255); |
| 18 | 20 | pub const DASH: Color32 = Color32::from_rgb(170, 180, 192); |
| 19 | 21 | pub const SUCCESS: Color32 = Color32::from_rgb(21, 128, 61); |
| @@ -111,6 +113,8 @@ pub fn apply(ctx: &egui::Context) { | ||
| 111 | 113 | style.spacing.interact_size.y = ROW; |
| 112 | 114 | style.spacing.window_margin = egui::Margin::same(PAD); |
| 113 | 115 | style.visuals.disabled_alpha = 0.4; |
| 116 | 추가: // egui 기본 버튼에도 손 모양 커서를 씀. | |
| 117 | 추가: style.visuals.interact_cursor = Some(egui::CursorIcon::PointingHand); | |
| 114 | 118 | // 클릭과 표시가 즉시 바뀌도록 서서히 나타남, 부드러운 스크롤, 커서 깜빡임을 모두 끔. |
| 115 | 119 | style.animation_time = 0.0; |
| 116 | 120 | style.scroll_animation = egui::style::ScrollAnimation::none(); |
| @@ -118,6 +122,14 @@ pub fn apply(ctx: &egui::Context) { | ||
| 118 | 122 | }); |
| 119 | 123 | } |
| 120 | 124 | |
| 125 | 추가: /// 누를 수 있는 버튼이나 항목에 마우스를 올리면 손 모양 커서를 보여 줌. | |
| 126 | 추가: /// 사용할 수 없거나 누를 수 없는 영역(끌기 전용 등)은 그대로 둠. | |
| 127 | 추가: pub fn pointer(response: &egui::Response) { | |
| 128 | 추가: if response.enabled() && response.sense.senses_click() && response.hovered() { | |
| 129 | 추가: response.ctx.set_cursor_icon(egui::CursorIcon::PointingHand); | |
| 130 | 추가: } | |
| 131 | 추가: } | |
| 132 | 추가: | |
| 121 | 133 | pub fn focus(response: &egui::Response) { |
| 122 | 134 | if response.has_focus() { |
| 123 | 135 | response.ctx.layer_painter(response.layer_id).rect_stroke( |
| @@ -170,16 +182,19 @@ pub fn action_sized( | ||
| 170 | 182 | ) |
| 171 | 183 | }) |
| 172 | 184 | .inner; |
| 185 | 추가: pointer(&response); | |
| 173 | 186 | focus(&response); |
| 174 | 187 | response |
| 175 | 188 | } |
| 176 | 189 | |
| 177 | 190 | pub const STATUS_HEIGHT: f32 = 34.0; |
| 178 | 191 | |
| 179 | 삭제: /// 파일 목록 행 배경. 선택한 행은 마우스를 올려도 선택 색을 유지하고, | |
| 180 | 삭제: /// 선택하지 않은 행에 마우스를 올리면 더 옅은 파란색을 칠함. | |
| 192 | 추가: /// 파일 목록 행 배경. 선택한 행에 마우스를 올리면 선택 색보다 진하게, | |
| 193 | 추가: /// 선택하지 않은 행에 마우스를 올리면 선택 색보다 옅게 칠함. | |
| 181 | 194 | pub fn row_background(ui: &egui::Ui, rect: egui::Rect, selected: bool, hovered: bool) { |
| 182 | 삭제: let fill = if selected { | |
| 195 | 추가: let fill = if selected && hovered { | |
| 196 | 추가: ROW_SELECTED_HOVER | |
| 197 | 추가: } else if selected { | |
| 183 | 198 | ROW_SELECTED |
| 184 | 199 | } else if hovered { |
| 185 | 200 | ROW_HOVER |
| @@ -599,6 +614,7 @@ pub fn tool( | ||
| 599 | 614 | galley, |
| 600 | 615 | color, |
| 601 | 616 | ); |
| 617 | 추가: pointer(&response); | |
| 602 | 618 | focus(&response); |
| 603 | 619 | response |
| 604 | 620 | } |
| @@ -635,6 +651,7 @@ pub fn flat_icon_button( | ||
| 635 | 651 | asset, |
| 636 | 652 | if enabled { TEXT } else { MUTED }, |
| 637 | 653 | ); |
| 654 | 추가: pointer(&response); | |
| 638 | 655 | focus(&response); |
| 639 | 656 | response |
| 640 | 657 | } |
| @@ -655,6 +672,7 @@ pub fn icon_button(ui: &mut egui::Ui, name: &str, asset: &str, enabled: bool) -> | ||
| 655 | 672 | asset, |
| 656 | 673 | if enabled { TEXT } else { MUTED }, |
| 657 | 674 | ); |
| 675 | 추가: pointer(&response); | |
| 658 | 676 | focus(&response); |
| 659 | 677 | response |
| 660 | 678 | } |
| @@ -160,6 +160,7 @@ fn window_button(ui: &mut egui::Ui, id: &str, rect: Rect, glyph: Glyph) -> egui: | ||
| 160 | 160 | ) |
| 161 | 161 | .on_hover_text(label); |
| 162 | 162 | response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, label)); |
| 163 | 추가: theme::pointer(&response); | |
| 163 | 164 | let painter = ui.painter(); |
| 164 | 165 | if response.hovered() || response.is_pointer_button_down_on() { |
| 165 | 166 | let fill = if glyph == Glyph::Close { |
| @@ -193,11 +193,13 @@ fn retry_of_encrypted_creation_reopens_create_window_for_password() { | ||
| 193 | 193 | |
| 194 | 194 | /// 주어진 세로 위치를 덮는 목록 행 배경색(선택/마우스 올림 색 중)을 찾음. |
| 195 | 195 | fn row_fill_at(output: &egui::FullOutput, y: f32) -> Option<egui::Color32> { |
| 196 | 삭제: use zipelo_ui_memory_app::archive_theme::{ROW_HOVER, ROW_SELECTED}; | |
| 196 | 추가: use zipelo_ui_memory_app::archive_theme::{ROW_HOVER, ROW_SELECTED, ROW_SELECTED_HOVER}; | |
| 197 | 197 | fn walk(shape: &egui::epaint::Shape, y: f32, found: &mut Option<egui::Color32>) { |
| 198 | 198 | match shape { |
| 199 | 199 | egui::epaint::Shape::Rect(rect) |
| 200 | 삭제: if (rect.fill == ROW_SELECTED || rect.fill == ROW_HOVER) | |
| 200 | 추가: if (rect.fill == ROW_SELECTED | |
| 201 | 추가: || rect.fill == ROW_HOVER | |
| 202 | 추가: || rect.fill == ROW_SELECTED_HOVER) | |
| 201 | 203 | && rect.rect.top() <= y |
| 202 | 204 | && y <= rect.rect.bottom() => |
| 203 | 205 | { |
| @@ -241,7 +243,7 @@ fn hover(ctx: &egui::Context, app: &mut ArchiveApp, label: &str) -> egui::FullOu | ||
| 241 | 243 | |
| 242 | 244 | #[test] |
| 243 | 245 | fn create_list_click_selects_and_hover_uses_lighter_blue() { |
| 244 | 삭제: use zipelo_ui_memory_app::archive_theme::{ROW_HOVER, ROW_SELECTED}; | |
| 246 | 추가: use zipelo_ui_memory_app::archive_theme::{ROW_HOVER, ROW_SELECTED, ROW_SELECTED_HOVER}; | |
| 245 | 247 | let scratch = Folder::new(); |
| 246 | 248 | let factory = FakeFactory::default(); |
| 247 | 249 | let (mut app, ctx) = create_from_folder(&scratch, &factory); |
| @@ -253,16 +255,17 @@ fn create_list_click_selects_and_hover_uses_lighter_blue() { | ||
| 253 | 255 | let output = hover(&ctx, &mut app, "trip"); |
| 254 | 256 | assert_eq!(row_fill_at(&output, a), Some(ROW_SELECTED)); |
| 255 | 257 | assert_eq!(row_fill_at(&output, trip), Some(ROW_HOVER)); |
| 256 | 삭제: // 선택한 행에 마우스를 올려도 더 옅어지지 않음. | |
| 258 | 추가: // 선택한 행에 마우스를 올리면 선택 색보다 진해짐 (덜 투명함). | |
| 257 | 259 | let output = hover(&ctx, &mut app, "a.txt"); |
| 258 | 삭제: assert_eq!(row_fill_at(&output, a), Some(ROW_SELECTED)); | |
| 260 | 추가: assert_eq!(row_fill_at(&output, a), Some(ROW_SELECTED_HOVER)); | |
| 259 | 261 | assert_eq!(row_fill_at(&output, trip), None); |
| 260 | 262 | assert!(ROW_HOVER.a() < ROW_SELECTED.a()); |
| 263 | 추가: assert!(ROW_SELECTED.a() < ROW_SELECTED_HOVER.a()); | |
| 261 | 264 | } |
| 262 | 265 | |
| 263 | 266 | #[test] |
| 264 | 삭제: fn main_list_hover_uses_lighter_blue_and_selected_row_keeps_its_color() { | |
| 265 | 삭제: use zipelo_ui_memory_app::archive_theme::{ROW_HOVER, ROW_SELECTED}; | |
| 267 | 추가: fn main_list_hover_uses_lighter_blue_and_selected_row_gets_stronger() { | |
| 268 | 추가: use zipelo_ui_memory_app::archive_theme::{ROW_HOVER, ROW_SELECTED, ROW_SELECTED_HOVER}; | |
| 266 | 269 | let scratch = Folder::new(); |
| 267 | 270 | let factory = FakeFactory::default(); |
| 268 | 271 | let mut app = loaded(&scratch, &factory); |
| @@ -273,5 +276,58 @@ fn main_list_hover_uses_lighter_blue_and_selected_row_keeps_its_color() { | ||
| 273 | 276 | assert_eq!(row_fill_at(&output, y), Some(ROW_HOVER)); |
| 274 | 277 | policy_click(&ctx, &mut app, name); |
| 275 | 278 | let output = hover(&ctx, &mut app, name); |
| 279 | 추가: assert_eq!(row_fill_at(&output, y), Some(ROW_SELECTED_HOVER)); | |
| 280 | 추가: // 마우스를 치우면 선택 색만 남음 (마우스 상태는 다음 프레임에 반영됨). | |
| 281 | 추가: frame_output(&ctx, &mut app, vec![egui::Event::PointerGone]); | |
| 282 | 추가: let output = frame_output(&ctx, &mut app, vec![]); | |
| 276 | 283 | assert_eq!(row_fill_at(&output, y), Some(ROW_SELECTED)); |
| 277 | 284 | } |
| 285 | 추가: | |
| 286 | 추가: fn cursor_over(ctx: &egui::Context, app: &mut ArchiveApp, point: egui::Pos2) -> egui::CursorIcon { | |
| 287 | 추가: frame_output(ctx, app, vec![egui::Event::PointerMoved(point)]); | |
| 288 | 추가: frame_output(ctx, app, vec![egui::Event::PointerMoved(point)]) | |
| 289 | 추가: .platform_output | |
| 290 | 추가: .cursor_icon | |
| 291 | 추가: } | |
| 292 | 추가: | |
| 293 | 추가: #[test] | |
| 294 | 추가: fn clickable_buttons_and_rows_show_pointing_hand_cursor() { | |
| 295 | 추가: let scratch = Folder::new(); | |
| 296 | 추가: let factory = FakeFactory::default(); | |
| 297 | 추가: let mut app = loaded(&scratch, &factory); | |
| 298 | 추가: let ctx = egui::Context::default(); | |
| 299 | 추가: let at = |ctx: &egui::Context, app: &mut ArchiveApp, label: &str| { | |
| 300 | 추가: policy_render(ctx, app, vec![]) | |
| 301 | 추가: .iter() | |
| 302 | 추가: .rev() | |
| 303 | 추가: .find(|(text, _)| text == label) | |
| 304 | 추가: .unwrap_or_else(|| panic!("항목 없음: {label}")) | |
| 305 | 추가: .1 | |
| 306 | 추가: }; | |
| 307 | 추가: for label in ["열기", "압축하기", "읽어주세요.txt"] { | |
| 308 | 추가: let point = at(&ctx, &mut app, label); | |
| 309 | 추가: assert_eq!( | |
| 310 | 추가: cursor_over(&ctx, &mut app, point), | |
| 311 | 추가: egui::CursorIcon::PointingHand, | |
| 312 | 추가: "{label}" | |
| 313 | 추가: ); | |
| 314 | 추가: } | |
| 315 | 추가: // 목록의 빈 곳(끌어서 선택하는 영역)과 검색 입력란은 손 모양이 아님. | |
| 316 | 추가: let row = at(&ctx, &mut app, "읽어주세요.txt"); | |
| 317 | 추가: let empty = row + egui::vec2(0.0, 200.0); | |
| 318 | 추가: assert_eq!(cursor_over(&ctx, &mut app, empty), egui::CursorIcon::Default); | |
| 319 | 추가: let search = at(&ctx, &mut app, "파일 검색"); | |
| 320 | 추가: assert_ne!(cursor_over(&ctx, &mut app, search), egui::CursorIcon::PointingHand); | |
| 321 | 추가: | |
| 322 | 추가: // ZIP 만들기 창의 체크박스와 항목도 손 모양. | |
| 323 | 추가: let create_scratch = Folder::new(); | |
| 324 | 추가: let (mut app, ctx) = create_from_folder(&create_scratch, &FakeFactory::default()); | |
| 325 | 추가: for label in ["암호로 보호하기", "a.txt", "취소"] { | |
| 326 | 추가: let point = at(&ctx, &mut app, label); | |
| 327 | 추가: assert_eq!( | |
| 328 | 추가: cursor_over(&ctx, &mut app, point), | |
| 329 | 추가: egui::CursorIcon::PointingHand, | |
| 330 | 추가: "{label}" | |
| 331 | 추가: ); | |
| 332 | 추가: } | |
| 333 | 추가: } |