Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Adjust defaults new map defaults #1113

Open
2 tasks
badnames opened this issue Dec 9, 2023 · 7 comments · May be fixed by #1302
Open
2 tasks

Adjust defaults new map defaults #1113

badnames opened this issue Dec 9, 2023 · 7 comments · May be fixed by #1302
Assignees
Labels
enhancement New feature or request

Comments

@badnames
Copy link
Member

badnames commented Dec 9, 2023

Tasks

  • Map geometry should be visible right after the user opens a new map (adjust its initial size and/or initial map zoom)
  • Consider using a lower initial resolution for new background images.

Use case

No response

Related Pull request

No response

@badnames badnames added the enhancement New feature or request label Dec 9, 2023
@badnames badnames mentioned this issue Dec 9, 2023
24 tasks
@markus2330
Copy link
Contributor

Map geometry should be visible right after the user opens a new map (adjust its initial size and/or initial map zoom)

👍

Consider using a lower initial resolution for new background images.

Could you please elaborate? It is the users choice which images are used? Do you mean automatic downsampling?

@andreicristian97
Copy link
Contributor

After analyzing this issue, I see two possible ways to approach the problem:

  1. Adjust the current values we use when creating the default polygon of a map, to have the whole bounding box in view by default. (from -5000/5000 to something smaller that would be in view)
    • Advantages: quick fix
    • Disadvantages: it only fixes this issue in the context of loading a new map; an existing map will not be guaranteed fully in view when loaded
  2. Change how the "view rectangle" is calculated when loading a map (as opposed to the current "fixed" value), to ensure that the existing map bounding box is fully in view.
    • Advantages: a more universal solution that would improve the user experience of loading a map in general
    • Disadvantages: requires a more significant change (and support from someone who knows the code related to map object positions better)

@markus2330 What is your opinion? Should we, for now, implement option 1 and have a new issue for option 2 to be done later? Or work on option 2 right away?

@markus2330
Copy link
Contributor

Thx @andreicristian97 good analysis!

Nr 1. should be enough. Rationale: we want to remember the last viewing state of the user. So the default viewing state is only relevant when a user sees an map the first time. For later times, the old viewing state gets remembered.

@andreicristian97
Copy link
Contributor

Ok, with this in mind, we have two ways we can proceed based on how the map is currently set up by default. Currently, the default view of the map is with the (0, 0) point in the top left of the map, with the Viewing rectangle calculated around that.

  1. We keep this default view rectangle, we scale down the polygon and move it towards negative x and y values to be included in this default view. Problem with this: images are then still placed with their center at (0, 0) so it might create confusion to the user.

  2. We scale the polygon down but keep it at (0, 0), and we change the default view rectangle to have this point centered on the visible part of the map. This calculation would have to take into account the current window width/height + the width or height of Toolbar/Navbar/Timeline , to figure out the actual size of the map. This calculation might need some hardcoded values regarding those widths/heights.

I have a working solution for option 2, but I am not happy that it uses hardcoded values. Not sure how to write this calculation otherwise. I will publish a PR now with that code, I will explain there the calculation.

@andreicristian97 andreicristian97 linked a pull request Apr 18, 2024 that will close this issue
27 tasks
@markus2330
Copy link
Contributor

Why is the algorithm different to zooming out and panning? Or did I misunderstand?

@andreicristian97
Copy link
Contributor

Why is the algorithm different to zooming out and panning? Or did I misunderstand?

I'm not sure I understand the question.
Actions on zooming and panning were not changed, only the default values we give to the stage and the view rectangle are changed in the PR.

@markus2330
Copy link
Contributor

I mean why not give default values that are equivalent to when the user would have zoomed out+panned to see the whole border rectangle (of the base layer) in the visible window?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants