summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex')
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex66
1 files changed, 64 insertions, 2 deletions
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex
index 7cd5baff47..47fab3e5a5 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex
@@ -3242,7 +3242,9 @@
%% Push Button
\pgfcircdeclarebipolescaled{switches}
-{}
+{
+ \anchor{tip}{\northeast\pgf@x=0pt\relax}
+}
{\ctikzvalof{bipoles/pushbutton/height 2}}
{pushbutton}
{\ctikzvalof{bipoles/pushbutton/height}}
@@ -3263,7 +3265,9 @@
%% Normally closed Push Button
\pgfcircdeclarebipolescaled{switches}
-{}
+{
+ \anchor{tip}{\northeast\pgf@x=0pt\relax}
+}
{\ctikzvalof{bipoles/pushbutton/height 2}}
{ncpushbutton}
{\ctikzvalof{bipoles/pushbutton/height}}
@@ -3284,6 +3288,64 @@
\pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
\pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
}
+%% Push Button (normally closed but now open :-) see
+%% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299
+\pgfcircdeclarebipolescaled{switches}
+{
+ \anchor{tip}{
+ \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
+ \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
+ \pgf@x=0pt\relax
+ }
+}
+{\ctikzvalof{bipoles/pushbutton/height 2}}
+{pushbuttonc}
+{\ctikzvalof{bipoles/pushbutton/height}}
+{\ctikzvalof{bipoles/pushbutton/width}}
+{
+ \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
+ \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
+ \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
+ \pgfusepath{draw}
+
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+ \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+}
+
+%% Normally closed Push Button now open
+\pgfcircdeclarebipolescaled{switches}
+{
+ \anchor{tip}{
+ \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
+ \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
+ \pgf@x=0pt\relax
+ }
+}
+{\ctikzvalof{bipoles/pushbutton/height 2}}
+{ncpushbuttono}
+{\ctikzvalof{bipoles/pushbutton/height}}
+{\ctikzvalof{bipoles/pushbutton/width}}
+{
+ \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ % Warning, if the nodes will have a class, we have to touch this.
+ \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}}
+ \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}}
+ \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
+ \pgfusepath{draw}
+ %
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+ \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
+ \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+}
%%% reed switches
\pgfcircdeclarebipolescaled{switches}
{}