I have a pgf shape, and I want the possibility of building it with certain keys which add optional parts to the shape. These keys are drawing the optional parts using the .code
pgfkeys parameter. The problem is that when I draw my shape in different places on the page, or with a scale
command, these optional parts do not move properly.
How can I get the optional parts to move and scale with the rest of the shape?
Here is my current code:
\documentclass{article}
\usepackage{tikz}
\makeatletter
\pgfkeys{/tikz/east/.code={
\color{#1}
\pgfpathcircle{\pgfpoint{1cm}{0cm}}{0.1cm}
\pgfusepath{fill}}
}
\pgfkeys{/tikz/east/.default=black}
\pgfdeclareshape{my circle}{
\savedanchor\centerpoint{
\pgf@x=0pt
\pgf@y=0pt
}
\anchor{center}{\centerpoint}
\foregroundpath{
\pgfpathcircle{\pgfpoint{0cm}{0cm}}{1cm}
\pgfusepath{stroke}
}
}
\makeatother
\begin{document}
\[
\begin{tikzpicture}
\node [my circle, scale=1, east=blue] at (0cm,1cm) {};
\end{tikzpicture}
\]
\end{document}
Here I am passing the parameter "east=blue", which is supposed to draw a little blue blob on the east side of my circle. I'm drawing the node at (0cm,1cm), but the little blue blob is drawn as if the circle was centred at (0cm,0cm). Here is the output:
The desired output would be for the little blob to be drawn at the easternmost point of the circle shape, regardless of the coordinates the shape is drawn at, and use of the scale
and rotate
commands.
backgroundpath
macro to detect which keys have been passed, and with what arguments. I have tried for hours to do that without success - maybe someone else knows how?