Skip to content

Commit

Permalink
Fixups for PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Procrat committed May 2, 2023
1 parent 660c16d commit 30789bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
6 changes: 2 additions & 4 deletions app/gui/src/presenter/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,9 @@ impl Model {
}

fn close_ide(&self) {
let Some(window) = web_sys::window() else { return error!("Failed to get JS Window.") };
let Some(document) = window.document() else { return error!("Failed to get JS Document.") };
match web_sys::Event::new("ide-close") {
match enso_web::Event::new("ide-close") {
Ok(event) =>
if let Err(error) = document.dispatch_event(&event) {
if let Err(error) = enso_web::document.dispatch_event(&event) {
error!("Failed to dispatch event to close IDE. {error:?}");
},
Err(error) => error!("Failed to create event to close IDE. {error:?}"),
Expand Down
15 changes: 6 additions & 9 deletions app/gui/view/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,11 @@ impl Model {
window_control_buttons.set_xy(top_left);
}
let gap = crate::graph_editor::TOP_BAR_ITEM_MARGIN;
let dashboard_button_offset_x = window_control_buttons_width + gap;
let dashboard_button_pos = top_left
+ Vector2(
dashboard_button_offset_x + dashboard_button_width / 2.0,
-TOP_BAR_HEIGHT / 2.0,
);
let dashboard_button_offset = Vector2(window_control_buttons_width + gap, 0.0);
let dashboard_button_origin = Vector2(dashboard_button_width, -TOP_BAR_HEIGHT) / 2.0;
let dashboard_button_pos = top_left + dashboard_button_offset + dashboard_button_origin;
self.dashboard_button.set_xy(dashboard_button_pos);
let top_bar_width = dashboard_button_offset_x + dashboard_button_width;
let top_bar_width = dashboard_button_offset.x + dashboard_button_width;
top_bar_width
}

Expand Down Expand Up @@ -403,7 +400,7 @@ impl View {
let searcher_open_delay = frp::io::timer::Timeout::new(network);

frp::extend! { network
init <- source::<()>();
init <- source_();
}


Expand Down Expand Up @@ -439,7 +436,7 @@ impl View {
dashboard_button_width
);
top_bar_width <- top_bar_update.map(
f!([model] ((_, scene_shape, window_control_buttons_width, dashboard_button_width))
f!(((_, scene_shape, window_control_buttons_width, dashboard_button_width))
model.relayout_top_bar(
scene_shape,
*window_control_buttons_width,
Expand Down
2 changes: 2 additions & 0 deletions lib/rust/web/src/binding/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ mock_data! { Document => EventTarget
fn create_element(&self, local_name: &str) -> Result<Element, JsValue>;
fn get_element_by_id(&self, element_id: &str) -> Option<Element>;
fn create_text_node(&self, data: &str) -> Text;
fn dispatch_event(&self, event: &Event) -> Result<bool, JsValue>;
}


Expand Down Expand Up @@ -574,6 +575,7 @@ impl AddEventListenerOptions {

// === Event ===
mock_data! { Event => Object
fn new(type_: &str) -> Result<Event, JsValue>;
fn prevent_default(&self);
fn stop_propagation(&self);
fn current_target(&self) -> Option<EventTarget>;
Expand Down

0 comments on commit 30789bd

Please sign in to comment.