conditionally remove stats and logger for production

master
howard 2021-04-19 18:11:28 -07:00
parent fca217347f
commit 5e52265a3b
27 changed files with 874 additions and 151 deletions

BIN
dist/favicon.ico vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

BIN
dist/icon-192.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
dist/icon-512.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

98
icon/icon-text.svg Normal file
View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="452.45901"
height="96"
viewBox="0 0 452.45901 96.000008"
version="1.1"
id="svg2112"
inkscape:version="1.0.2 (1.0.2+r75+1)"
sodipodi:docname="icon-text.svg">
<defs
id="defs2106">
<rect
x="645.90955"
y="45.977581"
width="248.2307"
height="71.300766"
id="rect943" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.5149474"
inkscape:cx="218.61618"
inkscape:cy="175.47211"
inkscape:document-units="px"
inkscape:current-layer="g2625"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1747"
inkscape:window-height="1199"
inkscape:window-x="729"
inkscape:window-y="154"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata2109">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2625"
transform="translate(46.477595,53.03882)">
<g
id="g842"
transform="matrix(0.17281172,0,0,0.17281172,-21.424361,-37.007371)">
<g
id="g921"
transform="translate(-36.094691,-12.655916)">
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 51.316614,84.370759 164.499996,-95.000008 164.5,95.000008 -164.5,95.000041 z"
id="path2578"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 401.16781,121 0.0224,189.96118 -164.52241,94.96118 -0.0224,-189.96118 z"
id="path2578-3"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 194.52241,405.92236 30,310.96118 30.022413,121 194.54483,215.96118 Z"
id="path2578-6"
sodipodi:nodetypes="ccccc" />
</g>
</g>
<text
xml:space="preserve"
id="text941"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect943);fill:#000000;fill-opacity:1;stroke:none;"
transform="matrix(1.8120726,0,0,1.8120726,-1109.4801,-131.27905)"><tspan
x="645.91016"
y="83.286208"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'">three.cad</tspan></tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

83
icon/icon2.svg Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 511.99999 512.00002"
version="1.1"
id="svg2112"
inkscape:version="1.0.2 (1.0.2+r75+1)"
sodipodi:docname="icon2.svg">
<defs
id="defs2106" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.46475524"
inkscape:cx="27.339669"
inkscape:cy="128.43857"
inkscape:document-units="px"
inkscape:current-layer="g2625"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1514"
inkscape:window-height="1199"
inkscape:window-x="962"
inkscape:window-y="154"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata2109">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2625"
transform="translate(46.477595,53.03882)">
<g
id="g842"
transform="matrix(1.1095676,0,0,1.1095676,10.354561,-2.2984399)">
<g
id="g921"
transform="translate(-36.094691,-12.655916)">
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 51.316614,84.370759 164.499996,-95.000008 164.5,95.000008 -164.5,95.000041 z"
id="path2578"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 401.16781,121 0.0224,189.96118 -164.52241,94.96118 -0.0224,-189.96118 z"
id="path2578-3"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 194.52241,405.92236 30,310.96118 30.022413,121 194.54483,215.96118 Z"
id="path2578-6"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

