Skip to content

Commit

Permalink
Fix visualization closing when cmd shortcut is pressed (#7798)
Browse files Browse the repository at this point in the history
Fixes #7457

The issue was caused by the FRP logic that assumed we wanted to close the preview even if it wasn't opened in the first place.

https://github.com/enso-org/enso/assets/6566674/ceb4996b-c878-4ff1-8bca-7d2a0b817769
  • Loading branch information
vitvakatu authored Sep 13, 2023
1 parent 9fdcfc0 commit 51491c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/gui/view/graph-editor/src/component/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,9 @@ impl Node {
frp::extend! { network
output_hover <- model.output.on_port_hover.map(|s| s.is_on());
visualization_hover <- bool(&model.visualization.on_event::<mouse::Out>(), &model.visualization.on_event::<mouse::Over>());
hovered_for_preview <- output_hover || visualization_hover;
is_preview <- visualization.view_state.map(|s| s.is_preview());
preview_hover <- visualization_hover.gate(&is_preview);
hovered_for_preview <- output_hover || preview_hover;
// The debounce is needed for a case where user moves mouse cursor from output port to
// visualization preview. Moving out of the port make `output_hover` emit `false`,
// making `hovered_for_preview` false for a brief moment - and that moment would cause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,16 @@ impl ViewState {
)
}

/// Indicates whether the visualization is fullscreen mode.
/// Indicates whether the visualization is in fullscreen mode.
pub fn is_fullscreen(&self) -> bool {
matches!(self, ViewState::Fullscreen)
}

/// Indicates whether the visualization is in preview mode.
pub fn is_preview(&self) -> bool {
matches!(self, ViewState::Preview { .. })
}

/// Return a new state after considering (lack of) presence of the error.
pub fn error_status_updated(mut self, new_has_error: bool) -> Self {
if let Self::Enabled { has_error } | Self::Preview { has_error } = &mut self {
Expand Down

0 comments on commit 51491c1

Please sign in to comment.