Skip to content

Commit

Permalink
FEAT: scaling of nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ldevillez committed Nov 28, 2023
1 parent f142e3a commit 3c52e41
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Adding dev dependencies group in the pyproject.toml
- Adding autodoc to generate code doc
- Adding example section in the doc
- Adding scaling on nodes
### Changed
- Using style from new inkex
- Using path from new inkex
Expand Down
4 changes: 2 additions & 2 deletions svg2tikz/tikz_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def filter_tag(node):
%(gradientcode)s
\def \globalscale {%(scale)f}
\begin{tikzpicture}[y=1%(unit)s, x=1%(unit)s, yscale=%(ysign)s\globalscale,"""
r"""xscale=\globalscale, inner sep=0pt, outer sep=0pt%(extraoptions)s]
r"""xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt%(extraoptions)s]
%(pathcode)s
\end{tikzpicture}
\end{document}
Expand All @@ -229,7 +229,7 @@ def filter_tag(node):
%(gradientcode)s
\def \globalscale {%(scale)f}
\begin{tikzpicture}[y=1%(unit)s, x=1%(unit)s, yscale=%(ysign)s\globalscale,"""
r"""xscale=\globalscale, inner sep=0pt, outer sep=0pt%(extraoptions)s]
r"""xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt%(extraoptions)s]
%(pathcode)s
\end{tikzpicture}
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_tikz_path_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def test_effect(self):
\def \globalscale {0.800000}
\begin{tikzpicture}[y=1mm, x=1mm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1mm, x=1mm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\end{tikzpicture}
\end{document}
Expand Down Expand Up @@ -230,7 +230,7 @@ def test_convert(self):
\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=blue,line width=0.02cm] (0.01, 3.99) rectangle (11.99, 0.01);
Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/blocs_and_groups.tex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\begin{scope}[cm={ 1.3333,-0.0,-0.0,-1.3333,(0.0, -36.301)}]
\begin{scope}[cm={ 0.3225,-0.0,-0.0,0.3225,(5.3871, -49.2583)}]
\begin{scope}[shift={(-11.1595, -11.4859)}]
Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/circle.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,line cap=,line width=0.2cm] (2.7319, 26.8727) circle (2.2948cm);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/circle_verbose.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\begin{scope}[]%% layer1
%path1573
\path[draw=black,line cap=,line width=0.2cm] (2.7319, 26.8727) circle (2.2948cm);
Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/curves.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,line cap=butt,line join=miter,line width=0.0265cm] (0.2646, 3.8353) .. controls (1.7639, 5.07) and (3.2632, 5.07) .. (4.7625, 3.8353);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/display_none_in_group.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=red,fill=red,opacity=0.7,draw opacity=0.9925,line width=0.1502cm,rounded corners=1.5536cm] (5.0181, 25.6783) rectangle (10.8699, 21.1104);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/ellipse.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,fill opacity=0.1632,line width=0.1cm,miter limit=4.0] (3.0, 27.7) ellipse (2.0cm and 1.0cm);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/image.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
% Image image2668 not included. Base64 still not supported;


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/line.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=cdddddd,line width=0.0529cm,miter limit=10.0] (0.0, 12.8058) -- (10.5833, 2.2225);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/lines_style.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,line cap=butt,line join=miter,line width=0.1cm] (0.7578, 10.9077) -- (7.7347, 10.9077);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/pentagone_round_corner.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[fill] (6.4182, 11.8297).. controls (-3.346, 16.7118) and (3.1158, 4.2643) .. (4.7416, 15.0593).. controls (6.3675, 25.8543) and (-3.4739, 15.8623) .. (7.2951, 17.6519).. controls (18.0642, 19.4414) and (5.5201, 25.7135) .. (10.5499, 16.0245).. controls (15.5796, 6.3355) and (17.6684, 20.2038) .. (10.0079, 12.4262).. controls (2.3474, 4.6485) and (16.1824, 6.9476) .. (6.4182, 11.8297) -- cycle;


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/polylines_polygones.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,fill,line join=round,line width=0.3cm,cm={ 4.7668,-0.0,-0.0,4.7668,(-18.2373, -115.945)}] (5.1, 29.7) -- (4.6, 30.0) -- (4.6, 29.4) -- (5.1, 29.7)-- cycle;;


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/rectangle.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,line cap=,line width=0.2cm] (0.7985, 28.9408) rectangle (5.0753, 27.1111);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/rectangle_wrap.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,line cap=,line width=0.2cm] (0.7985, 28.9408) rectangle
(5.0753, 27.1111);

Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/switch_simple.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,miter limit=10.0] (3.2015, 5.5298) -- (1.2171, 5.5298) -- (1.2171, 4.3754);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/symbol_and_use.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=pink] (0.0, -0.2646) -- (2.1167, -0.2646)(0.2646, 0.0) -- (0.2646, -0.5292)(0.6615, 0.0) -- (0.6615, -0.5292)(1.0583, 0.0) -- (1.0583, -0.5292)(1.4552, 0.0) -- (1.4552, -0.5292)(1.8521, 0.0) -- (1.8521, -0.5292);


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/text.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\node[line width=0.0265cm,anchor=south west] (text3) at (1.0, 28.7){Normal Text};


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/text_fill_color.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\node[anchor=south] (text2) at (3.385, 6.5697){Default};


Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/transform.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


\def \globalscale {1.000000}
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt]
\path[draw=black,line cap=,line width=0.2cm] (1.0186, 28.5295) rectangle (3.3265, 26.2215);


Expand Down

0 comments on commit 3c52e41

Please sign in to comment.