124
icon/icon_text.svg Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="452.45901"
height="96"
viewBox="0 0 452.45901 96.000008"
version="1.1"
id="svg2112"
inkscape:version="1.0.2 (1.0.2+r75+1)"
sodipodi:docname="icon_text.svg">
<defs
id="defs2106">
<rect
x="645.90955"
y="45.977581"
width="248.2307"
height="71.300766"
id="rect943" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.53561479"
inkscape:cx="-4.052236"
inkscape:cy="331.25679"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1747"
inkscape:window-height="1199"
inkscape:window-x="241"
inkscape:window-y="125"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata2109">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
aria-label="three.cad"
transform="matrix(1.8120726,0,0,1.8120726,-1064.5195,-78.240227)"
id="text941"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect943);fill:#000000;fill-opacity:1;stroke:none">
<path
d="m 655.63016,64.726208 h 7.84 v 2.76 h -7.84 v 8.64 q 0,1.4 0.2,2.28 0.2,0.88 0.64,1.44 0.48,0.52 1.2,0.72 0.72,0.2 1.76,0.2 1.44,0 2.32,-0.24 0.88,-0.24 1.68,-0.64 l 0.48,2.8 q -0.56,0.24 -1.8,0.64 -1.2,0.4 -3,0.4 -2.08,0 -3.4,-0.48 -1.32,-0.48 -2.08,-1.44 -0.72,-0.96 -1,-2.36 -0.28,-1.44 -0.28,-3.32 v -8.64 h -3.92 v -2.76 h 3.92 v -5.2 l 3.28,-0.56 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path842" />
<path
d="m 668.75008,83.286208 v -27.16 l 3.32,-0.56 v 9.44 q 0.8,-0.32 1.8,-0.48 1,-0.2 1.96,-0.2 2.12,0 3.52,0.64 1.44,0.6 2.28,1.72 0.84,1.12 1.2,2.68 0.36,1.56 0.36,3.44 v 10.48 h -3.28 v -9.76 q 0,-3.44 -0.96,-4.84 -0.96,-1.44 -3.44,-1.44 -1.04,0 -2.04,0.24 -0.96,0.2 -1.4,0.4 v 15.4 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path844" />
<path
d="m 690.19,83.286208 v -17.56 q 4.08,-1.4 8.24,-1.4 1.28,0 2.44,0.12 1.16,0.08 2.56,0.4 l -0.6,2.92 q -1.28,-0.36 -2.28,-0.44 -0.96,-0.12 -2.12,-0.12 -2.44,0 -4.96,0.68 v 15.4 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path846" />
<path
d="m 716.26993,64.286208 q 3.76,0 5.8,2.36 2.04,2.32 2.04,7.08 v 1.16 h -13.28 q 0.2,2.88 1.88,4.4 1.72,1.48 4.8,1.48 1.76,0 3,-0.28 1.24,-0.28 1.88,-0.6 l 0.44,2.8 q -0.6,0.32 -2.16,0.68 -1.56,0.36 -3.52,0.36 -2.4,0 -4.24,-0.72 -1.8,-0.76 -3,-2.04 -1.2,-1.28 -1.8,-3.04 -0.6,-1.8 -0.6,-3.88 0,-2.48 0.76,-4.32 0.76,-1.84 2,-3.04 1.24,-1.2 2.8,-1.8 1.56,-0.6 3.2,-0.6 z m 4.48,7.92 q 0,-2.36 -1.24,-3.72 -1.24,-1.4 -3.28,-1.4 -1.16,0 -2.12,0.44 -0.92,0.44 -1.6,1.16 -0.68,0.72 -1.08,1.64 -0.4,0.92 -0.52,1.88 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path848" />
<path
d="m 736.26985,64.286208 q 3.76,0 5.8,2.36 2.04,2.32 2.04,7.08 v 1.16 h -13.28 q 0.2,2.88 1.88,4.4 1.72,1.48 4.8,1.48 1.76,0 3,-0.28 1.24,-0.28 1.88,-0.6 l 0.44,2.8 q -0.6,0.32 -2.16,0.68 -1.56,0.36 -3.52,0.36 -2.4,0 -4.24,-0.72 -1.8,-0.76 -3,-2.04 -1.2,-1.28 -1.8,-3.04 -0.6,-1.8 -0.6,-3.88 0,-2.48 0.76,-4.32 0.76,-1.84 2,-3.04 1.24,-1.2 2.8,-1.8 1.56,-0.6 3.2,-0.6 z m 4.48,7.92 q 0,-2.36 -1.24,-3.72 -1.24,-1.4 -3.28,-1.4 -1.16,0 -2.12,0.44 -0.92,0.44 -1.6,1.16 -0.68,0.72 -1.08,1.64 -0.4,0.92 -0.52,1.88 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path850" />
<path
d="m 758.86977,80.726208 q 0,1.2 -0.8,2.12 -0.8,0.92 -2.12,0.92 -1.36,0 -2.16,-0.92 -0.8,-0.92 -0.8,-2.12 0,-1.24 0.8,-2.16 0.8,-0.92 2.16,-0.92 1.32,0 2.12,0.92 0.8,0.92 0.8,2.16 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path852" />
<path
d="m 767.8697,74.046208 q 0,-2.52 0.8,-4.36 0.8,-1.84 2.2,-3.04 1.4,-1.2 3.24,-1.76 1.88,-0.6 4,-0.6 1.36,0 2.68,0.2 1.36,0.16 2.88,0.64 l -0.76,2.84 q -1.32,-0.48 -2.44,-0.6 -1.08,-0.16 -2.2,-0.16 -1.44,0 -2.72,0.4 -1.28,0.36 -2.24,1.2 -0.92,0.8 -1.48,2.12 -0.56,1.28 -0.56,3.12 0,1.76 0.52,3.04 0.52,1.24 1.44,2.08 0.96,0.8 2.28,1.2 1.32,0.4 2.92,0.4 1.28,0 2.44,-0.12 1.2,-0.16 2.6,-0.64 l 0.48,2.76 q -1.4,0.52 -2.84,0.72 -1.44,0.24 -3.12,0.24 -2.24,0 -4.12,-0.6 -1.84,-0.64 -3.2,-1.84 -1.32,-1.2 -2.08,-3 -0.72,-1.84 -0.72,-4.24 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path854" />
<path
d="m 796.10962,80.926208 q 1.24,0 2.2,-0.08 1,-0.08 1.64,-0.2 v -5.52 q -0.64,-0.2 -1.56,-0.32 -0.88,-0.12 -1.88,-0.12 -0.92,0 -1.8,0.16 -0.88,0.12 -1.56,0.48 -0.68,0.36 -1.12,0.96 -0.44,0.56 -0.44,1.44 0,1.8 1.2,2.52 1.24,0.68 3.32,0.68 z m -0.32,-16.64 q 2.08,0 3.48,0.52 1.44,0.52 2.32,1.44 0.88,0.92 1.24,2.24 0.36,1.32 0.36,2.88 v 11.6 q -1.16,0.2 -3.08,0.48 -1.88,0.28 -3.88,0.28 -1.52,0 -2.96,-0.28 -1.44,-0.24 -2.56,-0.88 -1.12,-0.68 -1.8,-1.84 -0.68,-1.16 -0.68,-2.96 0,-1.6 0.68,-2.68 0.72,-1.12 1.8,-1.8 1.12,-0.68 2.52,-0.96 1.44,-0.32 2.88,-0.32 1.96,0 3.84,0.44 v -0.92 q 0,-0.84 -0.2,-1.6 -0.16,-0.8 -0.68,-1.44 -0.48,-0.64 -1.36,-1 -0.84,-0.4 -2.2,-0.4 -1.72,0 -3,0.24 -1.28,0.24 -1.96,0.48 l -0.4,-2.72 q 0.68,-0.32 2.24,-0.56 1.6,-0.24 3.4,-0.24 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path856" />
<path
d="m 819.74955,68.646208 q -0.56,-0.52 -1.64,-0.96 -1.08,-0.48 -2.24,-0.48 -1.32,0 -2.28,0.52 -0.92,0.52 -1.52,1.44 -0.6,0.88 -0.88,2.16 -0.28,1.24 -0.28,2.68 0,3.24 1.52,5 1.52,1.76 3.96,1.76 1.24,0 2.08,-0.12 0.88,-0.12 1.28,-0.24 z m 0,-12.52 3.32,-0.56 v 27.2 q -1.08,0.32 -2.76,0.64 -1.68,0.32 -3.92,0.32 -2,0 -3.64,-0.68 -1.64,-0.68 -2.8,-1.92 -1.16,-1.28 -1.8,-3.08 -0.64,-1.8 -0.64,-4.04 0,-2.16 0.52,-3.92 0.56,-1.8 1.6,-3.08 1.04,-1.28 2.48,-2 1.48,-0.72 3.36,-0.72 1.48,0 2.6,0.36 1.12,0.36 1.68,0.76 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path858" />
</g>
<g
id="g921"
transform="matrix(0.16834106,0,0,0.16834106,18.949768,14.727969)">
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 51.316614,84.370759 164.499996,-95.000008 164.5,95.000008 -164.5,95.000041 z"
id="path2578"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 401.16781,121 0.0224,189.96118 -164.52241,94.96118 -0.0224,-189.96118 z"
id="path2578-3"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 194.52241,405.92236 30,310.96118 30.022413,121 194.54483,215.96118 Z"
id="path2578-6"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,17 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
svg=icon svg=icon2
size=(16 24 32 64) size=(16 24 32 64)
out="" out=""
for i in ${size[@]}; do for i in ${size[@]}; do
inkscape --export-filename="./$svg-$i.png" $svg.svg -w $i -h $i inkscape --export-filename="./icon-$i.png" $svg.svg -w $i -h $i
out+="$svg-$i.png " out+="icon-$i.png "
done done
size=(192 512) size=(192 512)
for i in ${size[@]}; do for i in ${size[@]}; do
inkscape --export-filename="./$svg-$i.png" $svg.svg -w $i -h $i inkscape --export-filename="./icon-$i.png" $svg.svg -w $i -h $i
done done
convert $out favicon.ico convert $out favicon.ico

