-
Notifications
You must be signed in to change notification settings - Fork 108
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
diamond shape: keep aspect when checking against minimum ht/wd #1042
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: muzimuzhi <muzimuzhi@gmail.com>
Hmm, pgfmanual reads "the aspect (set by pgf/doc/generic/pgf/text-en/pgfmanual-en-library-shapes.tex Lines 112 to 115 in 85d2c38
Though the relation between Therefore this PR may end in one of two ways:
|
Unfortunately, we can't do that. What we can do, however, is change the default value for |
TODO: adjust for shapes cylinder and cloud Signed-off-by: muzimuzhi <muzimuzhi@gmail.com>
Please review if the current implementation is "what we can do". If so, I will do the same for shapes Also can the aspect staff common in libs Feels like we can only add features if there's a crack in the manual wall. :) Examples, new \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\tikzset{nodes={diamond, draw}, baseline=0pt}
\def\demo#1{%
\def\tmp{#1}%
\ifx\tmp\empty default\else \texttt{#1}\fi:
\begin{tikzpicture}[style/.expanded={#1}]
\node[minimum width=50pt] {x};
\node[minimum height=50pt] at (2,0) {x};
\end{tikzpicture}
}
\demo{}\par
\demo{shape aspect=none}
\foreach \v in {1, 2, .5} {
\foreach \k in {shape aspect, aspect} {
\demo{\k=\v}\qquad
}\par
}
\end{document} |
option sets the ratio between width and height of the shape. Unlike | ||
|/pgf/aspect| which only recommends the ratio, this key ensures it. | ||
|
||
If the special value |none| is given, the ratio assurance is canceled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the special none
value? I would have just left it empty.
\ifx\pgf@lib@temp\pgf@nonetext | ||
\pgfkeys{/pgf/aspect=1}% | ||
\else | ||
\pgfkeys{/pgf/aspect=#1}% | ||
\fi | ||
\pgfkeyssetvalue{/pgf/shape aspect}{#1}% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the default was empty the code could be simplified (untested).
\ifx\pgf@lib@temp\pgf@nonetext | |
\pgfkeys{/pgf/aspect=1}% | |
\else | |
\pgfkeys{/pgf/aspect=#1}% | |
\fi | |
\pgfkeyssetvalue{/pgf/shape aspect}{#1}% | |
\pgfqkeys{/pgf}{aspect/.expanded=\pgfutil@ifxempty\pgf@lib@temp{1}{#1}}% | |
\pgfkeyssetvalue{/pgf/shape aspect}{#1}% |
Same for the other conditionals.
Motivation for this change
Currently, when a
diamond
shape is enlarged when checking againstminimum height/width
, theshape aspect
is not kept. This PR fixes the problem.Example
Checklist
Please check the boxes below and signoff your commits to explicitly
state your agreement to the Developer Certificate of Origin: