Dimchikkk / velo

App for brainstorming & sharing ideas 🦀 Learning Project
Apache License 2.0
320 stars 27 forks source link

Window resizing seems clean the document #129

Closed piaoger closed 1 year ago

piaoger commented 1 year ago

How to reproduce:

  1. Draw some random things
  2. Resize window by double clicking title bar or dragging corner.
  3. The things are disappeared..
Dimchikkk commented 1 year ago

Thanks for reporting.

Resizing is not really cleaning the document, more like nodes just going out from viewport.

I am not exactly sure how tackle it for now, so any ideas/help are welcome.

There is a function that called on resize: https://github.com/StaffEngineer/velo/blob/main/src/ui_plugin/systems/resize_window.rs

Position of nodes updated in https://github.com/StaffEngineer/velo/blob/main/src/ui_plugin/systems/update_rectangle_position.rs by setting left and bottom values.

piaoger commented 1 year ago

Resizing is not really cleaning the document, more like nodes just going out from viewport. Yes, what I mean "clean" is just not in viewport anymore. Can you reproduce it? I tried velo a couple of days again and it works fine.

My environment is Window 11. Please let know if know need more information. @StaffEngineer

piaoger commented 1 year ago

I just commented out the lines about insert_resource and it works fine, though still not sure why inserting a new one here :) @StaffEngineer

            if let Some(active_tab) = current_doc.tabs.iter().find(|t| t.is_active) {
                // commands.insert_resource(LoadTabRequest {
                //     doc_id: current_doc.id,
                //     tab_id: active_tab.id,
                //     drop_last_checkpoint: false,
                // });
            }
Dimchikkk commented 1 year ago

@piaoger interesting.

I think this code was added for fixing arrow positions on wasm. If you comment code and run velo in browser and resize window I think position of arrows gonna be broken? If commenting code fixes the issue with disappearing nodes maybe we have to revisit approach how arrows on wasm was fixed and find another way.

Dimchikkk commented 1 year ago

@piaoger this should be fixed by https://github.com/StaffEngineer/velo/pull/153, please re-open the issue if not.