Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9018: Dashboard - Zoom in/out on maps connected to a 3D map #10460

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mahmoudadel54
Copy link
Contributor

Description

This PR includes fixing the inconsistently issue of zoom in/out that happens in 3d map sync with another map [2d or 3d].
The issue in 3D maps was that dependenciesToMapProp.js file updates center and zoom for map object into widgets state for the synced maps, and due that update _updateMapPositionFromNewProps method into Map.js of cesium is called to update the map view.
The issue was in these lines:

const position = {
destination: Cesium.Cartesian3.fromDegrees(
newProps.viewerOptions?.cameraPosition?.longitude ?? newProps.center.x,
newProps.viewerOptions?.cameraPosition?.latitude ?? newProps.center.y,
newProps.viewerOptions?.cameraPosition?.height ?? this.getHeightFromZoom(newProps.zoom ?? 0)
),
orientation: newProps.viewerOptions?.orientation
};

It does not take the new props of center that was updated within dependenciesToMapProp as mentioned above.

I have added 2 enhancements:

  • absolute the substitute value here:
    return a.toFixed(12) - b.toFixed(12) <= 0.000000000001;

    as during test I tried to move from a point with negative coordinates to a point with positive coordinates and vice versa so if the result with negative value, the logic of isNearlyEqual will not be accurate as expected.
  • adding round to zoom values as in some cases the calculated zoom level from height adds a very small tolerance to the zoom level like: zoom = 6, the calculated zoom level = 6.0000008 which will update the view unnecessarily and actually this was my first try to fix the issue mentioned into the demo issue.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

#9018

What is the current behavior?
#9018

What is the new behavior?
Now the zoom restriction that seems in the issue is fixed

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

…3D map

Description:
- fix inconsistently issue of zoom in/out that happens in 3d map sync with another map [2d or 3d]
…3D map

Description:
- remove unnecessary line space
@mahmoudadel54 mahmoudadel54 added enhancement Internal BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch 3D All issues related to the 3D rendering in CesiumJs labels Jul 8, 2024
@mahmoudadel54 mahmoudadel54 added this to the 2024.02.00 milestone Jul 8, 2024
@mahmoudadel54 mahmoudadel54 self-assigned this Jul 8, 2024
@tdipisa tdipisa linked an issue Jul 8, 2024 that may be closed by this pull request
6 tasks
@tdipisa tdipisa removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jul 24, 2024
Copy link
Contributor

@allyoucanmap allyoucanmap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mahmoudadel54 @tdipisa I did a local test with this implementation and there are still problems with the zoom, see video below:

dashboard-zoom.mp4

I've also investigated on the reason of this behaviour and I noticed that the camera event moveEnd it's triggered twice everytime a view has been changed on 3D map, unfortunately I was not able to find the reason of this and I think additional time is needed to understand the problem and find a proper solution.
For the moment we could keep the hardening done on center and zoom.

Comment on lines -506 to +508
newProps.viewerOptions?.cameraPosition?.longitude ?? newProps.center.x,
newProps.viewerOptions?.cameraPosition?.latitude ?? newProps.center.y,
newProps.viewerOptions?.cameraPosition?.height ?? this.getHeightFromZoom(newProps.zoom ?? 0)
newProps.mapStateSource !== this.props.id ? newProps?.center?.x ?? newProps.viewerOptions?.cameraPosition?.longitude : newProps.viewerOptions?.cameraPosition?.longitude ?? newProps.center.x,
newProps.mapStateSource !== this.props.id ? newProps?.center?.y ?? newProps.viewerOptions?.cameraPosition?.latitude : newProps.viewerOptions?.cameraPosition?.latitude ?? newProps.center.y,
newProps.mapStateSource !== this.props.id ? this.getHeightFromZoom(newProps.zoom ?? 0) ?? newProps.viewerOptions?.cameraPosition?.height : newProps.viewerOptions?.cameraPosition?.height ?? this.getHeightFromZoom(newProps.zoom ?? 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore this to the previous arguments, if we want to propertly control the camera direction we will need to include the viewerOptions property to the widgets dependecies.

Copy link
Contributor

@allyoucanmap allyoucanmap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to add request changes
see #10460 (review)

@tdipisa
Copy link
Member

tdipisa commented Jul 29, 2024

@mahmoudadel54 let's keep this on hold for a moment. Wait for my feedback, please. Thank you @allyoucanmap.

@tdipisa tdipisa modified the milestones: 2024.02.00, 2024.02.01 Oct 2, 2024
@tdipisa tdipisa added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3D All issues related to the 3D rendering in CesiumJs BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch enhancement Internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard - Zoom in/out on maps connected to a 3D map
3 participants