Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for mindmap connection bar glitches #892

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,72 +17,58 @@
%
% Parameters: start radius, end radius, amplitude, angle

\newdimen\tikz@lib@mm@startflarelength
\newdimen\tikz@lib@mm@endflarelength
\pgfdeclaredecoration{circle connection bar}{initial}
{%
\state{initial}[width=0pt,next state=bar]
\state{initial}[width=0pt,next state=final]
{
\pgfmathsetlength\pgfutil@tempdimb{\pgfdecorationsegmentamplitude}%
{
\pgftransformxshift{-\pgfkeysvalueof{/pgf/decoration/start radius}}%
\pgfpathmoveto{\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}}
\pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}
\pgfutil@tempcnta=-\pgfdecorationsegmentangle\relax
\advance\pgfutil@tempcnta by90\relax
\pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/decoration/start radius}}
\pgfmathsetlength\pgfutil@tempdimb{\pgfdecorationsegmentamplitude}
\pgfpathcurveto
{\pgfpointadd
{\pgfpointpolar{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}}
{\pgfpointpolar{\the\pgfutil@tempcnta}{.25\pgfutil@tempdima}}}
{\pgfqpoint{1.25\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}
{\pgfqpoint{1.5\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}
\pgfpathlineto{\pgfpoint{1.5\pgfutil@tempdima}{.5\pgfutil@tempdimb}}
\pgfpathmoveto{\pgfpoint{\pgfutil@tempdima+1.0\tikz@lib@mm@startflarelength}{.5\pgfutil@tempdimb}}
\pgfutil@tempcnta=\pgfdecorationsegmentangle\relax
\advance\pgfutil@tempcnta by-90\relax
\pgfpathcurveto
{\pgfpoint{1.25\pgfutil@tempdima}{.5\pgfutil@tempdimb}}
{\pgfpoint{\pgfutil@tempdima+0.5\tikz@lib@mm@startflarelength}{.5\pgfutil@tempdimb}}
{\pgfpointadd
{\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}}
{\pgfpointpolar{\the\pgfutil@tempcnta}{.25\pgfutil@tempdima}}}
{\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}}
\pgfpathclose
}
}%
\state{bar}[width=0pt,next state=end]
{
\pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/decoration/start radius}}%
\pgfmathsetlength\pgfutil@tempdimb{\pgfkeysvalueof{/pgf/decoration/end radius}}%
\pgfmathsetlength\pgf@xc{\pgfdecorationsegmentamplitude}%
\pgfpathrectangle
{\pgfqpoint{.5\pgfutil@tempdima}{-.5\pgf@xc}}
{\pgfpoint{\pgfdecoratedremainingdistance+-.5\pgfutil@tempdimb+-.5\pgfutil@tempdima}{\pgf@xc}}
}%
\state{end}[width=0pt,next state=final]
{
{
\pgftransformxshift{\pgfdecoratedremainingdistance}%
\pgftransformxscale{-1}%
\pgftransformxshift{-\pgfkeysvalueof{/pgf/decoration/end radius}}%
\pgfpathmoveto{\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/end radius}}}
\pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/end radius}}
\pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}
\pgfutil@tempcnta=-\pgfdecorationsegmentangle\relax
\advance\pgfutil@tempcnta by90\relax
\pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/decoration/end radius}}
\pgfmathsetlength\pgfutil@tempdimb{\pgfdecorationsegmentamplitude}%
\pgfpathcurveto
{\pgfpointadd
{\pgfpointpolar{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/end radius}}}
{\pgfpointpolar{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/start radius}}}
{\pgfpointpolar{\the\pgfutil@tempcnta}{.25\pgfutil@tempdima}}}
{\pgfqpoint{1.25\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}
{\pgfqpoint{1.5\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}
\pgfpathlineto{\pgfpoint{1.5\pgfutil@tempdima}{.5\pgfutil@tempdimb}}
{\pgfpoint{\pgfutil@tempdima+0.5\tikz@lib@mm@startflarelength}{-.5\pgfutil@tempdimb}}
{\pgfpoint{\pgfutil@tempdima+1.0\tikz@lib@mm@startflarelength}{-.5\pgfutil@tempdimb}}
}
{
\pgftransformxshift{\pgfdecoratedremainingdistance}%
\pgftransformscale{-1}%
\pgftransformxshift{-\pgfkeysvalueof{/pgf/decoration/end radius}}%
\pgfmathsetlength\pgfutil@tempdima{\pgfkeysvalueof{/pgf/decoration/end radius}}
\pgfpathlineto{\pgfpoint{\pgfutil@tempdima+1.0\tikz@lib@mm@endflarelength}{.5\pgfutil@tempdimb}}
\pgfutil@tempcnta=\pgfdecorationsegmentangle\relax
\advance\pgfutil@tempcnta by-90\relax
\pgfpathcurveto
{\pgfpoint{1.25\pgfutil@tempdima}{.5\pgfutil@tempdimb}}
{\pgfpoint{\pgfutil@tempdima+0.5\tikz@lib@mm@endflarelength}{.5\pgfutil@tempdimb}}
{\pgfpointadd
{\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/end radius}}}
{\pgfpointpolar{\the\pgfutil@tempcnta}{.25\pgfutil@tempdima}}}
{\pgfpointpolar{\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/end radius}}}
\pgfpatharc{\pgfdecorationsegmentangle}{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/end radius}}
\pgfutil@tempcnta=-\pgfdecorationsegmentangle\relax
\advance\pgfutil@tempcnta by90\relax
\pgfpathcurveto
{\pgfpointadd
{\pgfpointpolar{-\pgfdecorationsegmentangle}{\pgfkeysvalueof{/pgf/decoration/end radius}}}
{\pgfpointpolar{\the\pgfutil@tempcnta}{.25\pgfutil@tempdima}}}
{\pgfpoint{\pgfutil@tempdima+0.5\tikz@lib@mm@endflarelength}{-.5\pgfutil@tempdimb}}
{\pgfpoint{\pgfutil@tempdima+1.0\tikz@lib@mm@endflarelength}{-.5\pgfutil@tempdimb}}
\pgfpathclose
}
}%
Expand Down Expand Up @@ -121,6 +107,33 @@
\pgf@process{\pgfpointtransformed{\pgfpointanchor{\tikztotarget}{west}}}%
\advance\pgf@xa by-\pgf@x%
\pgfkeys{/pgf/decoration/end radius/.expanded=\the\pgf@xa}%
% now compute lengths of connection bar flares
\pgfpointdiff{\pgfpointanchor{\tikztostart}{center}}%
{\pgfpointanchor{\tikztotarget}{center}}%
\pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}%
\pgf@xa=\pgfmathresult pt\relax%
\pgf@process{%
\pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/decoration/start radius}}%
\pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/decoration/end radius}}%
}%
\advance\pgf@x by\pgf@y\relax% x = sum of radii = 2 * nominal sum of flare lengths
\advance\pgf@xa by-\pgf@x\relax% xa = distance between circles = room available for flares
\pgf@x=.5\pgf@x\relax% x = nominal sum of flare lengths
\ifdim\pgf@xa>\pgf@x\relax%
\pgf@xa=\pgf@x\relax%
\fi% xa = actual sum of flare lengths
\edef\tikz@lib@mm@numerator{\pgf@sys@tonumber\pgf@xa}%
\edef\tikz@lib@mm@denominator{\pgf@sys@tonumber\pgf@x}%
\pgfmathdivide@{\tikz@lib@mm@numerator}{\tikz@lib@mm@denominator}%
% math result = flare scale factor; 1.0 means flare length is half of abutting circle radius
\pgfmathmultiply@{\pgfmathresult}{.5}%
% math result = length of flare, measured in circle radii
\pgf@process{%
\pgfmathsetlength\pgf@x{\pgfkeysvalueof{/pgf/decoration/start radius}}%
\pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/decoration/end radius}}%
}%
\tikz@lib@mm@startflarelength=\pgfmathresult\pgf@x\relax%
\tikz@lib@mm@endflarelength=\pgfmathresult\pgf@y\relax%
}%
\def\tikz@compute@segmentamplitude{%
\pgf@x=\pgfkeysvalueof{/pgf/decoration/start radius}\relax%
Expand Down