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

allow sloped/transform shape with non-identity transformation #1287

Closed
wants to merge 8 commits into from
3 changes: 3 additions & 0 deletions doc/generic/pgf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed

- Typo in animations `end on` key #1273
- `sloped` should consider the current transformation #1058

### Changed

Expand All @@ -22,8 +23,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Andreas Deininger
- Matthias Hetzenberger
- muzimuzhi
- Qrrbrbirlbel
- quark67
- thinbold
- Yukai Chou (muzimuzhi)
Copy link
Member

@muzimuzhi muzimuzhi Oct 21, 2023

Choose a reason for hiding this comment

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

I was already listed on line 30. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, I didn't realize that. The recent update only had your nickname so I didn't even scan past the m


## [3.1.10] - 2023-01-13 Henri Menke
Expand Down
32 changes: 32 additions & 0 deletions tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@
% }
%
\def\pgftransformlineattime#1#2#3{%
\let\pgf@tempaa\pgf@pt@aa
\let\pgf@tempab\pgf@pt@ab
\let\pgf@tempba\pgf@pt@ba
\let\pgf@tempbb\pgf@pt@bb
Copy link
Member

Choose a reason for hiding this comment

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

The three pair of additions to \pgftransformlineattime, \pgftransformarcaxesattime, and \pgftransformcurveattime are so similar that maybe two new macros abstracting them correspondingly can be provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, unfortunately \pgftransformlineattime uses \pgf@xc/\pgf@yc and \pgf@x/\pgf@y isn't save to use inbetween. I would just refactor that so that it uses x/y instead of xc/yc. (Too big of a change?)

That said, there's a lot more that they have in common.

\pgf@process{#2}%
\pgf@xb=\pgf@x% xb/yb = start point
\pgf@yb=\pgf@y%
Expand All @@ -479,6 +483,14 @@
\ifpgfslopedattime%
\advance\pgf@xc by-\pgf@xb%
\advance\pgf@yc by-\pgf@yb%
\ifpgfresetnontranslationattime
\begingroup
\pgfsettransformentries{\pgf@tempaa}{\pgf@tempab}{\pgf@tempba}{\pgf@tempbb}{0pt}{0pt}%
\pgf@pos@transform{\pgf@xc}{\pgf@yc}%
\xdef\pgf@marshal{\pgf@xc=\the\pgf@xc\pgf@yc=\the\pgf@yc}%
\endgroup
\pgf@marshal
\fi
\ifpgfallowupsidedownattime%
\else%
\ifdim\pgf@xc<0pt%
Expand Down Expand Up @@ -515,6 +527,10 @@
% }

\def\pgftransformarcaxesattime#1#2#3#4#5#6{%
\let\pgf@tempaa\pgf@pt@aa
\let\pgf@tempab\pgf@pt@ab
\let\pgf@tempba\pgf@pt@ba
\let\pgf@tempbb\pgf@pt@bb
\pgfpointarcaxesattime{#1}{#2}{#3}{#4}{#5}{#6}%
\pgftransformshift{\pgfqpoint{\pgf@x}{\pgf@y}}%
\ifpgfresetnontranslationattime%
Expand All @@ -523,6 +539,12 @@
\ifpgfslopedattime%
\pgf@x=\pgf@xa%
\pgf@y=\pgf@ya%
\ifpgfresetnontranslationattime
\begingroup
\pgfsettransformentries{\pgf@tempaa}{\pgf@tempab}{\pgf@tempba}{\pgf@tempbb}{0pt}{0pt}%
\pgf@process{\pgf@pos@transform{\pgf@x}{\pgf@y}}%
\endgroup
\fi
\pgf@process{\pgfpointnormalised{}}%
\ifpgfallowupsidedownattime%
\else%
Expand Down Expand Up @@ -564,6 +586,10 @@
% }
%
\def\pgftransformcurveattime#1#2#3#4#5{%
\let\pgf@tempaa\pgf@pt@aa
\let\pgf@tempab\pgf@pt@ab
\let\pgf@tempba\pgf@pt@ba
\let\pgf@tempbb\pgf@pt@bb
\pgfpointcurveattime{#1}{#2}{#3}{#4}{#5}%
\pgftransformshift{\pgfqpoint{\pgf@x}{\pgf@y}}%
\ifpgfresetnontranslationattime%
Expand All @@ -574,6 +600,12 @@
\pgf@y=\pgf@ya%
\advance\pgf@x by-\pgf@xb%
\advance\pgf@y by-\pgf@yb%
\ifpgfresetnontranslationattime
\begingroup
\pgfsettransformentries{\pgf@tempaa}{\pgf@tempab}{\pgf@tempba}{\pgf@tempbb}{0pt}{0pt}%
\pgf@process{\pgf@pos@transform{\pgf@x}{\pgf@y}}%
\endgroup
\fi
\ifpgfallowupsidedownattime%
\else%
\ifdim\pgf@x<0pt%
Expand Down
Loading