Skip to content
Permalink
Browse files

Reverse anchor of spy node #767

Does not cover all cases, but I don't think there is a proper solution
for that.  It also can't do angles or @auto anchor.
  • Loading branch information...
hmenke committed Nov 4, 2019
1 parent 2e11f54 commit 97a18d33fb1a791df41768f1709b6e477972b1e6
@@ -97,8 +97,20 @@
\pgftransformcm{\pgf@lib@svg@a}{\pgf@lib@svg@b}{\pgf@lib@svg@c}{\pgf@lib@svg@d}{\pgfpointorigin}%
}
}]{};
\expandafter\pgfutil@switch\expandafter{\tikz@anchor}{%
{north} {\def\tikz@spy@anchor{south}}%
{north east}{\def\tikz@spy@anchor{south west}}%
{east} {\def\tikz@spy@anchor{west}}%
{south east}{\def\tikz@spy@anchor{north west}}%
{south} {\def\tikz@spy@anchor{north}}%
{south west}{\def\tikz@spy@anchor{north east}}%
{west} {\def\tikz@spy@anchor{east}}%
{north west}{\def\tikz@spy@anchor{south east}}%
% default to center
{default} {\def\tikz@spy@anchor{center}}%
}
\node [alias=tikzspyinnode,inner sep=0pt,outer sep=0pt,at={#2},every spy in node/.try,
path picture={\node[anchor=center,tikz@lib@reset@gs]{\nullfont%
path picture={\node[anchor=\tikz@spy@anchor,tikz@lib@reset@gs]{\nullfont%
\pgfpicture\relax\pgfsetbaseline{default}\pgfsettrimleft{default}\pgfsettrimright{default}%
\pgftransformreset%
\let\tikz@transform=\relax%
@@ -215,6 +215,45 @@
\let\pgfutil@repeat=\fi % this makes \loop...\if...\repeat skippable


% \pgfutil@switch
%
% #1: string to switch on
% #2: sequence of label-value pairs
%
% Example:
%
% \pgfutil@switch{foo}{%
% {foo}{1}%
% {bar}{2}%
% {default}{X}%
% }
%
% If a statement with the label `default' exists it will be executed
% if no other label matches.

\long\def\pgfutil@switch#1#2{%
\begingroup
\def\pgfutil@switch@selected{}%
\pgfutil@switch@collect@statements#2{}{}%
\ifcsname pgfutil@switch@choice@\detokenize{#1}\endcsname
\expandafter\let\expandafter\pgfutil@switch@selected\csname pgfutil@switch@choice@\detokenize{#1}\endcsname
\else
\ifdefined\pgfutil@switch@choice@default
\let\pgfutil@switch@selected\pgfutil@switch@choice@default
\fi
\fi
\expandafter\endgroup\pgfutil@switch@selected
}

\long\def\pgfutil@switch@collect@statements#1{%
\if\relax\detokenize{#1}\relax
\else
\afterassignment\pgfutil@switch@collect@statements
\expandafter\def\csname pgfutil@switch@choice@\detokenize{#1}\expandafter\endcsname
\fi
}


% aux-read-hook

\let\pgfutil@aux@read@hook=\relax

0 comments on commit 97a18d3

Please sign in to comment.
You can’t perform that action at this time.