124
icon/svgr_raw/icon_text.svg Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="452.45901"
height="96"
viewBox="0 0 452.45901 96.000008"
version="1.1"
id="svg2112"
inkscape:version="1.0.2 (1.0.2+r75+1)"
sodipodi:docname="icon_text.svg">
<defs
id="defs2106">
<rect
x="645.90955"
y="45.977581"
width="248.2307"
height="71.300766"
id="rect943" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.53561479"
inkscape:cx="-4.052236"
inkscape:cy="331.25679"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1747"
inkscape:window-height="1199"
inkscape:window-x="241"
inkscape:window-y="125"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata2109">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
aria-label="three.cad"
transform="matrix(1.8120726,0,0,1.8120726,-1064.5195,-78.240227)"
id="text941"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect943);fill:#000000;fill-opacity:1;stroke:none">
<path
d="m 655.63016,64.726208 h 7.84 v 2.76 h -7.84 v 8.64 q 0,1.4 0.2,2.28 0.2,0.88 0.64,1.44 0.48,0.52 1.2,0.72 0.72,0.2 1.76,0.2 1.44,0 2.32,-0.24 0.88,-0.24 1.68,-0.64 l 0.48,2.8 q -0.56,0.24 -1.8,0.64 -1.2,0.4 -3,0.4 -2.08,0 -3.4,-0.48 -1.32,-0.48 -2.08,-1.44 -0.72,-0.96 -1,-2.36 -0.28,-1.44 -0.28,-3.32 v -8.64 h -3.92 v -2.76 h 3.92 v -5.2 l 3.28,-0.56 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path842" />
<path
d="m 668.75008,83.286208 v -27.16 l 3.32,-0.56 v 9.44 q 0.8,-0.32 1.8,-0.48 1,-0.2 1.96,-0.2 2.12,0 3.52,0.64 1.44,0.6 2.28,1.72 0.84,1.12 1.2,2.68 0.36,1.56 0.36,3.44 v 10.48 h -3.28 v -9.76 q 0,-3.44 -0.96,-4.84 -0.96,-1.44 -3.44,-1.44 -1.04,0 -2.04,0.24 -0.96,0.2 -1.4,0.4 v 15.4 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path844" />
<path
d="m 690.19,83.286208 v -17.56 q 4.08,-1.4 8.24,-1.4 1.28,0 2.44,0.12 1.16,0.08 2.56,0.4 l -0.6,2.92 q -1.28,-0.36 -2.28,-0.44 -0.96,-0.12 -2.12,-0.12 -2.44,0 -4.96,0.68 v 15.4 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path846" />
<path
d="m 716.26993,64.286208 q 3.76,0 5.8,2.36 2.04,2.32 2.04,7.08 v 1.16 h -13.28 q 0.2,2.88 1.88,4.4 1.72,1.48 4.8,1.48 1.76,0 3,-0.28 1.24,-0.28 1.88,-0.6 l 0.44,2.8 q -0.6,0.32 -2.16,0.68 -1.56,0.36 -3.52,0.36 -2.4,0 -4.24,-0.72 -1.8,-0.76 -3,-2.04 -1.2,-1.28 -1.8,-3.04 -0.6,-1.8 -0.6,-3.88 0,-2.48 0.76,-4.32 0.76,-1.84 2,-3.04 1.24,-1.2 2.8,-1.8 1.56,-0.6 3.2,-0.6 z m 4.48,7.92 q 0,-2.36 -1.24,-3.72 -1.24,-1.4 -3.28,-1.4 -1.16,0 -2.12,0.44 -0.92,0.44 -1.6,1.16 -0.68,0.72 -1.08,1.64 -0.4,0.92 -0.52,1.88 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path848" />
<path
d="m 736.26985,64.286208 q 3.76,0 5.8,2.36 2.04,2.32 2.04,7.08 v 1.16 h -13.28 q 0.2,2.88 1.88,4.4 1.72,1.48 4.8,1.48 1.76,0 3,-0.28 1.24,-0.28 1.88,-0.6 l 0.44,2.8 q -0.6,0.32 -2.16,0.68 -1.56,0.36 -3.52,0.36 -2.4,0 -4.24,-0.72 -1.8,-0.76 -3,-2.04 -1.2,-1.28 -1.8,-3.04 -0.6,-1.8 -0.6,-3.88 0,-2.48 0.76,-4.32 0.76,-1.84 2,-3.04 1.24,-1.2 2.8,-1.8 1.56,-0.6 3.2,-0.6 z m 4.48,7.92 q 0,-2.36 -1.24,-3.72 -1.24,-1.4 -3.28,-1.4 -1.16,0 -2.12,0.44 -0.92,0.44 -1.6,1.16 -0.68,0.72 -1.08,1.64 -0.4,0.92 -0.52,1.88 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path850" />
<path
d="m 758.86977,80.726208 q 0,1.2 -0.8,2.12 -0.8,0.92 -2.12,0.92 -1.36,0 -2.16,-0.92 -0.8,-0.92 -0.8,-2.12 0,-1.24 0.8,-2.16 0.8,-0.92 2.16,-0.92 1.32,0 2.12,0.92 0.8,0.92 0.8,2.16 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path852" />
<path
d="m 767.8697,74.046208 q 0,-2.52 0.8,-4.36 0.8,-1.84 2.2,-3.04 1.4,-1.2 3.24,-1.76 1.88,-0.6 4,-0.6 1.36,0 2.68,0.2 1.36,0.16 2.88,0.64 l -0.76,2.84 q -1.32,-0.48 -2.44,-0.6 -1.08,-0.16 -2.2,-0.16 -1.44,0 -2.72,0.4 -1.28,0.36 -2.24,1.2 -0.92,0.8 -1.48,2.12 -0.56,1.28 -0.56,3.12 0,1.76 0.52,3.04 0.52,1.24 1.44,2.08 0.96,0.8 2.28,1.2 1.32,0.4 2.92,0.4 1.28,0 2.44,-0.12 1.2,-0.16 2.6,-0.64 l 0.48,2.76 q -1.4,0.52 -2.84,0.72 -1.44,0.24 -3.12,0.24 -2.24,0 -4.12,-0.6 -1.84,-0.64 -3.2,-1.84 -1.32,-1.2 -2.08,-3 -0.72,-1.84 -0.72,-4.24 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path854" />
<path
d="m 796.10962,80.926208 q 1.24,0 2.2,-0.08 1,-0.08 1.64,-0.2 v -5.52 q -0.64,-0.2 -1.56,-0.32 -0.88,-0.12 -1.88,-0.12 -0.92,0 -1.8,0.16 -0.88,0.12 -1.56,0.48 -0.68,0.36 -1.12,0.96 -0.44,0.56 -0.44,1.44 0,1.8 1.2,2.52 1.24,0.68 3.32,0.68 z m -0.32,-16.64 q 2.08,0 3.48,0.52 1.44,0.52 2.32,1.44 0.88,0.92 1.24,2.24 0.36,1.32 0.36,2.88 v 11.6 q -1.16,0.2 -3.08,0.48 -1.88,0.28 -3.88,0.28 -1.52,0 -2.96,-0.28 -1.44,-0.24 -2.56,-0.88 -1.12,-0.68 -1.8,-1.84 -0.68,-1.16 -0.68,-2.96 0,-1.6 0.68,-2.68 0.72,-1.12 1.8,-1.8 1.12,-0.68 2.52,-0.96 1.44,-0.32 2.88,-0.32 1.96,0 3.84,0.44 v -0.92 q 0,-0.84 -0.2,-1.6 -0.16,-0.8 -0.68,-1.44 -0.48,-0.64 -1.36,-1 -0.84,-0.4 -2.2,-0.4 -1.72,0 -3,0.24 -1.28,0.24 -1.96,0.48 l -0.4,-2.72 q 0.68,-0.32 2.24,-0.56 1.6,-0.24 3.4,-0.24 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path856" />
<path
d="m 819.74955,68.646208 q -0.56,-0.52 -1.64,-0.96 -1.08,-0.48 -2.24,-0.48 -1.32,0 -2.28,0.52 -0.92,0.52 -1.52,1.44 -0.6,0.88 -0.88,2.16 -0.28,1.24 -0.28,2.68 0,3.24 1.52,5 1.52,1.76 3.96,1.76 1.24,0 2.08,-0.12 0.88,-0.12 1.28,-0.24 z m 0,-12.52 3.32,-0.56 v 27.2 q -1.08,0.32 -2.76,0.64 -1.68,0.32 -3.92,0.32 -2,0 -3.64,-0.68 -1.64,-0.68 -2.8,-1.92 -1.16,-1.28 -1.8,-3.08 -0.64,-1.8 -0.64,-4.04 0,-2.16 0.52,-3.92 0.56,-1.8 1.6,-3.08 1.04,-1.28 2.48,-2 1.48,-0.72 3.36,-0.72 1.48,0 2.6,0.36 1.12,0.36 1.68,0.76 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono'"
id="path858" />
</g>
<g
id="g921"
transform="matrix(0.16834106,0,0,0.16834106,18.949768,14.727969)">
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 51.316614,84.370759 164.499996,-95.000008 164.5,95.000008 -164.5,95.000041 z"
id="path2578"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 401.16781,121 0.0224,189.96118 -164.52241,94.96118 -0.0224,-189.96118 z"
id="path2578-3"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 194.52241,405.92236 30,310.96118 30.022413,121 194.54483,215.96118 Z"
id="path2578-6"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

