Skip to content

Commit f3636b8

Browse files
committed
Restore click logic in HistoryCard
1 parent 5ec35d1 commit f3636b8

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/chat/chat_history_card.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,6 @@ impl Widget for ChatHistoryCard {
113113
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
114114
self.view.handle_event(cx, event, scope);
115115
self.widget_match_event(cx, event, scope);
116-
117-
let store = scope.data.get_mut::<Store>().unwrap();
118-
let widget_uid = self.widget_uid();
119-
if let Hit::FingerDown(fd) = event.hits_with_capture_overload(cx, self.view.area(), true) {
120-
if fd.tap_count == 1 {
121-
cx.widget_action(
122-
widget_uid,
123-
&scope.path,
124-
ChatHistoryCardAction::ChatSelected(self.chat_id),
125-
);
126-
store.select_chat(self.chat_id);
127-
self.redraw(cx);
128-
}
129-
}
130116
}
131117

132118
fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
@@ -188,7 +174,7 @@ impl Widget for ChatHistoryCard {
188174

189175
impl WidgetMatchEvent for ChatHistoryCard {
190176
fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions, scope: &mut Scope) {
191-
//let store = scope.data.get_mut::<Store>().unwrap();
177+
let store = scope.data.get_mut::<Store>().unwrap();
192178
let widget_uid = self.widget_uid();
193179

194180
if self.button(id!(delete_chat)).clicked(actions) {
@@ -204,6 +190,18 @@ impl WidgetMatchEvent for ChatHistoryCard {
204190
);
205191
return;
206192
}
193+
194+
if let Some(fe) = self.view(id!(content)).finger_down(actions) {
195+
if fe.tap_count == 1 {
196+
cx.widget_action(
197+
widget_uid,
198+
&scope.path,
199+
ChatHistoryCardAction::ChatSelected(self.chat_id),
200+
);
201+
store.select_chat(self.chat_id);
202+
self.redraw(cx);
203+
}
204+
}
207205
}
208206
}
209207

0 commit comments

Comments
 (0)