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

SVG Scaling issue x and y values flipped. #93

Closed
windmite opened this issue Jun 18, 2024 · 0 comments · Fixed by #94
Closed

SVG Scaling issue x and y values flipped. #93

windmite opened this issue Jun 18, 2024 · 0 comments · Fixed by #94
Assignees

Comments

@windmite
Copy link
Contributor

windmite commented Jun 18, 2024

Environment

  • Python version: 3.10.12
  • Nautobot version: 2.0.0
  • nautobot-floor-plan version: 2.1.0

What did you expect to happen?
When using Floor plan with large Y values the SVG should fill the width of the current window but leave enough vertical height to scroll down.

What happened instead?
Super tiny SVG that isn't really usable. Found the problem in nautobot_floor_plan/templates/nautobot_floor_plan/inc/floorplan_svg.html line 16:
style="position: relative; height: 0; width: 100%; padding: 0; padding-bottom: calc(100% * ({{ floor_plan.x_size}} * {{ floor_plan.tile_depth }}) / ({{ floor_plan.y_size }} * {{ floor_plan.tile_width }}) / 2);">

The padding-bottom hack is (width percent) times (height divided by width) Changed to:
style="position: relative; height: 0; width: 100%; padding: 0; padding-bottom: calc(100% * ({{ floor_plan.y_size}} * {{ floor_plan.tile_depth }}) / ({{ floor_plan.x_size }} * {{ floor_plan.tile_width }}) / 1.2);">

Will submit as a PR shortly.

I also changed the 2 to 1.2 which seems to work and look better imo.

Steps to Reproduce

  1. Create new floor plan
  2. Set X to 10 and Y to 30
  3. Observe the tiny SVG
Screenshot 2024-06-18 at 3 26 47 AM
@glennmatthews glennmatthews linked a pull request Jun 18, 2024 that will close this issue
joewesch added a commit that referenced this issue Jun 18, 2024
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 a pull request may close this issue.

1 participant