83
icon/svgr_raw/logo.svg Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 511.99999 512.00002"
version="1.1"
id="svg2112"
inkscape:version="1.0.2 (1.0.2+r75+1)"
sodipodi:docname="icon2.svg">
<defs
id="defs2106" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.46475524"
inkscape:cx="27.339669"
inkscape:cy="128.43857"
inkscape:document-units="px"
inkscape:current-layer="g2625"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1514"
inkscape:window-height="1199"
inkscape:window-x="962"
inkscape:window-y="154"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata2109">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2625"
transform="translate(46.477595,53.03882)">
<g
id="g842"
transform="matrix(1.1095676,0,0,1.1095676,10.354561,-2.2984399)">
<g
id="g921"
transform="translate(-36.094691,-12.655916)">
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 51.316614,84.370759 164.499996,-95.000008 164.5,95.000008 -164.5,95.000041 z"
id="path2578"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 401.16781,121 0.0224,189.96118 -164.52241,94.96118 -0.0224,-189.96118 z"
id="path2578-3"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#34d399;fill-opacity:0.698039;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 194.52241,405.92236 30,310.96118 30.022413,121 194.54483,215.96118 Z"
id="path2578-6"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -10,9 +10,15 @@ import { AxesHelper } from './axes'
import { TrackballControls } from '../lib/trackball' import { TrackballControls } from '../lib/trackball'
import CSG from "../lib/three-csg" import CSG from "../lib/three-csg"
import { STLExporter } from '../lib/stl' import { STLExporter } from '../lib/stl'
import Stats from '../lib/stats.module.js';
let stats
if (process.env.NODE_ENV !== 'production') {
const { default: d } = require('../lib/stats.module.js')
stats = new d();
document.getElementById('stats').appendChild(stats.dom);
}
window.loader = new THREE.ObjectLoader(); window.loader = new THREE.ObjectLoader();
window.STLexp = new STLExporter(); window.STLexp = new STLExporter();
@ -145,10 +151,13 @@ export class Scene {
controls.addEventListener('start', this.render); controls.addEventListener('start', this.render);
window.addEventListener('resize', this.render); window.addEventListener('resize', this.render);
if (process.env.NODE_ENV !== 'production') {
this.stats = new Stats(); this.stats = stats
this.stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom this.stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
document.getElementById('stats').appendChild(this.stats.dom); document.getElementById('stats').appendChild(this.stats.dom);
}
this.hovered = []; this.hovered = [];
@ -331,7 +340,11 @@ export class Scene {
let idx, x, y, ele, pos, dims, matrix; let idx, x, y, ele, pos, dims, matrix;
function render() { function render() {
if (process.env.NODE_ENV !== 'production') {
this.stats.begin(); this.stats.begin();
}
if (this.resizeCanvas(this.renderer)) { if (this.resizeCanvas(this.renderer)) {
const canvas = this.renderer.domElement; const canvas = this.renderer.domElement;
this.camera.left = -canvas.clientWidth / canvas.clientHeight; this.camera.left = -canvas.clientWidth / canvas.clientHeight;
@ -366,7 +379,9 @@ function render() {
} }
if (process.env.NODE_ENV !== 'production') {
this.stats.end(); this.stats.end();
}
} }
@ -374,7 +389,7 @@ function addSketch() {
let sketch; let sketch;
if (this.selected.length == 3 && this.selected.every(e=>e.userData.type == 'selpoint')) { if (this.selected.length == 3 && this.selected.every(e => e.userData.type == 'selpoint')) {
sketch = new Sketch(this) sketch = new Sketch(this)
this.obj3d.add(sketch.obj3d) this.obj3d.add(sketch.obj3d)
sketch.align( sketch.align(
@ -401,9 +416,3 @@ function addSketch() {
} }
window.sc = new Scene(store) window.sc = new Scene(store)
// sc.loadState()
// sc.camera.layers.enable(1)
// rc.layers.set(1)

View File

@ -187,7 +187,6 @@ class Sketch {
} }
deactivate() { deactivate() {
console.log('deactivate')
window.removeEventListener('keydown', this.onKeyPress) window.removeEventListener('keydown', this.onKeyPress)
this.canvas.removeEventListener('pointerdown', this.onPick) this.canvas.removeEventListener('pointerdown', this.onPick)
this.canvas.removeEventListener('pointermove', this.onHover) this.canvas.removeEventListener('pointermove', this.onHover)

View File

@ -53,50 +53,19 @@ body {
.btn { .btn {
cursor: pointer; cursor: pointer;
@apply fill-current @apply fill-current
bg-transparent text-gray-200 bg-transparent hover:bg-gray-600;
hover:bg-gray-500 hover:text-gray-200;
} }
.active-btn {
cursor: pointer;
@apply fill-current
bg-green-400 text-gray-200
}
.btn-green { .btn-green {
cursor: pointer; cursor: pointer;
@apply fill-current @apply fill-current
bg-transparent text-gray-200 bg-transparent text-gray-200
hover:bg-transparent hover:text-green-400; hover:text-green-400;
} }
.tooltip {
position: fixed;
display: block;
background-color: black;
color: #fff;
text-align: center;
border-radius: 4px;
padding: 4px;
visibility: hidden;
border: solid 1px white;
}
.arrow {
position: absolute;
bottom: 100%;
left: 50%;
margin-left: -6px;
border: solid 6px transparent;
border-bottom-color: white;
border-top: none;
}
input::-webkit-outer-spin-button, input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { input::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
@ -112,5 +81,17 @@ input[type=number] {
text-align:right; text-align:right;
} }
/* input:focus[type=number] { */ .arrow {
/* } */ position: absolute;
bottom: 100%;
left: 50%;
margin-left: -6px;
border: solid 6px transparent;
border-bottom-color: #3F3F46;
border-top: none;
}
.drop-down-top {
top: calc(var(--topNavH) + 6px);
}

View File

@ -4,7 +4,6 @@ import React from 'react'
import { createStore, applyMiddleware } from 'redux' import { createStore, applyMiddleware } from 'redux'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { reducer } from './reducer' import { reducer } from './reducer'
// import logger from 'redux-logger'
import { Tree } from './tree' import { Tree } from './tree'
import { NavBar } from './navBar' import { NavBar } from './navBar'

View File

@ -35,9 +35,15 @@ export const Dialog = () => {
sc.render() sc.render()
} }
const extrudeCancel = () => {
if (sc.activeSketch == dialog.target) { // if extrude dialog launched from sketch mode we set dialog back to the sketch dialog
dispatch({ type: 'set-dialog', action: 'sketch' })
} else {
dispatch({ type: "clear-dialog" })
}
}
const extrudeEdit = () => { const extrudeEdit = () => {
dialog.target.userData.featureInfo[1] = ref.current.value dialog.target.userData.featureInfo[1] = ref.current.value
sc.refreshNode(dialog.target.name, treeEntries) sc.refreshNode(dialog.target.name, treeEntries)
@ -48,47 +54,9 @@ export const Dialog = () => {
sc.render() sc.render()
} }
const extrudeEditCancel = () => dispatch({ type: "clear-dialog" })
switch (dialog.action) { const sketchDone = () => {
case 'extrude':
return <>
<input className='w-16 border-t-0 border-l-0 border-r-0 border-b border-gray-50 text-gray-50 mr-2' type="number" defaultValue="1" step="0.1" ref={ref} />
<Icon.Flip className="btn w-auto h-full p-3.5"
onClick={() => ref.current.value *= -1}
/>
<MdDone
className="btn w-auto h-full p-3.5"
onClick={extrude}
/>
<MdClose className="btn w-auto h-full p-3.5 mr-6"
onClick={() => {
if (sc.activeSketch == dialog.target) { // if extrude dialog launched from sketch mode we set dialog back to the sketch dialog
dispatch({ type: 'set-dialog', action: 'sketch' })
} else {
dispatch({ type: "clear-dialog" })
}
}}
/>
</>
case 'extrude-edit':
return <>
<input className='w-16 border-t-0 border-l-0 border-r-0 border-b border-gray-50 text-gray-50 mr-2' type="number" defaultValue={dialog.target.userData.featureInfo[1]} step="0.1" ref={ref} />
<Icon.Flip className="btn w-auto h-full p-3.5"
onClick={() => ref.current.value *= -1}
/>
<MdDone
className="btn w-auto h-full p-3.5"
onClick={extrudeEdit}
/>
<MdClose className="btn w-auto h-full p-3.5 mr-6"
onClick={() => dispatch({ type: "clear-dialog" })}
/>
</>
case 'sketch':
return <>
<MdDone
className="btn w-auto h-full p-3.5"
onClick={() => {
if (sc.activeSketch.hasChanged if (sc.activeSketch.hasChanged
|| sc.activeSketch.idOnActivate != id || sc.activeSketch.idOnActivate != id
|| sc.activeSketch.c_idOnActivate != sc.activeSketch.c_id || sc.activeSketch.c_idOnActivate != sc.activeSketch.c_id
@ -103,10 +71,9 @@ export const Dialog = () => {
sc.activeSketch.deactivate() sc.activeSketch.deactivate()
sc.render() sc.render()
dispatch({ type: "clear-dialog" }) dispatch({ type: "clear-dialog" })
}} }
/>
<MdClose className="btn w-auto h-full p-3.5 mr-6" const sketchCancel = () => {
onClick={() => {
if (sc.activeSketch.hasChanged if (sc.activeSketch.hasChanged
|| sc.activeSketch.idOnActivate != id || sc.activeSketch.idOnActivate != id
|| sc.activeSketch.c_idOnActivate != sc.activeSketch.c_id || sc.activeSketch.c_idOnActivate != sc.activeSketch.c_id
@ -124,7 +91,46 @@ export const Dialog = () => {
sc.activeSketch.deactivate() sc.activeSketch.deactivate()
sc.render() sc.render()
dispatch({ type: "clear-dialog" }) dispatch({ type: "clear-dialog" })
}} }
switch (dialog.action) {
case 'extrude':
return <>
<input className='w-10 border-t-0 border-l-0 border-r-0 border-b border-gray-50 text-gray-50' type="number" defaultValue="1" step="0.1" ref={ref} />
<Icon.Flip className="btn text-gray-200 w-auto h-full p-3.5"
onClick={() => ref.current.value *= -1}
/>
<MdDone
className="btn w-auto h-full p-3.5 text-green-500"
onClick={extrude}
/>
<MdClose className="btn w-auto h-full p-3.5 text-red-500"
onClick={extrudeCancel}
/>
</>
case 'extrude-edit':
return <>
<input className='w-10 border-t-0 border-l-0 border-r-0 border-b border-gray-50 text-gray-50' type="number" defaultValue={dialog.target.userData.featureInfo[1]} step="0.1" ref={ref} />
<Icon.Flip className="btn text-gray-200 w-auto h-full p-3.5"
onClick={() => ref.current.value *= -1}
/>
<MdDone
className="btn w-auto h-full p-3.5 text-green-500"
onClick={extrudeEdit}
/>
<MdClose
className="btn w-auto h-full p-3.5 text-red-500"
onClick={extrudeEditCancel}
/>
</>
case 'sketch':
return <>
<MdDone
className="btn w-auto h-full p-3.5 text-green-500"
onClick={sketchDone}
/>
<MdClose className="btn w-auto h-full p-3.5 text-red-500"
onClick={sketchCancel}
/> />
</> </>
default: default:

75
src/react/dropDown.jsx Normal file
View File

@ -0,0 +1,75 @@
import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'
export const DropDown = () => {
const arr = [
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
]
const dispatch = useDispatch()
const [open, setOpen] = useState(false)
const handleOutsideClick = (ev) => {
/*
this handles inside click as well due to bubbling,
sets the open/close state of drop down
*/
setOpen(state => !state) // handle click on button & dropdown, always a toggle
document.addEventListener( // handles click outside dropdown & button
'pointerdown',
(e) => {
!e.path.includes(ev.target.parentNode) && setOpen(false)
}
,
{ capture: true, once: true } // capture phase to allow for stopPropogation on others
)
}
const handleInsideClick = (e) => {
// handles click inside dropdown, business logic here
const idx = Array.prototype.indexOf.call(e.target.parentNode.children, e.target)
if (idx !== -1) {
console.log(idx)
fetch(arr[idx][0])
.then(res => res.text())
.then(text => {
dispatch({ type: 'restore-state', state: sc.loadState(text) })
fileHandle.name = 'something'
console.log(fileHandle.name)
sc.render()
})
}
}
const fileHandle = useSelector(state => state.ui.fileHandle)
return <div className="cursor-pointer w-28 h-full overflow-visible relative select-none"
onClick={handleOutsideClick}
>
<div className="btn text-gray-200 h-full w-full flex items-center justify-center">
Demo Parts
</div>
{
open &&
<div className="absolute drop-down-top w-full p-1 rounded bg-gray-700"
onClick={handleInsideClick}
>
{arr.map(([url, name], idx) => (
<div className="w-auto h-8 p-0.5 flex items-center bg-transparent text-gray-200
hover:bg-gray-500 "
key={idx}
>
{name}
</div>
))}
<div className="arrow"></div>
</div>
}
</div>
}

View File

@ -110,8 +110,6 @@ export async function openFile(dispatch) {
dispatch({ type: 'restore-state', state: sc.loadState(text) }) dispatch({ type: 'restore-state', state: sc.loadState(text) })
dispatch({ type: 'set-file-handle', fileHandle }) dispatch({ type: 'set-file-handle', fileHandle })
// app.setFocus(true);
} catch (ex) { } catch (ex) {
const msg = `An error occured reading ${fileHandle}`; const msg = `An error occured reading ${fileHandle}`;
console.error(msg, ex); console.error(msg, ex);

View File

@ -289,6 +289,40 @@ function Horizontal(props) {
); );
} }
function Icon_text(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 452.459 96"
{...props}
>
<defs>
<path id="prefix__a" d="M645.91 45.978h248.231v71.301H645.91z" />
</defs>
<g
aria-label="three.cad"
fontWeight={400}
fontSize={40}
fontFamily="Ubuntu Mono"
letterSpacing={0}
wordSpacing={0}
>
<path
d="M123.53 39.048h14.207v5.002H123.53v15.656q0 2.537.362 4.132.363 1.594 1.16 2.609.87.942 2.175 1.305 1.304.362 3.189.362 2.61 0 4.204-.435 1.594-.435 3.044-1.16l.87 5.074q-1.015.435-3.262 1.16-2.174.725-5.436.725-3.77 0-6.161-.87-2.392-.87-3.77-2.61-1.304-1.739-1.811-4.276-.508-2.61-.508-6.016V44.05h-7.103v-5.002h7.103v-9.422l5.944-1.015zM147.304 72.68V23.465l6.016-1.015v17.106q1.45-.58 3.262-.87 1.812-.362 3.552-.362 3.841 0 6.378 1.16 2.61 1.087 4.132 3.116 1.522 2.03 2.174 4.856.653 2.827.653 6.234v18.99h-5.944V54.995q0-6.234-1.74-8.77-1.74-2.61-6.233-2.61-1.885 0-3.697.435-1.74.362-2.537.725V72.68zM186.155 72.68V40.86q7.393-2.536 14.931-2.536 2.32 0 4.422.217 2.102.145 4.639.725l-1.088 5.291q-2.319-.652-4.131-.797-1.74-.218-3.842-.218-4.421 0-8.988 1.233V72.68zM233.414 38.251q6.813 0 10.51 4.277 3.696 4.204 3.696 12.829v2.102h-24.064q.362 5.219 3.407 7.973 3.116 2.682 8.698 2.682 3.189 0 5.436-.507 2.247-.508 3.406-1.088l.798 5.074q-1.087.58-3.914 1.232-2.827.653-6.379.653-4.349 0-7.683-1.305-3.262-1.377-5.436-3.697-2.175-2.319-3.262-5.508-1.087-3.262-1.087-7.031 0-4.494 1.377-7.828 1.377-3.334 3.624-5.509 2.247-2.174 5.074-3.262 2.827-1.087 5.799-1.087zm8.118 14.352q0-4.277-2.247-6.741-2.247-2.537-5.944-2.537-2.102 0-3.841.797-1.668.797-2.9 2.102-1.232 1.305-1.957 2.972-.725 1.667-.942 3.407zM269.655 38.251q6.813 0 10.51 4.277 3.697 4.204 3.697 12.829v2.102h-24.065q.363 5.219 3.407 7.973 3.117 2.682 8.698 2.682 3.19 0 5.436-.507 2.247-.508 3.407-1.088l.797 5.074q-1.087.58-3.914 1.232-2.827.653-6.378.653-4.35 0-7.684-1.305-3.261-1.377-5.436-3.697-2.174-2.319-3.262-5.508-1.087-3.262-1.087-7.031 0-4.494 1.377-7.828 1.378-3.334 3.624-5.509 2.247-2.174 5.074-3.262 2.827-1.087 5.799-1.087zm8.118 14.352q0-4.277-2.247-6.741-2.247-2.537-5.944-2.537-2.102 0-3.841.797-1.667.797-2.9 2.102-1.232 1.305-1.957 2.972-.724 1.667-.942 3.407zM310.608 68.042q0 2.174-1.45 3.841-1.45 1.667-3.842 1.667-2.464 0-3.914-1.667-1.45-1.667-1.45-3.841 0-2.247 1.45-3.915 1.45-1.667 3.914-1.667 2.392 0 3.842 1.667 1.45 1.668 1.45 3.915zM326.916 55.937q0-4.567 1.45-7.9 1.45-3.335 3.986-5.51 2.537-2.174 5.871-3.189 3.407-1.087 7.249-1.087 2.464 0 4.856.362 2.465.29 5.219 1.16l-1.377 5.146q-2.392-.87-4.422-1.087-1.957-.29-3.986-.29-2.61 0-4.93.725-2.319.652-4.058 2.175-1.667 1.45-2.682 3.841-1.015 2.32-1.015 5.654 0 3.19.942 5.509.943 2.247 2.61 3.769 1.74 1.45 4.131 2.174 2.392.725 5.292.725 2.32 0 4.421-.217 2.175-.29 4.711-1.16l.87 5.001q-2.537.942-5.146 1.305-2.61.435-5.654.435-4.059 0-7.465-1.088-3.335-1.16-5.8-3.334-2.391-2.174-3.768-5.436-1.305-3.334-1.305-7.683zM378.089 68.404q2.247 0 3.986-.145 1.813-.145 2.972-.362V57.894q-1.16-.362-2.827-.58-1.594-.217-3.406-.217-1.667 0-3.262.29-1.595.217-2.827.87-1.232.652-2.03 1.739-.797 1.015-.797 2.61 0 3.261 2.175 4.566 2.247 1.232 6.016 1.232zm-.58-30.153q3.77 0 6.306.942 2.61.943 4.204 2.61 1.595 1.667 2.247 4.059.652 2.392.652 5.219V72.1q-2.102.362-5.58.87-3.407.507-7.032.507-2.754 0-5.363-.508-2.61-.435-4.64-1.594-2.029-1.232-3.261-3.334-1.232-2.102-1.232-5.364 0-2.9 1.232-4.857 1.305-2.03 3.262-3.261 2.03-1.233 4.566-1.74 2.61-.58 5.219-.58 3.552 0 6.958.798V51.37q0-1.522-.362-2.899-.29-1.45-1.232-2.61-.87-1.159-2.465-1.811-1.522-.725-3.986-.725-3.117 0-5.437.435-2.319.435-3.551.87l-.725-4.93q1.232-.58 4.059-1.014 2.9-.435 6.161-.435zM420.926 46.152q-1.015-.943-2.972-1.74-1.957-.87-4.059-.87-2.392 0-4.131.943-1.667.942-2.755 2.609-1.087 1.595-1.594 3.914-.508 2.247-.508 4.856 0 5.872 2.755 9.06 2.754 3.19 7.176 3.19 2.247 0 3.769-.217 1.594-.218 2.32-.435zm0-22.687l6.016-1.015v49.288q-1.957.58-5.001 1.16-3.044.58-7.103.58-3.625 0-6.596-1.232-2.972-1.233-5.074-3.48-2.102-2.32-3.262-5.58-1.16-3.263-1.16-7.322 0-3.914.943-7.103 1.014-3.262 2.899-5.581 1.885-2.32 4.494-3.624 2.682-1.305 6.089-1.305 2.681 0 4.71.652 2.03.653 3.045 1.378z"
style={{
InkscapeFontSpecification: "'Ubuntu Mono'",
}}
/>
</g>
<g fill="#34d399" fillOpacity={0.698}>
<path d="M27.588 28.931l27.693-15.992L82.973 28.93 55.28 44.923zM86.483 35.097l.004 31.979L58.79 83.06l-.004-31.978zM51.696 83.061L24 67.076l.004-31.979L51.7 51.083z" />
</g>
</svg>
);
}
function Intersect(props) { function Intersect(props) {
return ( return (
<svg <svg
@ -395,6 +429,22 @@ function Line(props) {
); );
} }
function Logo(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 512 512"
{...props}
>
<g fill="#34d399" fillOpacity={0.698}>
<path d="M73.722 130.313l182.524-105.41 182.524 105.41-182.524 105.409zM461.905 170.955l.025 210.775-182.548 105.366-.025-210.775zM232.618 487.096L50.07 381.73l.025-210.775 182.548 105.366z" />
</g>
</svg>
);
}
function Stl(props) { function Stl(props) {
return ( return (
<svg <svg
@ -602,4 +652,4 @@ function Vertical(props) {
</svg> </svg>
); );
} }
export { Arc, Coincident, Dimension, Extrude, Extrude_master, Flip, Horizontal, Intersect, Intersect_thin, Line, Stl, Subtract, Tangent, Union, Union_thin, Vertical }; export { Arc, Coincident, Dimension, Extrude, Extrude_master, Flip, Horizontal, Icon_text, Intersect, Intersect_thin, Line, Logo, Stl, Subtract, Tangent, Union, Union_thin, Vertical };

View File

@ -1,6 +1,6 @@
import React, { useEffect, useReducer } from 'react'; import React, { useEffect, useReducer, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux' import { useDispatch, useSelector } from 'react-redux'
@ -9,6 +9,7 @@ import { MdSave, MdFolder, MdInsertDriveFile } from 'react-icons/md'
import * as Icon from "./icons"; import * as Icon from "./icons";
import { Dialog } from './dialog' import { Dialog } from './dialog'
import { DropDown } from './dropDown'
import { STLExport, saveFile, openFile, verifyPermission } from './fileHelpers' import { STLExport, saveFile, openFile, verifyPermission } from './fileHelpers'
export const NavBar = () => { export const NavBar = () => {
@ -103,14 +104,14 @@ export const NavBar = () => {
[Icon.Extrude, () => { [Icon.Extrude, () => {
dispatch({ type: 'set-dialog', action: 'extrude', target: sc.activeSketch }) dispatch({ type: 'set-dialog', action: 'extrude', target: sc.activeSketch })
}, 'Extrude [e]'], }, 'Extrude'],
[Icon.Dimension, () => sc.activeSketch.command('d'), 'Dimension [D]'], [Icon.Dimension, () => sc.activeSketch.command('d'), 'Dimension (D)'],
[Icon.Line, () => sc.activeSketch.command('l'), 'Line [L]'], [Icon.Line, () => sc.activeSketch.command('l'), 'Line (L)'],
[Icon.Arc, () => sc.activeSketch.command('a'), 'Arc [A]'], [Icon.Arc, () => sc.activeSketch.command('a'), 'Arc (A)'],
[Icon.Coincident, () => sc.activeSketch.command('c'), 'Coincident [C]'], [Icon.Coincident, () => sc.activeSketch.command('c'), 'Coincident (C)'],
[Icon.Vertical, () => sc.activeSketch.command('v'), 'Vertical [V]'], [Icon.Vertical, () => sc.activeSketch.command('v'), 'Vertical (V)'],
[Icon.Horizontal, () => sc.activeSketch.command('h'), 'Horizontal [H]'], [Icon.Horizontal, () => sc.activeSketch.command('h'), 'Horizontal (H)'],
[Icon.Tangent, () => sc.activeSketch.command('t'), 'Tangent [T]'], [Icon.Tangent, () => sc.activeSketch.command('t'), 'Tangent (T)'],
[MdSave, [MdSave,
async () => { async () => {
if (await verifyPermission(fileHandle) === false) return if (await verifyPermission(fileHandle) === false) return
@ -166,28 +167,35 @@ export const NavBar = () => {
const [_, forceUpdate] = useReducer(x => x + 1, 0); const [_, forceUpdate] = useReducer(x => x + 1, 0);
return <div className='topNav flex justify-center items-center bg-gray-700'> return <div className='topNav flex justify-center items-center bg-gray-800'>
<div className='w-auto h-full flex-1 flex items-center justify-end'> {/* <div className='w-auto h-full flex-1 flex items-center justify-end'> */}
<div className='w-auto h-full flex-1 flex items-center justify-end md:justify-between'>
<div className='w-100 h-full items-center font-mono text-lg text-gray-200 select-none hidden md:flex mr-8'>
<Icon.Logo className='w-auto h-6 mx-1' />
three.cad
</div>
<div className='h-full w-48 flex items-center justify-end'>
<Dialog /> <Dialog />
</div> </div>
<div className='w-auto h-full flex-none'> </div>
{ <div className='w-auto h-full flex'>
sketchActive ? {sketchActive ?
sketchModeButtons.map(([Icon, fcn, txt, shortcut], idx) => ( sketchModeButtons.map(([Icon, fcn, txt], idx) => (
<Icon className="btn w-auto h-full p-3.5" tooltip={txt} <Icon className="btn text-gray-200 w-auto h-full p-3.5" tooltip={txt}
onClick={fcn} key={idx} onClick={fcn} key={idx}
/> />
)) ))
: :
partModeButtons.map(([Icon, fcn, txt, shortcut], idx) => ( partModeButtons.map(([Icon, fcn, txt], idx) => (
<Icon className="btn w-auto h-full p-3.5" tooltip={txt} <Icon className="btn text-gray-200 w-auto h-full p-3.5" tooltip={txt}
onClick={fcn} key={idx} onClick={fcn} key={idx}
/> />
)) ))
} }
</div> </div>
<div className='w-auto h-full flex-1 items-center flex justify-end'> <div className='w-auto h-full flex-1 items-center justify-end flex-shrink-1 hidden lg:flex'>
<DropDown />
<a href='https://github.com/twpride/threeCAD' className='h-full w=auto'> <a href='https://github.com/twpride/threeCAD' className='h-full w=auto'>
<FaGithub className="btn-green w-auto h-full p-3.5"></FaGithub> <FaGithub className="btn-green w-auto h-full p-3.5"></FaGithub>
</a> </a>
@ -200,3 +208,6 @@ export const NavBar = () => {
} }

View File

@ -0,0 +1,78 @@
import React, { useEffect, useRef, useState } from 'react';
export const ToolTip = () => {
/**
* Fires when new element is mouseovered, checks if it has a tooltip attribute
* If it does, updates and unhides tooltip element after a preset timeout.
* The timout is reset if user moves off of the tooltipped element
*
* Unfortunately, new mouseover fires for svg children, which clears the
* tooltip state. We add hacky lines labelled svg workaround to bubbleup / ignore
* svg children mouseovers. We use prevTooltip ref check if new svg
* child mouseover is novel. If it's not, we ignore the event
*/
const [text, setText] = useState(null)
const ref = useRef()
const activated = useRef(false)
const timeout = useRef(null)
const prevTooltip = useRef(null) // svg workaround
useEffect(() => {
const svgChildren = ['path', 'g', 'rect', 'circle']; // svg workaround
document.addEventListener('mouseover', (e) => {
let node = e.target;
while (svgChildren.includes(node.nodeName)) { // svg workaround
node = node.parentElement // svg workaround
} // svg workaround
const tooltip = node.getAttribute("tooltip")
if (tooltip == prevTooltip.current) return // svg workaround
prevTooltip.current = tooltip // svg workaround
clearTimeout(timeout.current)
if (tooltip) {
let { left, top, width, height } = node.getBoundingClientRect()
left = left + width / 2 - getTextWidth(tooltip) / 2 - 4 // 4 is padding
top = top + height + 6 // 6 is arrow height/width
setText(tooltip)
if (activated.current) {
ref.current.setAttribute('style', `left:${left}px; top:${top}px; visibility:visible`)
} else {
timeout.current = setTimeout(() => {
ref.current.setAttribute('style', `left:${left}px; top:${top}px; visibility:visible`)
activated.current = true
}, 1000);
}
} else {
ref.current.setAttribute('style', `visibility:hidden`)
activated.current = false
}
})
}, [])
return <div className="absolute drop-down-top p-1 rounded invisible bg-gray-700 text-gray-200" ref={ref}>
{text}
<div className="arrow"></div>
</div>
}
function getTextWidth(text, font = "16px sans-serif") {
// https://stackoverflow.com/a/21015393
// re-use canvas object for better performance
let canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
let context = canvas.getContext("2d");
context.font = font;
let metrics = context.measureText(text);
return metrics.width;
}

View File

@ -19,7 +19,7 @@ export const ToolTip = () => {
const activated = useRef(false) const activated = useRef(false)
const timeout = useRef(null) const timeout = useRef(null)
const prevTooltip = useRef(null) // svg workaround // const prevTooltip = useRef(null) // svg workaround
useEffect(() => { useEffect(() => {
@ -34,8 +34,9 @@ export const ToolTip = () => {
const tooltip = node.getAttribute("tooltip") const tooltip = node.getAttribute("tooltip")
if (tooltip == prevTooltip.current) return // svg workaround // console.log(tooltip, prevTooltip.current)
prevTooltip.current = tooltip // svg workaround // if (tooltip == prevTooltip.current) return // svg workaround
// prevTooltip.current = tooltip // svg workaround
clearTimeout(timeout.current) clearTimeout(timeout.current)
if (tooltip) { if (tooltip) {
@ -49,7 +50,7 @@ export const ToolTip = () => {
timeout.current = setTimeout(() => { timeout.current = setTimeout(() => {
ref.current.setAttribute('style', `left:${left}px; top:${top}px; visibility:visible`) ref.current.setAttribute('style', `left:${left}px; top:${top}px; visibility:visible`)
activated.current = true activated.current = true
}, 1000); }, 700);
} }
} else { } else {
ref.current.setAttribute('style', `visibility:hidden`) ref.current.setAttribute('style', `visibility:hidden`)
@ -59,7 +60,7 @@ export const ToolTip = () => {
}, []) }, [])
return <div className="tooltip" ref={ref}> return <div className="absolute drop-down-top p-1 rounded invisible bg-gray-700 text-gray-200" ref={ref}>
{text} {text}
<div className="arrow"></div> <div className="arrow"></div>
</div> </div>

View File

@ -50,7 +50,7 @@ const TreeEntry = ({ entId }) => {
const [_, forceUpdate] = useReducer(x => x + 1, 0); const [_, forceUpdate] = useReducer(x => x + 1, 0);
const [mouseOn, setMouseOn] = useState(false) const [mouseOn, setMouseOn] = useState(false)
return <div className='btn select-none flex justify-start w-full h-7 items-center text-sm' return <div className='btn text-gray-200 select-none flex justify-start w-full h-7 items-center text-sm'
onDoubleClick={() => { onDoubleClick={() => {
if (obj3d.userData.type == 'sketch') { if (obj3d.userData.type == 'sketch') {
if (sc.activeSketch) { if (sc.activeSketch) {
@ -71,7 +71,6 @@ const TreeEntry = ({ entId }) => {
} }
}} }}
onPointerEnter={() => { onPointerEnter={() => {
if (mouseOn) return if (mouseOn) return
setMouseOn(true) setMouseOn(true)
@ -112,9 +111,13 @@ const TreeEntry = ({ entId }) => {
} }
sc.render() sc.render()
}} }}
tooltip= {obj3d.name[0] !='(' && "double click to edit"}
// tooltip= {obj3d.userData.name}
> >
<Icon className='h-full w-auto p-1.5' /> <Icon className='h-full w-auto p-1.5' />
<div className="btn pl-1"> <div className="pl-1">
{entId} {entId}
</div> </div>
<div className='flex h-full ml-auto'> <div className='flex h-full ml-auto'>

View File

@ -13,6 +13,7 @@ module.exports = {
current: 'currentColor', current: 'currentColor',
gray: colors.trueGray, gray: colors.trueGray,
green: colors.emerald, green: colors.emerald,
red: colors.red,
} }
}, },
variants: { variants: {