Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
1408c345
Commit
1408c345
authored
Mar 22, 2020
by
Tiago Peixoto
Browse files
graph_draw(): fix fit_to_view()
parent
5c75fd6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/draw/cairo_draw.py
View file @
1408c345
...
...
@@ -1285,11 +1285,13 @@ def fit_to_view(rec, output_size, adjust_aspect=False, pad=.9):
output_size
[
0
]
=
int
(
round
(
float
(
output_size
[
1
]
*
w
/
h
)))
else
:
output_size
[
1
]
=
int
(
round
(
float
(
output_size
[
0
]
*
h
/
w
)))
else
:
x
-=
(
d
-
w
)
/
2
y
-=
(
d
-
h
)
/
2
zoom
=
min
(
output_size
[
0
]
/
w
,
output_size
[
1
]
/
h
)
*
pad
zoom
=
min
(
output_size
[
0
]
/
w
,
output_size
[
1
]
/
h
)
x
-=
(
output_size
[
0
]
/
zoom
-
w
)
/
2
y
-=
(
output_size
[
1
]
/
zoom
-
h
)
/
2
zoom
*=
pad
x
-=
(
1
-
pad
)
/
2
*
output_size
[
0
]
/
zoom
y
-=
(
1
-
pad
)
/
2
*
output_size
[
1
]
/
zoom
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment