mirror of
https://github.com/enso-org/enso.git
synced 2024-11-24 00:27:16 +03:00
Fix zooming regression in demo scene & fix switching of the navigator in the component browser (#3646)
[ci no changelog needed] This PR fixes a [regression](https://www.pivotaltracker.com/story/show/182972359) found in the `interface` debug the scene. It was caused by multiple `Navigator`s that were present in the demo scene and conflict with each other. Also, this PR includes a fix for the invalid logic of the new component browser. We disable `Navigator` when the mouse hovers the component browser. Still, due to a mistake in the code, the component browser was considered visible at all times and therefore blocked the navigator in certain mouse positions. To reproduce this bug (before this PR): 1. Open a default project 2. Place the mouse somewhere in the middle of the screen (near one of the nodes) 3. Try panning or zooming the scene (you won't be able because of this bug)
This commit is contained in:
parent
8575b76b0a
commit
973946d585
@ -908,7 +908,9 @@ define_endpoints_2! {
|
||||
set_favourites_section(Vec<LabeledAnyModelProvider>),
|
||||
set_sub_modules_section(Vec<LabeledAnyModelProvider>),
|
||||
/// The component browser is displayed on screen.
|
||||
shown(),
|
||||
show(),
|
||||
/// The component browser is hidden from screen.
|
||||
hide(),
|
||||
}
|
||||
Output{
|
||||
selected(Option<Selected>),
|
||||
@ -930,6 +932,7 @@ impl component::Frp<Model> for Frp {
|
||||
let header_height = style.get_number(component_group_theme::header::height);
|
||||
let layout_frp = Style::from_theme(network, style);
|
||||
let scene = &app.display.default_scene;
|
||||
let input = &frp_api.input;
|
||||
let output = &frp_api.output;
|
||||
let groups = &model.groups_wrapper;
|
||||
let selection = &model.selection;
|
||||
@ -954,10 +957,11 @@ impl component::Frp<Model> for Frp {
|
||||
|
||||
eval_ model.scroll_area.viewport( model.update_scroll_viewport() );
|
||||
|
||||
is_visible <- bool(&input.hide, &input.show);
|
||||
is_hovered <- app.cursor.frp.screen_position.map(f!([model,scene](pos) {
|
||||
let pos = scene.screen_to_object_space(&model, pos.xy());
|
||||
model.is_hovered(pos.xy())
|
||||
})).on_change();
|
||||
})).gate(&is_visible).on_change();
|
||||
|
||||
on_hover <- is_hovered.on_true();
|
||||
on_hover_end <- is_hovered.on_false();
|
||||
@ -1015,7 +1019,7 @@ impl component::Frp<Model> for Frp {
|
||||
|
||||
// === Section navigator ===
|
||||
|
||||
eval_ frp_api.input.shown(model.section_navigator.select_section(Section::Favorites));
|
||||
eval_ input.show(model.section_navigator.select_section(Section::Favorites));
|
||||
|
||||
chosen_section <- model.section_navigator.chosen_section.filter_map(|s| *s);
|
||||
scroll_to_section <- all(&chosen_section, &layout_frp.update);
|
||||
|
@ -21,7 +21,6 @@ use wasm_bindgen::prelude::*;
|
||||
|
||||
use enso_frp as frp;
|
||||
use ensogl::application::Application;
|
||||
use ensogl::display::navigation::navigator::Navigator;
|
||||
use ensogl::display::object::ObjectOps;
|
||||
use ensogl::display::shape::StyleWatch;
|
||||
use ensogl::gui::text;
|
||||
@ -105,8 +104,6 @@ fn init(app: &Application) {
|
||||
|
||||
let world = &app.display;
|
||||
let scene = &world.default_scene;
|
||||
let camera = scene.camera();
|
||||
let navigator = Navigator::new(scene, &camera);
|
||||
|
||||
app.views.register::<root::View>();
|
||||
app.views.register::<project::View>();
|
||||
@ -256,7 +253,6 @@ fn init(app: &Application) {
|
||||
.on
|
||||
.before_frame
|
||||
.add(move |_| {
|
||||
let _keep_alive = &navigator;
|
||||
let _keep_alive = &root_view;
|
||||
|
||||
if to_theme_switch == 0 {
|
||||
|
@ -119,7 +119,8 @@ impl component::Frp<Model> for Frp {
|
||||
eval list_position_x ((x) model.list.set_position_x(*x));
|
||||
eval doc_position_x ((x) model.documentation.set_position_x(*x));
|
||||
|
||||
model.list.input.shown <+ any(&input.show, &init);
|
||||
model.list.input.show <+ input.show;
|
||||
model.list.input.hide <+ input.hide;
|
||||
out.is_visible <+ bool(&input.hide, &input.show);
|
||||
out.size <+ size;
|
||||
out.expression_input_position <+ all_with3(
|
||||
|
Loading…
Reference in New Issue
Block a user