I have a pic element draw headphone, it works perfect but node distance is measured from center but not border as other nodes.
\documentclass[border=2pt,convert={outfile=\jobname.png}]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}
\begin{tikzpicture}[node distance=1cm and 1cm,
box/.style = {draw, circle,minimum size=1cm,inner sep=4pt},
headphone/.pic={
\node[circle,fill={rgb,255 :red,220; green,150; blue,100},inner sep=0,anchor=center] (-outline) at (0,0) {};
\begin{scope}[x={(-outline.east)},y={(-outline.north)},scale=2]
\fill[white,rounded corners=1pt] ($(-40:.3)+(0,-0.2)$) -- ($(-40:.3)+(-0.15,-0.2)$) -- ($(-40:.3) + (-0.15,0)$) --
(-40:.3) arc [start angle=-40,end angle=220, radius=0.3] --
++ (0.15,0) --++(0,-0.2) -- ++(-0.15,0) --
(225:.35) arc [start angle=225,end angle=-45, radius=0.35] --cycle;
\draw[draw={rgb,255 :red,220; green,150; blue,100}] (-40:.325) arc [start angle=-40,end angle=220, radius=0.325];
\end{scope}}
]
\draw[help lines] (-1,-3) grid (3,1);
\node[box] (A) {A};
\node[box,right=of A] (B) {B};
\node[box,below=of B] (C) {C};
\pic[left=1cm of C,minimum size=1cm] (D) {headphone};
\end{tikzpicture}
\end{document}
It caused by the anchor=center
parameter in -outline
box, but if I remove that, the coordinate within the scope will not work.
\pic[minimum size=1cm] (D) at (A |- C) {headphone};
I think.