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

final decoration state uses wrong coordinate transformation when remaining length is 0 #1337

Open
schtandard opened this issue Jun 7, 2024 · 0 comments

Comments

@schtandard
Copy link
Contributor

schtandard commented Jun 7, 2024

Brief outline of the bug

When previous states have exactly used up the length of the decorated path, the coordinate transformation of the final state is the one belonging to the first state (usually initial). When there is some length remaining, the transformation is correct.

\pgfpointdecoratedpathlast is correct in both cases, which is probably why this is not an issue in the standard decorations.

Minimal working example (MWE)

Blue circles mark (0pt,0pt) in the initial state, the red circle marks (0pt,0pt) in the final state, the green circle marks \pgfpointdecoratedpathlast.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations}

\pgfdeclaredecoration{wrong final point}{initial}
  {%
    \state{initial}[width=1cm]
      {
        \pgfpathcircle{\pgfpoint{0pt}{0pt}}{1pt}
        \pgfsetstrokecolor{blue}
        \pgfusepath{stroke}
      }%
    \state{final}
      {
        \pgfpathcircle{\pgfpoint{0pt}{0pt}}{2pt}%
        \pgfsetstrokecolor{red}
        \pgfusepath{stroke}
        \pgfpathcircle{\pgfpointdecoratedpathlast}{2pt}
        \pgfsetstrokecolor{green}
        \pgfusepath{stroke}
      }%
  }

\begin{document}

\begin{tikzpicture}
  \draw [help lines] (0,-2) grid (4,1);
  \path [decorate, decoration=wrong final point] (0,0) -- ++(4,0);
  \path [decorate, decoration=wrong final point] (0,-1) -- ++(3.5,0);
\end{tikzpicture}

\end{document}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant