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

Feature/fbfw 53 device viewports and more #15

Merged
merged 5 commits into from
Feb 11, 2022

Conversation

bryancodazen
Copy link

@bryancodazen bryancodazen commented Feb 10, 2022

Changes

  1. Added d3.js library which contains a powerful API for visualizations in SVG. https://github.com/d3/d3/blob/main/API.md
  2. Added zooming and panning
  3. Zoom into cursor location. For example if the user is hovering over a specific territory and they zoom it will zoom into that territory.
  4. Constrain panning to be within the SVG limits. This means the user cannot pan outside of the map and will hit a 'boundary' which will keep the user immersed in the game.
  5. Added device calculations in WDMain and the web dip theme which calculate what device the viewport is based on the mock choices:
  • mobile - 375 x 667
  • mobileLandscape - 667 x 375
  • mobileLg - 414 x 896
  • mobileLgLandscape - 896 x 414
  • tablet - 834 x 1194
  • tabletLandscape - 1194 x 834
  • desktop >= 1500 width
  1. Added debounced viewport event listener which will capture screen changes (height or width) and re-adjust the map. For example, if the user switches from portrait view to landscape view this will re-adjust the map scales and center the map to approximate the mocks.
  2. Zooming constraints based on device.
  3. Added debounce function as a util

Test Plan

  1. Run the docker harness and go to localhost/beta
  2. Test the zooming and panning. Check to see that zoom is limited, zooms into cursor location, panning is constrained to the map. https://drive.google.com/file/d/1MPlcX0C3O1d4i7IGfa4D15IXhWo0HE6-/view?usp=sharing
  3. Test the various device dimensions using the developer console. Simulate screen rotation and verify the correct device type is showing.

Screen Shot 2022-02-09 at 5 41 21 PM

https://drive.google.com/file/d/1Q2hVA_yXlM9jrq3RaSRP5EOmjwHY-sE4/view?usp=sharing

  1. Check that there are no console errors when zooming and panning.
  2. Try to break the functionality, try to trigger errors.
  3. Check widths and heights outside of the specified widths and heights of the mocks. E.g user has a device that is 375 x 300, etc.

Bryan Fajardo added 4 commits February 5, 2022 19:41
…webDiplomacy into feature/fbfw-28-mui-dialog
…hich has a powerful API to help us control the SVG. Added panning and zooming ability as well as boundaries so that the user can only navigate within the map. When adjusting the viewport (such as during a resize or when tilting your phone) there is a debounced function which will adjust the map and associated scales and values. Every device has zooming limits and initial zooms to approximate the mocks. Did a quick breakup of the SVG currently being used into components (these are not meant to be the final components for breaking up the SVG).
beta/asset-manifest.json Outdated Show resolved Hide resolved
…ok. Made Device an enum. Removed redundant preserveAspectRatio from SVG. Removed shadow-off and added eslint-typescript shadow off rule.
Copy link

@nebevets nebevets left a comment

Choose a reason for hiding this comment

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

LGTM, my only concern is the eslintrc changes.

};

return [viewport, setViewport];
}

Choose a reason for hiding this comment

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

cool

beta-src/.eslintrc.json Show resolved Hide resolved
@bryancodazen bryancodazen merged commit c0e7911 into staging Feb 11, 2022
@bryancodazen bryancodazen deleted the feature/fbfw-53-device-viewports-and-more branch May 31, 2022 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants