pgf-umlsd icon indicating copy to clipboard operation
pgf-umlsd copied to clipboard

distance between threads

Open GoogleCodeExporter opened this issue 9 years ago • 11 comments

define the edge distance for threads too and not only for instances.

Original issue reported on code.google.com by [email protected] on 15 Sep 2011 at 5:38

GoogleCodeExporter avatar May 07 '15 08:05 GoogleCodeExporter

[deleted comment]

GoogleCodeExporter avatar May 07 '15 08:05 GoogleCodeExporter

% new an instance thread
% Example:
% \newthread[edge distance]{var}{thread name}
\newcommand{\newthread}[3][0.2]{
  \newinst[#1]{#2}{#3}
  \stepcounter{threadnum}
  \node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {};
  \tikzstyle{threadcolor\thethreadnum}=[fill=gray!30]
  \tikzstyle{instcolor#2}=[fill=gray!30]
}

Original comment by [email protected] on 11 Apr 2012 at 1:28

GoogleCodeExporter avatar May 07 '15 08:05 GoogleCodeExporter

If we could choose the distance AND the color it would be perfect.

Original comment by [email protected] on 14 Jul 2012 at 8:44

GoogleCodeExporter avatar May 07 '15 08:05 GoogleCodeExporter

This would be great to have! :)

ebousse avatar Feb 11 '17 09:02 ebousse

my workaround was this

\begin{sequencediagram}
\newthread{P1}{P1}
\tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P1]
\newthread{P2}{P2}
\tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P2]
\newthread{P3}{P3}
\end{sequencediagram}

which works, but isn't that great.

golvok avatar Feb 15 '17 04:02 golvok

my workaround was this

\begin{sequencediagram}
\newthread{P1}{P1}
\tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P1]
\newthread{P2}{P2}
\tikzstyle{inststyle}+=[below right=-0.85cm and 2cm of P2]
\newthread{P3}{P3}
\end{sequencediagram}

which works, but isn't that great.

for everyone else wondering about Unknown operator `a' or `an' errors: also add \usetikzlibrary{positioning} to your document

muryoutaisuu avatar Sep 30 '18 17:09 muryoutaisuu

% new an instance thread
% Example:
% \newthread[edge distance]{var}{thread name}
\newcommand{\newthread}[3][0.2]{
  \newinst[#1]{#2}{#3}
  \stepcounter{threadnum}
  \node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {};
  \tikzstyle{threadcolor\thethreadnum}=[fill=gray!30]
  \tikzstyle{instcolor#2}=[fill=gray!30]
}

Original comment by [email protected] on 11 Apr 2012 at 1:28

Derived from this I've also added a color option:

% new command for adding a distance option for threads as well
% \newthread[color][distance]{id}{title}
\RequirePackage{xargs}
\renewcommandx{\newthread}[4][1=gray!30, 2=0.2]{
  \newinst[#2]{#3}{#4}
  \stepcounter{threadnum}
  \node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {};
  \tikzstyle{threadcolor\thethreadnum}=[fill=#1]
  \tikzstyle{instcolor#3}=[fill=#1]
}

white-gecko avatar Oct 19 '18 12:10 white-gecko

I'm also wondering why this isn't possible yet

Tvde1 avatar Nov 12 '18 12:11 Tvde1

would be great to have it!

yegor256 avatar May 03 '20 07:05 yegor256

Surely, it seems quite essential.

debasish-raychawdhuri avatar Sep 17 '20 07:09 debasish-raychawdhuri

#33 I've tried this, and this is working, thank you :D you just made my day

timothyt87 avatar Dec 09 '20 11:12 timothyt87