diff --git a/config/descriptions.yaml b/config/descriptions.yaml index 4a015f28a06..406173ca31e 100644 --- a/config/descriptions.yaml +++ b/config/descriptions.yaml @@ -38,6 +38,7 @@ plugin-svgattr: "A FreeSewing plugin to set SVG attributes" plugin-theme: "A FreeSewing plugin that provides a default theme" plugin-title: "A FreeSewing plugin to add a title to your pattern parts" plugin-validate: "A FreeSewing plugin that validates aspects of your code" +rendertest: "A freesewing pattern to test (y)our render engine our CSS" shin: "A FreeSewing pattern for swim trunks" simon: "A FreeSewing pattern for a button down shirt" sven: "A FreeSewing pattern for a straightforward sweater" diff --git a/packages/components/src/Draft/Circle/index.js b/packages/components/src/Draft/Circle/index.js index c1b545f375f..4e290297fce 100644 --- a/packages/components/src/Draft/Circle/index.js +++ b/packages/components/src/Draft/Circle/index.js @@ -1,17 +1,14 @@ import React, { useState } from "react"; import PropTypes from "prop-types"; -const Circle = props => { - return null; - let foo = ( - - ); -}; +const Circle = props => ( + +); Circle.propTypes = { point: PropTypes.object.isRequired diff --git a/packages/components/src/Draft/Defs/Grid/index.js b/packages/components/src/Draft/Defs/Grid/index.js new file mode 100644 index 00000000000..15249929bd1 --- /dev/null +++ b/packages/components/src/Draft/Defs/Grid/index.js @@ -0,0 +1,84 @@ +import React from "react"; + +const Grid = props => { + let style = { + style: { + fill: "none", + stroke: "currentColor" + } + }; + if (props.units === "imperial") + return ( + + + + + + + ); + else + return ( + + + + + + + + + ); +}; + +export default Grid; diff --git a/packages/components/src/Draft/Defs/Grid/logo-path.js b/packages/components/src/Draft/Defs/Grid/logo-path.js new file mode 100644 index 00000000000..fa4f373451e --- /dev/null +++ b/packages/components/src/Draft/Defs/Grid/logo-path.js @@ -0,0 +1 @@ +export default "M 35.222,0 C 34.233,0.703 34.284,0.613 33.485,0.874 31.653,1.473 29.896,1.144 27.811,0.97 27.184,0.9 26.562,0.859 25.955,0.855 22.89,0.834 20.287,1.733 19.794,4.243 18.885,4.794 18.049,5.461 17.221,6.129 15.453,7.524 14.122,9.229 13.214,11.284 11.974,14.319 13.094,17.576 13.649,20.652 13.781,21.372 13.919,22.058 13.993,22.323 14.098,22.696 14.283,23.052 14.484,23.372 14.531,23.38 14.779,22.998 14.838,22.829 14.924,22.583 14.915,22.188 14.821,21.848 14.613,21.083 14.415,20.462 14.398,20.15 14.368,19.564 14.482,19.023 14.696,18.755 14.772,18.66 14.946,19.15 14.901,19.332 14.848,19.551 14.808,19.926 14.825,20.099 14.872,20.685 14.958,21.312 15.065,21.86 15.202,22.567 15.261,23.021 15.236,23.197 15.218,23.325 15.158,23.454 14.928,23.85 14.728,24.197 14.624,24.478 14.608,24.726 14.591,24.968 14.664,25.573 14.732,25.721 14.831,25.952 15.129,26.195 15.389,26.255 15.638,26.35 15.763,26.547 15.891,26.768 16.202,27.361 16.442,28.083 16.68,29.171 16.796,29.692 16.893,30.157 16.924,30.401 15.004,30.403 12.545,30.404 10.305,30.404 9.551,30.416 8.189,30.062 6.94,29.98 6.759,28.026 5.901,25.756 4.433,25.624 3.431,25.533 2.6,25.914 1.897,27.497 L 1.917,27.582 C 2.332,27.235 2.77,26.174 4.348,26.247 5.56,26.302 5.964,28.596 6.084,29.976 5.346,30.03 4.718,30.257 4.39,30.824 L 4.383,30.824 C 4.383,30.825 4.383,30.827 4.386,30.829 4.383,30.831 4.383,30.833 4.383,30.835 L 4.39,30.835 C 4.728,31.416 5.379,31.641 6.144,31.686 6.655,46.136 20.238,48 23.95,48 37.798,48 42.646,38.59 43.375,34.863 43.716,36.451 42.642,38.474 42.385,39.967 45.306,36.59 44.778,33.343 44.244,30.077 44.688,30.605 45.289,30.932 46.104,30.751 45.523,30.363 44.735,30.635 44.263,28.998 44.057,28.291 43.879,27.761 43.702,27.316 43.32,25.883 42.778,24.514 42.112,23.18 41.55,21.733 41.921,20.795 41.865,19.553 42.876,22.887 43.508,23.774 44.688,24.123 41.72,20.547 42.736,15.01 41.059,10.068 41.818,10.514 42.684,10.648 43.606,10.103 42.714,9.849 41.824,10.52 40.544,8.639 39.463,6.536 37.897,4.983 35.997,3.613 34.979,2.949 33.849,2.503 32.713,2.089 33.87,1.799 35.162,0.769 35.222,0 z M 33.281,11.107 C 34.805,11.663 36.485,13.775 36.466,15.847 L 36.466,15.933 36.466,15.963 C 36.425,18.777 35.146,20.29 35.2,22.164 35.269,24.371 36.219,25.141 36.408,25.509 36.084,24.148 35.894,22.436 36.322,21.08 36.872,19.336 37.427,17.892 37.387,16.526 37.367,16.206 37.231,15.009 37.14,14.479 38.774,16.837 36.786,20.266 37.358,22.51 38.352,26.419 42.807,26.913 41.481,34.789 40.314,41.713 32.318,46.968 24.122,46.968 18.046,46.968 7.517,43.605 6.997,31.676 8.232,31.588 9.56,31.244 10.305,31.256 12.557,31.256 15.129,31.257 17.067,31.258 17.431,32.9 17.704,33.296 19.085,34.39 20.621,35.598 20.979,35.745 23.251,35.767 25.524,35.79 26.198,35.303 28.403,33.217 28.879,32.659 29.085,31.928 29.316,31.241 31.584,31.22 33.238,31.18 34.865,31.104 36.522,31.029 36.756,31.104 39.426,30.829 36.756,30.554 36.522,30.629 34.865,30.553 33.281,30.481 31.677,30.44 29.508,30.42 29.69,29.603 29.95,28.805 30.227,28.016 30.398,27.551 30.599,27.098 30.805,26.647 L 31.03,26.577 C 31.464,26.423 31.848,26.093 32.001,25.647 32.198,25.056 32.058,24.392 31.677,23.909 31.546,23.728 31.383,23.497 31.316,23.395 31.115,23.077 31.11,22.9 31.28,21.718 31.423,20.728 31.439,20.21 31.34,19.708 31.32,19.421 31.318,18.831 31.309,18.672 31.385,18.714 31.55,19.09 31.717,19.599 31.883,20.11 31.91,20.216 31.948,20.651 31.99,21.145 31.805,21.511 31.653,22.248 31.577,22.628 31.51,22.981 31.51,23.029 31.51,23.08 31.546,23.188 31.584,23.272 31.673,23.46 31.84,23.724 31.871,23.724 32.416,23.123 32.736,22.381 33.021,21.628 33.321,20.776 33.409,19.872 33.619,18.995 33.789,18.231 33.985,17.466 34.046,16.682 34.169,15.152 34.097,14.072 33.759,12.478 33.678,12.118 33.444,11.431 33.281,11.107 z M 27.921,18.644 C 28.506,18.637 29.085,18.708 29.636,18.867 30.385,19.154 30.49,19.823 30.628,20.574 30.705,21.054 30.702,21.399 30.615,21.963 30.554,22.781 30.229,23.414 29.519,23.859 28.448,24.057 27.303,24.248 26.395,23.539 25.633,22.489 25.174,21.162 25.349,19.868 25.46,19.337 25.707,19.061 26.215,18.896 26.762,18.739 27.341,18.653 27.921,18.644 z M 19.038,18.739 C 19.585,18.734 20.138,18.792 20.442,18.986 21.747,19.869 21.328,21.306 20.812,22.567 20.061,24.218 18.437,24.157 16.863,24.144 15.992,23.889 15.912,23.175 15.786,22.412 15.678,21.675 15.448,20.885 15.64,20.144 16.133,18.952 17.935,18.815 19.038,18.739 z M 38.941,18.945 C 38.948,22.118 39.49,23.677 40.578,25.924 39.937,24.701 39.021,24.005 38.68,22.543 38.028,19.72 38.731,19.878 38.941,18.945 z M 23.128,21.243 C 23.3,21.417 23.383,21.657 23.532,21.848 23.647,21.651 23.765,21.455 23.913,21.28 23.99,21.282 24.084,21.434 24.169,21.706 24.533,22.712 24.604,23.819 25.076,24.786 25.517,25.486 24.915,25.894 24.254,25.926 23.772,25.925 23.568,25.596 23.285,25.27 23.212,25.483 23.073,25.62 22.907,25.764 22.485,26.118 21.658,25.987 21.53,25.429 21.7,24.363 22.243,23.384 22.599,22.362 22.776,21.989 22.778,21.703 23.128,21.243 z M 16.936,26.628 C 17.149,26.628 17.734,27.025 17.853,27.249 17.935,27.398 18.122,27.978 18.135,28.119 18.156,28.287 18.105,28.685 18.053,28.793 18.015,28.87 17.986,28.881 17.942,28.831 17.905,28.789 17.415,27.849 17.102,27.227 16.856,26.729 16.83,26.628 16.936,26.628 z M 29.158,26.939 C 29.166,26.94 29.178,26.943 29.189,26.946 29.255,26.973 29.209,27.207 28.961,28.057 28.914,28.313 28.8,28.515 28.633,28.683 28.578,28.683 28.553,28.619 28.467,28.264 28.394,27.961 28.386,27.691 28.437,27.449 28.525,27.146 28.881,27.053 29.158,26.939 z M 27.675,28.792 C 27.696,28.788 27.716,28.799 27.742,28.82 27.832,28.883 27.845,29.049 27.785,29.374 27.712,29.792 27.696,29.838 27.588,29.881 27.541,29.902 27.457,29.917 27.401,29.917 27.3,29.899 27.274,29.817 27.298,29.693 27.298,29.433 27.374,29.207 27.546,28.94 27.611,28.84 27.644,28.797 27.675,28.792 z M 19.042,28.811 C 19.111,28.811 19.319,28.961 19.396,29.065 19.482,29.175 19.58,29.83 19.525,29.943 19.462,30.085 19.154,30.014 19.069,29.837 19.017,29.731 18.894,29.159 18.894,29.023 18.894,28.897 18.955,28.811 19.042,28.811 z M 26.933,28.984 C 27.017,29.104 27.039,29.258 27.021,29.596 L 27.004,29.904 26.916,29.992 C 26.863,30.041 26.773,30.101 26.719,30.126 26.6,30.182 26.509,30.187 26.492,30.142 26.472,30.082 26.506,29.7 26.543,29.571 26.586,29.438 26.779,29.041 26.843,28.957 26.872,28.88 26.906,28.976 26.933,28.984 z M 21.912,28.966 C 22.093,29.012 22.173,29.175 22.272,29.323 L 22.339,29.455 22.245,29.782 C 22.195,29.962 22.142,30.124 22.126,30.142 22.108,30.162 22.041,30.172 21.942,30.171 21.678,30.164 21.648,30.153 21.577,30.045 L 21.511,29.947 21.567,29.672 C 21.648,29.276 21.687,29.157 21.777,29.055 21.824,29 21.871,28.97 21.912,28.966 z M 20.241,29.249 20.39,29.398 20.415,29.735 C 20.428,29.919 20.434,30.09 20.424,30.111 20.415,30.14 20.361,30.148 20.194,30.148 L 19.977,30.148 C 19.861,30.021 19.825,29.866 19.776,29.706 19.662,29.225 19.662,29.006 19.78,28.977 19.973,28.989 20.1,29.129 20.241,29.249 z M 26.041,29.018 C 26.277,29.081 26.23,29.456 26.229,29.724 26.211,30.158 26.194,30.248 26.138,30.304 26.041,30.401 25.771,30.347 25.64,30.203 25.597,30.151 25.593,30.135 25.627,29.924 25.666,29.667 25.716,29.507 25.827,29.287 25.908,29.129 25.984,29.03 26.041,29.018 z M 20.715,29.038 C 20.728,29.037 20.749,29.038 20.769,29.04 20.919,29.052 21.059,29.15 21.183,29.33 L 21.283,29.477 C 21.292,29.718 21.283,29.972 21.24,30.196 21.214,30.209 21.106,30.229 21,30.239 20.816,30.256 20.799,30.252 20.735,30.196 20.646,30.12 20.621,29.979 20.599,29.511 20.586,29.129 20.595,29.044 20.715,29.038 z M 22.984,29.118 C 23.145,29.152 23.247,29.238 23.292,29.379 23.328,29.5 23.35,30.177 23.315,30.224 23.303,30.244 23.227,30.269 23.14,30.28 22.816,30.321 22.53,30.29 22.502,30.213 22.466,30.125 22.707,29.253 22.796,29.145 22.834,29.061 22.926,29.126 22.984,29.118 z M 25.082,29.124 C 25.153,29.117 25.229,29.185 25.303,29.33 25.363,29.451 25.372,29.493 25.372,29.764 25.372,29.98 25.359,30.073 25.336,30.093 25.316,30.109 25.235,30.138 25.149,30.16 24.999,30.199 24.966,30.203 24.919,30.187 L 24.694,30.146 24.711,30.012 C 24.727,29.837 24.842,29.449 24.923,29.281 24.971,29.181 25.026,29.131 25.082,29.124 z M 24.104,29.127 C 24.151,29.125 24.173,29.136 24.203,29.169 24.274,29.253 24.364,29.501 24.421,29.766 24.497,30.139 24.497,30.138 24.334,30.187 24.263,30.209 24.113,30.232 24.006,30.238 23.653,30.256 23.626,30.235 23.669,29.923 23.703,29.645 23.84,29.207 23.899,29.175 23.963,29.141 24.037,29.142 24.104,29.127 z M 6.111,30.536 C 6.114,30.535 6.118,30.536 6.118,30.536 6.127,30.731 6.127,30.928 6.131,31.124 5.636,31.086 5.272,30.968 5.272,30.829 5.272,30.692 5.623,30.575 6.111,30.536 z M 6.976,30.553 C 7.377,30.603 7.654,30.708 7.649,30.829 7.649,30.951 7.381,31.055 6.983,31.104 6.979,30.921 6.979,30.737 6.976,30.553 z M 25.702,31.086 C 25.736,31.083 25.751,31.08 25.803,31.085 26.011,31.106 26.041,31.119 26.041,31.189 26.041,31.281 25.883,31.558 25.776,31.654 25.726,31.702 25.657,31.742 25.633,31.742 25.513,31.742 25.443,31.489 25.499,31.256 25.533,31.13 25.595,31.091 25.702,31.086 z M 24.947,31.169 C 25.04,31.161 25.13,31.186 25.22,31.198 25.194,31.461 25.076,31.676 24.857,31.819 24.803,31.819 24.776,31.716 24.776,31.491 24.776,31.223 24.79,31.172 24.947,31.169 z M 24.119,31.266 C 24.312,31.266 24.482,31.275 24.49,31.286 24.526,31.32 24.422,31.578 24.269,31.84 24.138,32.073 24.119,32.09 24.038,32.096 23.72,32.06 23.729,31.687 23.68,31.431 23.68,31.279 23.714,31.266 24.119,31.266 z M 21.11,31.295 C 21.331,31.299 21.417,31.332 21.417,31.417 21.417,31.525 21.335,31.74 21.288,31.767 21.217,31.806 21.211,31.804 21.071,31.658 20.85,31.41 20.825,31.364 21.11,31.295 z M 22.174,31.306 C 22.178,31.312 22.221,31.39 22.264,31.478 22.358,31.661 22.365,31.741 22.298,31.802 22.14,31.892 22.107,31.841 21.964,31.75 21.798,31.593 21.667,31.382 21.71,31.338 21.858,31.285 22.021,31.305 22.174,31.306 z M 22.596,31.311 22.991,31.318 C 23.145,31.318 23.278,31.326 23.285,31.338 23.312,31.362 23.225,31.876 23.178,31.992 23.124,32.122 22.935,32.123 22.837,31.969 22.697,31.748 22.605,31.562 22.602,31.434 L 22.596,31.311 z"; diff --git a/packages/components/src/Draft/Defs/Markers/index.js b/packages/components/src/Draft/Defs/Markers/index.js new file mode 100644 index 00000000000..d8fb5af39fe --- /dev/null +++ b/packages/components/src/Draft/Defs/Markers/index.js @@ -0,0 +1,34 @@ +import React from "react"; + +const Markers = props => { + const markerProps = { + orient: "auto", + refX: "0.0", + refY: "0.0", + style: { overflow: "visible" } + }; + const from = { d: "M 0,0 L 12,-4 C 10,-2 10,2 12, 4 z" }; + const to = { d: "M 0,0 L -12,-4 C -10,-2 -10,2 -12, 4 z" }; + const types = { + grainline: "note", + cutonfold: "note", + dimension: "mark" + }; + let output = []; + for (let type in types) { + output.push( + + + + ); + output.push( + + + + ); + } + + return output; +}; + +export default Markers; diff --git a/packages/components/src/Draft/Defs/Snippets/index.js b/packages/components/src/Draft/Defs/Snippets/index.js new file mode 100644 index 00000000000..be991625adf --- /dev/null +++ b/packages/components/src/Draft/Defs/Snippets/index.js @@ -0,0 +1,41 @@ +import React from "react"; +import logoPathString from "./logo-path"; + +const Snippets = props => { + const fill = { fill: "currentColor", stroke: "none" }; + const stroke = { fill: "none", stroke: "currentColor" }; + return [ + + + + , + + + + , + + /> + + + + + , + + + + , + + ]; +}; + +export default Snippets; diff --git a/packages/components/src/Draft/Defs/Snippets/logo-path.js b/packages/components/src/Draft/Defs/Snippets/logo-path.js new file mode 100644 index 00000000000..fa4f373451e --- /dev/null +++ b/packages/components/src/Draft/Defs/Snippets/logo-path.js @@ -0,0 +1 @@ +export default "M 35.222,0 C 34.233,0.703 34.284,0.613 33.485,0.874 31.653,1.473 29.896,1.144 27.811,0.97 27.184,0.9 26.562,0.859 25.955,0.855 22.89,0.834 20.287,1.733 19.794,4.243 18.885,4.794 18.049,5.461 17.221,6.129 15.453,7.524 14.122,9.229 13.214,11.284 11.974,14.319 13.094,17.576 13.649,20.652 13.781,21.372 13.919,22.058 13.993,22.323 14.098,22.696 14.283,23.052 14.484,23.372 14.531,23.38 14.779,22.998 14.838,22.829 14.924,22.583 14.915,22.188 14.821,21.848 14.613,21.083 14.415,20.462 14.398,20.15 14.368,19.564 14.482,19.023 14.696,18.755 14.772,18.66 14.946,19.15 14.901,19.332 14.848,19.551 14.808,19.926 14.825,20.099 14.872,20.685 14.958,21.312 15.065,21.86 15.202,22.567 15.261,23.021 15.236,23.197 15.218,23.325 15.158,23.454 14.928,23.85 14.728,24.197 14.624,24.478 14.608,24.726 14.591,24.968 14.664,25.573 14.732,25.721 14.831,25.952 15.129,26.195 15.389,26.255 15.638,26.35 15.763,26.547 15.891,26.768 16.202,27.361 16.442,28.083 16.68,29.171 16.796,29.692 16.893,30.157 16.924,30.401 15.004,30.403 12.545,30.404 10.305,30.404 9.551,30.416 8.189,30.062 6.94,29.98 6.759,28.026 5.901,25.756 4.433,25.624 3.431,25.533 2.6,25.914 1.897,27.497 L 1.917,27.582 C 2.332,27.235 2.77,26.174 4.348,26.247 5.56,26.302 5.964,28.596 6.084,29.976 5.346,30.03 4.718,30.257 4.39,30.824 L 4.383,30.824 C 4.383,30.825 4.383,30.827 4.386,30.829 4.383,30.831 4.383,30.833 4.383,30.835 L 4.39,30.835 C 4.728,31.416 5.379,31.641 6.144,31.686 6.655,46.136 20.238,48 23.95,48 37.798,48 42.646,38.59 43.375,34.863 43.716,36.451 42.642,38.474 42.385,39.967 45.306,36.59 44.778,33.343 44.244,30.077 44.688,30.605 45.289,30.932 46.104,30.751 45.523,30.363 44.735,30.635 44.263,28.998 44.057,28.291 43.879,27.761 43.702,27.316 43.32,25.883 42.778,24.514 42.112,23.18 41.55,21.733 41.921,20.795 41.865,19.553 42.876,22.887 43.508,23.774 44.688,24.123 41.72,20.547 42.736,15.01 41.059,10.068 41.818,10.514 42.684,10.648 43.606,10.103 42.714,9.849 41.824,10.52 40.544,8.639 39.463,6.536 37.897,4.983 35.997,3.613 34.979,2.949 33.849,2.503 32.713,2.089 33.87,1.799 35.162,0.769 35.222,0 z M 33.281,11.107 C 34.805,11.663 36.485,13.775 36.466,15.847 L 36.466,15.933 36.466,15.963 C 36.425,18.777 35.146,20.29 35.2,22.164 35.269,24.371 36.219,25.141 36.408,25.509 36.084,24.148 35.894,22.436 36.322,21.08 36.872,19.336 37.427,17.892 37.387,16.526 37.367,16.206 37.231,15.009 37.14,14.479 38.774,16.837 36.786,20.266 37.358,22.51 38.352,26.419 42.807,26.913 41.481,34.789 40.314,41.713 32.318,46.968 24.122,46.968 18.046,46.968 7.517,43.605 6.997,31.676 8.232,31.588 9.56,31.244 10.305,31.256 12.557,31.256 15.129,31.257 17.067,31.258 17.431,32.9 17.704,33.296 19.085,34.39 20.621,35.598 20.979,35.745 23.251,35.767 25.524,35.79 26.198,35.303 28.403,33.217 28.879,32.659 29.085,31.928 29.316,31.241 31.584,31.22 33.238,31.18 34.865,31.104 36.522,31.029 36.756,31.104 39.426,30.829 36.756,30.554 36.522,30.629 34.865,30.553 33.281,30.481 31.677,30.44 29.508,30.42 29.69,29.603 29.95,28.805 30.227,28.016 30.398,27.551 30.599,27.098 30.805,26.647 L 31.03,26.577 C 31.464,26.423 31.848,26.093 32.001,25.647 32.198,25.056 32.058,24.392 31.677,23.909 31.546,23.728 31.383,23.497 31.316,23.395 31.115,23.077 31.11,22.9 31.28,21.718 31.423,20.728 31.439,20.21 31.34,19.708 31.32,19.421 31.318,18.831 31.309,18.672 31.385,18.714 31.55,19.09 31.717,19.599 31.883,20.11 31.91,20.216 31.948,20.651 31.99,21.145 31.805,21.511 31.653,22.248 31.577,22.628 31.51,22.981 31.51,23.029 31.51,23.08 31.546,23.188 31.584,23.272 31.673,23.46 31.84,23.724 31.871,23.724 32.416,23.123 32.736,22.381 33.021,21.628 33.321,20.776 33.409,19.872 33.619,18.995 33.789,18.231 33.985,17.466 34.046,16.682 34.169,15.152 34.097,14.072 33.759,12.478 33.678,12.118 33.444,11.431 33.281,11.107 z M 27.921,18.644 C 28.506,18.637 29.085,18.708 29.636,18.867 30.385,19.154 30.49,19.823 30.628,20.574 30.705,21.054 30.702,21.399 30.615,21.963 30.554,22.781 30.229,23.414 29.519,23.859 28.448,24.057 27.303,24.248 26.395,23.539 25.633,22.489 25.174,21.162 25.349,19.868 25.46,19.337 25.707,19.061 26.215,18.896 26.762,18.739 27.341,18.653 27.921,18.644 z M 19.038,18.739 C 19.585,18.734 20.138,18.792 20.442,18.986 21.747,19.869 21.328,21.306 20.812,22.567 20.061,24.218 18.437,24.157 16.863,24.144 15.992,23.889 15.912,23.175 15.786,22.412 15.678,21.675 15.448,20.885 15.64,20.144 16.133,18.952 17.935,18.815 19.038,18.739 z M 38.941,18.945 C 38.948,22.118 39.49,23.677 40.578,25.924 39.937,24.701 39.021,24.005 38.68,22.543 38.028,19.72 38.731,19.878 38.941,18.945 z M 23.128,21.243 C 23.3,21.417 23.383,21.657 23.532,21.848 23.647,21.651 23.765,21.455 23.913,21.28 23.99,21.282 24.084,21.434 24.169,21.706 24.533,22.712 24.604,23.819 25.076,24.786 25.517,25.486 24.915,25.894 24.254,25.926 23.772,25.925 23.568,25.596 23.285,25.27 23.212,25.483 23.073,25.62 22.907,25.764 22.485,26.118 21.658,25.987 21.53,25.429 21.7,24.363 22.243,23.384 22.599,22.362 22.776,21.989 22.778,21.703 23.128,21.243 z M 16.936,26.628 C 17.149,26.628 17.734,27.025 17.853,27.249 17.935,27.398 18.122,27.978 18.135,28.119 18.156,28.287 18.105,28.685 18.053,28.793 18.015,28.87 17.986,28.881 17.942,28.831 17.905,28.789 17.415,27.849 17.102,27.227 16.856,26.729 16.83,26.628 16.936,26.628 z M 29.158,26.939 C 29.166,26.94 29.178,26.943 29.189,26.946 29.255,26.973 29.209,27.207 28.961,28.057 28.914,28.313 28.8,28.515 28.633,28.683 28.578,28.683 28.553,28.619 28.467,28.264 28.394,27.961 28.386,27.691 28.437,27.449 28.525,27.146 28.881,27.053 29.158,26.939 z M 27.675,28.792 C 27.696,28.788 27.716,28.799 27.742,28.82 27.832,28.883 27.845,29.049 27.785,29.374 27.712,29.792 27.696,29.838 27.588,29.881 27.541,29.902 27.457,29.917 27.401,29.917 27.3,29.899 27.274,29.817 27.298,29.693 27.298,29.433 27.374,29.207 27.546,28.94 27.611,28.84 27.644,28.797 27.675,28.792 z M 19.042,28.811 C 19.111,28.811 19.319,28.961 19.396,29.065 19.482,29.175 19.58,29.83 19.525,29.943 19.462,30.085 19.154,30.014 19.069,29.837 19.017,29.731 18.894,29.159 18.894,29.023 18.894,28.897 18.955,28.811 19.042,28.811 z M 26.933,28.984 C 27.017,29.104 27.039,29.258 27.021,29.596 L 27.004,29.904 26.916,29.992 C 26.863,30.041 26.773,30.101 26.719,30.126 26.6,30.182 26.509,30.187 26.492,30.142 26.472,30.082 26.506,29.7 26.543,29.571 26.586,29.438 26.779,29.041 26.843,28.957 26.872,28.88 26.906,28.976 26.933,28.984 z M 21.912,28.966 C 22.093,29.012 22.173,29.175 22.272,29.323 L 22.339,29.455 22.245,29.782 C 22.195,29.962 22.142,30.124 22.126,30.142 22.108,30.162 22.041,30.172 21.942,30.171 21.678,30.164 21.648,30.153 21.577,30.045 L 21.511,29.947 21.567,29.672 C 21.648,29.276 21.687,29.157 21.777,29.055 21.824,29 21.871,28.97 21.912,28.966 z M 20.241,29.249 20.39,29.398 20.415,29.735 C 20.428,29.919 20.434,30.09 20.424,30.111 20.415,30.14 20.361,30.148 20.194,30.148 L 19.977,30.148 C 19.861,30.021 19.825,29.866 19.776,29.706 19.662,29.225 19.662,29.006 19.78,28.977 19.973,28.989 20.1,29.129 20.241,29.249 z M 26.041,29.018 C 26.277,29.081 26.23,29.456 26.229,29.724 26.211,30.158 26.194,30.248 26.138,30.304 26.041,30.401 25.771,30.347 25.64,30.203 25.597,30.151 25.593,30.135 25.627,29.924 25.666,29.667 25.716,29.507 25.827,29.287 25.908,29.129 25.984,29.03 26.041,29.018 z M 20.715,29.038 C 20.728,29.037 20.749,29.038 20.769,29.04 20.919,29.052 21.059,29.15 21.183,29.33 L 21.283,29.477 C 21.292,29.718 21.283,29.972 21.24,30.196 21.214,30.209 21.106,30.229 21,30.239 20.816,30.256 20.799,30.252 20.735,30.196 20.646,30.12 20.621,29.979 20.599,29.511 20.586,29.129 20.595,29.044 20.715,29.038 z M 22.984,29.118 C 23.145,29.152 23.247,29.238 23.292,29.379 23.328,29.5 23.35,30.177 23.315,30.224 23.303,30.244 23.227,30.269 23.14,30.28 22.816,30.321 22.53,30.29 22.502,30.213 22.466,30.125 22.707,29.253 22.796,29.145 22.834,29.061 22.926,29.126 22.984,29.118 z M 25.082,29.124 C 25.153,29.117 25.229,29.185 25.303,29.33 25.363,29.451 25.372,29.493 25.372,29.764 25.372,29.98 25.359,30.073 25.336,30.093 25.316,30.109 25.235,30.138 25.149,30.16 24.999,30.199 24.966,30.203 24.919,30.187 L 24.694,30.146 24.711,30.012 C 24.727,29.837 24.842,29.449 24.923,29.281 24.971,29.181 25.026,29.131 25.082,29.124 z M 24.104,29.127 C 24.151,29.125 24.173,29.136 24.203,29.169 24.274,29.253 24.364,29.501 24.421,29.766 24.497,30.139 24.497,30.138 24.334,30.187 24.263,30.209 24.113,30.232 24.006,30.238 23.653,30.256 23.626,30.235 23.669,29.923 23.703,29.645 23.84,29.207 23.899,29.175 23.963,29.141 24.037,29.142 24.104,29.127 z M 6.111,30.536 C 6.114,30.535 6.118,30.536 6.118,30.536 6.127,30.731 6.127,30.928 6.131,31.124 5.636,31.086 5.272,30.968 5.272,30.829 5.272,30.692 5.623,30.575 6.111,30.536 z M 6.976,30.553 C 7.377,30.603 7.654,30.708 7.649,30.829 7.649,30.951 7.381,31.055 6.983,31.104 6.979,30.921 6.979,30.737 6.976,30.553 z M 25.702,31.086 C 25.736,31.083 25.751,31.08 25.803,31.085 26.011,31.106 26.041,31.119 26.041,31.189 26.041,31.281 25.883,31.558 25.776,31.654 25.726,31.702 25.657,31.742 25.633,31.742 25.513,31.742 25.443,31.489 25.499,31.256 25.533,31.13 25.595,31.091 25.702,31.086 z M 24.947,31.169 C 25.04,31.161 25.13,31.186 25.22,31.198 25.194,31.461 25.076,31.676 24.857,31.819 24.803,31.819 24.776,31.716 24.776,31.491 24.776,31.223 24.79,31.172 24.947,31.169 z M 24.119,31.266 C 24.312,31.266 24.482,31.275 24.49,31.286 24.526,31.32 24.422,31.578 24.269,31.84 24.138,32.073 24.119,32.09 24.038,32.096 23.72,32.06 23.729,31.687 23.68,31.431 23.68,31.279 23.714,31.266 24.119,31.266 z M 21.11,31.295 C 21.331,31.299 21.417,31.332 21.417,31.417 21.417,31.525 21.335,31.74 21.288,31.767 21.217,31.806 21.211,31.804 21.071,31.658 20.85,31.41 20.825,31.364 21.11,31.295 z M 22.174,31.306 C 22.178,31.312 22.221,31.39 22.264,31.478 22.358,31.661 22.365,31.741 22.298,31.802 22.14,31.892 22.107,31.841 21.964,31.75 21.798,31.593 21.667,31.382 21.71,31.338 21.858,31.285 22.021,31.305 22.174,31.306 z M 22.596,31.311 22.991,31.318 C 23.145,31.318 23.278,31.326 23.285,31.338 23.312,31.362 23.225,31.876 23.178,31.992 23.124,32.122 22.935,32.123 22.837,31.969 22.697,31.748 22.605,31.562 22.602,31.434 L 22.596,31.311 z"; diff --git a/packages/components/src/Draft/Defs/index.js b/packages/components/src/Draft/Defs/index.js index ef1af9be95d..9728796238f 100644 --- a/packages/components/src/Draft/Defs/index.js +++ b/packages/components/src/Draft/Defs/index.js @@ -1,9 +1,37 @@ -import React, { useState } from "react"; -import PropTypes from "prop-types"; +import React from "react"; +import Markers from "./Markers"; +import Snippets from "./Snippets"; +import Grid from "./Grid"; -const Defs = props => {props.defs}; - -Defs.propTypes = { defs: PropTypes.string }; -Defs.defaultProps = { defs: "" }; +const Defs = props => { + let paperlessGrids = null; + if (props.paperless) { + paperlessGrids = []; + for (let p in props.parts) { + let anchor = { x: 0, y: 0 }; + if (typeof props.parts[p].points.gridAnchor !== "undefined") + anchor = props.parts[p].points.gridAnchor; + else if (typeof props.parts[p].points.anchor !== "undefined") + anchor = props.parts[p].points.anchor; + paperlessGrids.push( + + ); + } + } + return ( + + + + + {paperlessGrids} + + ); +}; export default Defs; diff --git a/packages/components/src/Draft/Part/index.js b/packages/components/src/Draft/Part/index.js index 6153d537e7b..06b3a925fa2 100644 --- a/packages/components/src/Draft/Part/index.js +++ b/packages/components/src/Draft/Part/index.js @@ -2,21 +2,45 @@ import React, { useState } from "react"; import PropTypes from "prop-types"; import Path from "../Path"; import Point from "../Point"; +import Snippet from "../Snippet"; import { getProps } from "../utils"; const Part = props => { + console.log(props.part); + let grid = props.paperless ? ( + + ) : null; + return ( + {grid} {Object.keys(props.part.points).map(name => ( ))} {Object.keys(props.part.paths).map(name => ( - + + ))} + {Object.keys(props.part.snippets).map(name => ( + ))} ); @@ -25,7 +49,9 @@ const Part = props => { Part.propTypes = { part: PropTypes.object.isRequired, name: PropTypes.string.isRequired, - language: PropTypes.string.isRequired + language: PropTypes.string.isRequired, + paperless: PropTypes.bool.isRequired, + units: PropTypes.oneOf(["metric", "imperial"]).isRequired }; export default Part; diff --git a/packages/components/src/Draft/Path/index.js b/packages/components/src/Draft/Path/index.js index 44d73c7a30a..e6da5cec3f9 100644 --- a/packages/components/src/Draft/Path/index.js +++ b/packages/components/src/Draft/Path/index.js @@ -1,14 +1,36 @@ import React, { useState } from "react"; import PropTypes from "prop-types"; +import TextOnPath from "../TextOnPath"; import { getProps } from "../utils"; const Path = props => { if (!props.path.render) return null; - return ; + const output = []; + const pathId = "path-" + props.part + "-" + props.name; + output.push( + + ); + if (props.path.attributes.get("data-text")) + output.push( + + ); + + return output; }; Path.propTypes = { - path: PropTypes.object.isRequired + path: PropTypes.object.isRequired, + name: PropTypes.string.isRequired, + language: PropTypes.string.isRequired }; export default Path; diff --git a/packages/components/src/Draft/Snippet/index.js b/packages/components/src/Draft/Snippet/index.js new file mode 100644 index 00000000000..8d9c19bcaaa --- /dev/null +++ b/packages/components/src/Draft/Snippet/index.js @@ -0,0 +1,39 @@ +import React, { useState } from "react"; +import PropTypes from "prop-types"; +import Text from "../Text"; +import Circle from "../Circle"; + +const Snippet = props => { + const snippetProps = { + xlinkHref: "#" + props.snippet.def, + x: props.snippet.anchor.x, + y: props.snippet.anchor.y + }; + let scale = props.snippet.attributes.get("data-scale"); + let rotate = props.snippet.attributes.get("data-rotate"); + if (scale || rotate) { + snippetProps.transform = ""; + if (scale) { + snippetProps.transform += `translate(${snippetProps.x}, ${ + snippetProps.y + }) `; + snippetProps.transform += `scale(${scale}) `; + snippetProps.transform += `translate(${snippetProps.x * + -1}, ${snippetProps.y * -1}) `; + } + if (rotate) { + snippetProps.transform += `rotate(${rotate}, ${snippetProps.x}, ${ + snippetProps.y + }) `; + } + } + + return ; +}; + +Snippet.propTypes = { + snippet: PropTypes.object.isRequired, + name: PropTypes.string.isRequired +}; + +export default Snippet; diff --git a/packages/components/src/Draft/Text/index.js b/packages/components/src/Draft/Text/index.js index a6bbb3abf20..84f53adbe99 100644 --- a/packages/components/src/Draft/Text/index.js +++ b/packages/components/src/Draft/Text/index.js @@ -30,7 +30,6 @@ const Text = props => { ); } } else text.push({translated}); - return null; return ( { }; Text.propTypes = { - point: PropTypes.object.isRequired + point: PropTypes.object.isRequired, + language: PropTypes.string.isRequired }; export default Text; diff --git a/packages/components/src/Draft/TextOnPath/index.js b/packages/components/src/Draft/TextOnPath/index.js new file mode 100644 index 00000000000..52e0d64ed17 --- /dev/null +++ b/packages/components/src/Draft/TextOnPath/index.js @@ -0,0 +1,40 @@ +import React, { useState } from "react"; +import PropTypes from "prop-types"; +import { strings } from "@freesewing/i18n"; + +const TextOnPath = props => { + let text = []; + // Handle translation + let translated = ""; + for (let string of props.path.attributes.getAsArray("data-text")) { + if (strings[props.language]["plugin." + string]) + translated += strings[props.language]["plugin." + string]; + else translated += string; + translated += " "; + } + let textPathProps = { + xlinkHref: "#" + props.pathId, + startOffset: "0%" + }; + let align = props.path.attributes.get("data-text-class"); + if (align && align.indexOf("center") > -1) textPathProps.startOffset = "50%"; + else if (align && align.indexOf("right") > -1) + textPathProps.startOffset = "100%"; + + return ( + + + + {translated} + + + + ); +}; + +TextOnPath.propTypes = { + path: PropTypes.object.isRequired, + language: PropTypes.string.isRequired +}; + +export default TextOnPath; diff --git a/packages/components/src/Draft/draft.scss b/packages/components/src/Draft/draft.scss deleted file mode 100644 index c2fdb84129a..00000000000 --- a/packages/components/src/Draft/draft.scss +++ /dev/null @@ -1,93 +0,0 @@ -svg.freesewing { - /* Reset */ - path,circle,rect{fill:none;stroke:none} - - /* Defaults */ - path,circle{ - stroke:#000; - stroke-opacity:1; - stroke-width:.3; - stroke-linecap:round; - stroke-linejoin:round; - } - - /* Stroke classes */ - .fabric{ - stroke-width:.6; - stroke:#212121 - } - .lining{ - stroke-width:.6; - stroke:#ff5b77; - } - .interfacing{ - stroke-width:.6; - stroke:#64b5f6; - } - .canvas{ - stroke-width:.6; - stroke:#ff9000; - } - .various{ - stroke-width:.6; - stroke:#4caf50; - } - .note{ - stroke-width:.4; - stroke:#dd60dd; - } - .mark{ - stroke-width:.4; - stroke:blue; - } - .contrast{ - stroke-width:.8; - stroke:red; - } - .stroke-xs{ stroke-width:.1; } - .stroke-sm{ stroke-width:.2; } - .stroke-lg{ stroke-width:.6; } - .stroke-xl{ stroke-width:1; } - .stroke-xxl{ stroke-width:2; } - - .sa { stroke-dasharray:0.4,0.8; } - .help { - stroke-width:.2; - stroke-dasharray:15,1.5,1,1.5; - } - .dotted { stroke-dasharray:0.4,0.8; } - .dashed { stroke-dasharray:1,1.5; } - .lashed { stroke-dasharray:6,6; } - .hidden { - stroke:none; - fill:none; - } - - /* Fill classes */ - .fill-fabric{ fill:#212121; } - .fill-lining{ fill:#ff5b77; } - .fill-interfacing{ fill:#64b5f6; } - .fill-canvas{ fill:#ff9000; } - .fill-various{ fill:#4caf50; } - .fill-note{ fill:#dd69dd; } - .fill-mark{ fill:blue; } - .fill-contrast{ fill:red; } - - /* Text */ - text{ - font-size:5px; - font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; - fill:#000; - text-anchor:start; - font-weight:200; - dominant-baseline:ideographic; - } - .text-xs { font-size:3px; } - .text-sm { font-size:4px; } - .text-lg { font-size:7px; } - .text-xl { font-size:9px; } - .text-xxl{ font-size:12px; } - - .center{ text-anchor:middle; } - .right{ text-anchor:end; } -} diff --git a/packages/components/src/Draft/index.js b/packages/components/src/Draft/index.js index c17d7ca265b..7ed2390c494 100644 --- a/packages/components/src/Draft/index.js +++ b/packages/components/src/Draft/index.js @@ -1,8 +1,7 @@ import React, { useState } from "react"; import PropTypes from "prop-types"; import Svg from "./Svg"; -//import Style from "./Style"; -//import Defs from "./Defs"; +import Defs from "./Defs"; import Part from "./Part"; const Draft = props => { @@ -14,11 +13,18 @@ const Draft = props => { language={props.settings.locale} id={props.settings.idPrefix + "svg"} > + {Object.keys(props.parts).map(name => ( diff --git a/packages/components/src/DraftConfigurator/OptionGroup/index.js b/packages/components/src/DraftConfigurator/OptionGroup/index.js index 928774c9988..2e43fbc10a9 100644 --- a/packages/components/src/DraftConfigurator/OptionGroup/index.js +++ b/packages/components/src/DraftConfigurator/OptionGroup/index.js @@ -51,7 +51,7 @@ const OptionGroup = props => { return ; break; default: - throw new Error("Unsupport option type: " + type); + throw new Error("Unsupported option type: " + type); } }; diff --git a/packages/components/src/Footer/index.js b/packages/components/src/Footer/index.js index 97d4f403bfc..267f6bc5190 100644 --- a/packages/components/src/Footer/index.js +++ b/packages/components/src/Footer/index.js @@ -64,7 +64,7 @@ const Footer = props => { ); } return ( -
+

diff --git a/packages/components/src/Workbench/index.js b/packages/components/src/Workbench/index.js index 933cd28aa35..8e6bfa35c49 100644 --- a/packages/components/src/Workbench/index.js +++ b/packages/components/src/Workbench/index.js @@ -58,6 +58,7 @@ const Workbench = props => { }; const measurementsMissing = () => { let required = props.config.measurements; + if (required.length < 1) return false; if (measurements === null) return true; for (let m of required) { if (typeof measurements[m] === "undefined") return true; diff --git a/packages/core/src/pattern.js b/packages/core/src/pattern.js index 143a598470a..c086f1c7e14 100644 --- a/packages/core/src/pattern.js +++ b/packages/core/src/pattern.js @@ -595,7 +595,7 @@ Pattern.prototype.getRenderProps = function() { props.parts[p] = { paths: this.parts[p].paths, points: this.parts[p].points, - snippets: this.parts[p].points, + snippets: this.parts[p].snippets, attributes: this.parts[p].attributes, height: this.parts[p].height, width: this.parts[p].width, diff --git a/packages/css-theme/src/_variables.scss b/packages/css-theme/src/_variables.scss index b5c71e37e80..b6717671ae6 100644 --- a/packages/css-theme/src/_variables.scss +++ b/packages/css-theme/src/_variables.scss @@ -11,14 +11,14 @@ $fc-accentbg-dark: $oc-teal-8; $fc-link-light: $oc-blue-6; $fc-link-dark: $oc-blue-3; -$fc-draft-lining-light: $oc-teal-6; $fc-draft-fabric-light: $oc-gray-9; +$fc-draft-lining-light: $oc-lime-7; +$fc-draft-interfacing-light: $oc-red-7; $fc-draft-canvas-light: $oc-yellow-7; -$fc-draft-interfacing-light: $oc-gray-6; -$fc-draft-various-light: $oc-pink-5; -$fc-draft-mark-light: $oc-indigo-6; +$fc-draft-various-light: $oc-grape-7; +$fc-draft-mark-light: $oc-blue-4; $fc-draft-contrast-light: $oc-orange-7; -$fc-draft-note-light: $oc-blue-7; +$fc-draft-note-light: $oc-pink-7; $fc-draft-lining-dark: $oc-teal-6; $fc-draft-fabric-dark: $oc-gray-9; diff --git a/packages/css-theme/src/components/_draft.scss b/packages/css-theme/src/components/_draft.scss index 5e03c7f37c9..8fa1b0d6cee 100644 --- a/packages/css-theme/src/components/_draft.scss +++ b/packages/css-theme/src/components/_draft.scss @@ -1,8 +1,7 @@ svg.freesewing.draft { max-width: 100%; - max-height: 90vh; /* Reset */ - path,circle,rect{fill:none;stroke:none} + path,circle{fill:none;stroke:none} /* Defaults */ path,circle{ @@ -13,25 +12,22 @@ svg.freesewing.draft { } /* Stroke classes */ - .note{ stroke-width:.8; } - .mark{ stroke-width:.8; } - .contrast{ stroke-width:1.2; } - .stroke-xs{ stroke-width:.5; } - .stroke-sm{ stroke-width:.5; } - .stroke-xl{ stroke-width:1.4; } - .stroke-xxl{ stroke-width:2.4; } + .stroke-xs{ stroke-width:.1; } + .stroke-sm{ stroke-width:.4; } + .stroke-l{ stroke-width:1.3; } + .stroke-xl{ stroke-width:2; } .sa { stroke-dasharray:1,3; } .help { stroke-width:.6; stroke-dasharray:15,5,2,5; } - .dotted { stroke-dasharray:2,3; } - .dashed { stroke-dasharray:2,5; } - .lashed { stroke-dasharray:8,8; } + .dotted { stroke-dasharray:0.5,1; } + .dashed { stroke-dasharray:2,2; } + .lashed { stroke-dasharray:8,3; } .hidden { - stroke:none; - fill:none; + stroke:none!important; + fill:none!important; } /* Sampling */ @@ -47,7 +43,7 @@ svg.freesewing.draft { } .text-xs { font-size:4px; } .text-sm { font-size:5px; } - .text-lg { font-size:8px; } + .text-l { font-size:8px; } .text-xl { font-size:10px; } .text-xxl{ font-size:13px; } @@ -106,3 +102,52 @@ svg.freesewing.draft { .fill-note{ fill: $fc-draft-note-dark; } } +/* SVG defs (snippets) are in the shadow DOM */ +g.snippet.notch > circle, +g.snippet.bnotch > circle, +g.snippet.bnotch > path, +g.snippet.utton > circle, +g.snippet.uttonhole > path { + color: $fc-draft-mark-light; +} +/* Same for paperless grid, also in shadow DOM */ +rect.grid { + stroke-width: 1; + stroke: currentColor; +} +path.gridline { + stroke-linecap: butt; + stroke-width: 0.3!important; + stroke-dasharray: none; +} +path.gridline.sm { + stroke-width: 0.15!important; +} +path.gridline.xs { + stroke-width: 0.1!important; +} +path.gridline.metric.sm { + stroke-dasharray: 3 1; +} +path.gridline.metric.xs { + stroke-dasharray: 1 1; +} +path.gridline.imperial { + stroke-dasharray: 5 5; +} +path.gridline.imperial.sm { + stroke-dasharray: 2 2; +} +.light { + rect.grid, + path.gridline { + color: $oc-gray-5!important; + } +} +.dark { + rect.grid, + path.gridline { + color: $oc-gray-6!important; + } +} + diff --git a/packages/i18n/src/locales/de/plugin/plugins/scalebox.yaml b/packages/i18n/src/locales/de/plugin/plugins/scalebox.yaml index fa184c01da7..c23d7129ba7 100644 --- a/packages/i18n/src/locales/de/plugin/plugins/scalebox.yaml +++ b/packages/i18n/src/locales/de/plugin/plugins/scalebox.yaml @@ -1,5 +1,5 @@ --- freesewingIsMadeByJoostDeCockAndContributors: Freesewing wurde von Joost De Cock und den Mitwirkenden kreiert -theBlackOutsideOfThisBoxShouldMeasure: Die (schwarze) Außenseite dieses Rechtecks sollte messen -theWhiteInsideOfThisBoxShouldMeasure: Die (weiße) Innenseite dieses Rechtecks sollte messen +theBlackOutsideOfThisBoxShouldMeasure: Die Außenseite dieses Rechtecks sollte messen +theWhiteInsideOfThisBoxShouldMeasure: Die Innenseite dieses Rechtecks sollte messen withTheFinancialSupportOfOurPatrons: mit der finanziellen Unterstützung unserer Gönner diff --git a/packages/i18n/src/locales/en/plugin/plugins/scalebox.yaml b/packages/i18n/src/locales/en/plugin/plugins/scalebox.yaml index d9963c82ef1..8edb31bd3f1 100644 --- a/packages/i18n/src/locales/en/plugin/plugins/scalebox.yaml +++ b/packages/i18n/src/locales/en/plugin/plugins/scalebox.yaml @@ -1,4 +1,4 @@ freesewingIsMadeByJoostDeCockAndContributors: Freesewing is made by Joost De Cock and contributors -theBlackOutsideOfThisBoxShouldMeasure: The (black) outside of this box should measure -theWhiteInsideOfThisBoxShouldMeasure: The (white) inside of this box should measure +theBlackOutsideOfThisBoxShouldMeasure: The outside of this box should measure +theWhiteInsideOfThisBoxShouldMeasure: The inside of this box should measure withTheFinancialSupportOfOurPatrons: with the financial support of our patrons diff --git a/packages/i18n/src/locales/es/plugin/plugins/scalebox.yaml b/packages/i18n/src/locales/es/plugin/plugins/scalebox.yaml index 609b705b3d3..d992ab20c3c 100644 --- a/packages/i18n/src/locales/es/plugin/plugins/scalebox.yaml +++ b/packages/i18n/src/locales/es/plugin/plugins/scalebox.yaml @@ -1,5 +1,5 @@ --- freesewingIsMadeByJoostDeCockAndContributors: Freesewing está hecho por Joost De Cock y colaboradores -theBlackOutsideOfThisBoxShouldMeasure: El (negro) fuera de este cuadro debe medir -theWhiteInsideOfThisBoxShouldMeasure: El (blanco) dentro de este cuadro debe medir +theBlackOutsideOfThisBoxShouldMeasure: El fuera de este cuadro debe medir +theWhiteInsideOfThisBoxShouldMeasure: El dentro de este cuadro debe medir withTheFinancialSupportOfOurPatrons: con el apoyo económico de nuestros patrocinadores diff --git a/packages/i18n/src/locales/fr/plugin/plugins/scalebox.yaml b/packages/i18n/src/locales/fr/plugin/plugins/scalebox.yaml index 80cf5214269..14347b18909 100644 --- a/packages/i18n/src/locales/fr/plugin/plugins/scalebox.yaml +++ b/packages/i18n/src/locales/fr/plugin/plugins/scalebox.yaml @@ -1,5 +1,5 @@ --- freesewingIsMadeByJoostDeCockAndContributors: Freesewing est la création de Joost De Cock et ses contributeurs -theBlackOutsideOfThisBoxShouldMeasure: Le (noir) en dehors de cette case doit mesurer -theWhiteInsideOfThisBoxShouldMeasure: L'intérieur (blanc) de cette case doit mesurer +theBlackOutsideOfThisBoxShouldMeasure: L'extérieur de cette case doit mesurer +theWhiteInsideOfThisBoxShouldMeasure: L'intérieur de cette case doit mesurer withTheFinancialSupportOfOurPatrons: avec le soutien financier de nos mécènes diff --git a/packages/i18n/src/locales/nl/plugin/plugins/scalebox.yaml b/packages/i18n/src/locales/nl/plugin/plugins/scalebox.yaml index 7de753a8e4e..c0b1efca671 100644 --- a/packages/i18n/src/locales/nl/plugin/plugins/scalebox.yaml +++ b/packages/i18n/src/locales/nl/plugin/plugins/scalebox.yaml @@ -1,5 +1,5 @@ --- freesewingIsMadeByJoostDeCockAndContributors: FreeSewing is een project van Joost De Cock en vrijwillige medewerkers -theBlackOutsideOfThisBoxShouldMeasure: De (zwarte) buitenkant van dit kader meet -theWhiteInsideOfThisBoxShouldMeasure: De (witte) binnenkant van dit kader meet +theBlackOutsideOfThisBoxShouldMeasure: De buitenkant van dit kader meet +theWhiteInsideOfThisBoxShouldMeasure: De binnenkant van dit kader meet withTheFinancialSupportOfOurPatrons: met de financiële steun van onze mecenassen diff --git a/packages/plugin-scalebox/src/index.js b/packages/plugin-scalebox/src/index.js index c861151f502..957271e732a 100644 --- a/packages/plugin-scalebox/src/index.js +++ b/packages/plugin-scalebox/src/index.js @@ -86,14 +86,14 @@ export default { .line(this.points.__scaleboxImperialBottomRight) .line(this.points.__scaleboxImperialTopRight) .close() - .attr("style", "fill: #000; stroke: none;"); + .attr("class", "scalebox imperial"); this.paths.__scaleboxMetric = new this.Path() .move(this.points.__scaleboxMetricTopLeft) .line(this.points.__scaleboxMetricBottomLeft) .line(this.points.__scaleboxMetricBottomRight) .line(this.points.__scaleboxMetricTopRight) .close() - .attr("style", "fill: #FFF; stroke: none;"); + .attr("class", "scalebox metric"); // Lead this.points.__scaleboxLead = this.points.__scaleboxLead .attr("data-text", so.lead || "freesewing") diff --git a/packages/rendertest/config/index.js b/packages/rendertest/config/index.js new file mode 100644 index 00000000000..8ec60b6c6f1 --- /dev/null +++ b/packages/rendertest/config/index.js @@ -0,0 +1,23 @@ +import { version } from "../package.json"; + +export default { + name: "rendertest", + version, + design: "Joost De Cock", + code: "Joost De Cock", + department: "menswear", + type: "pattern", + difficulty: 1, + tags: ["test"], + optionGroups: { + fit: ["width"] + }, + measurements: [], + dependencies: {}, + parts: ["colors"], + inject: {}, + hide: [], + options: { + width: { mm: 200, min: 50, max: 500 } + } +}; diff --git a/packages/rendertest/src/.eslintrc b/packages/rendertest/src/.eslintrc new file mode 100644 index 00000000000..55f121d152d --- /dev/null +++ b/packages/rendertest/src/.eslintrc @@ -0,0 +1,5 @@ +{ + "env": { + "jest": true + } +} diff --git a/packages/rendertest/src/colors.js b/packages/rendertest/src/colors.js new file mode 100644 index 00000000000..2b3f89b8c1a --- /dev/null +++ b/packages/rendertest/src/colors.js @@ -0,0 +1,249 @@ +export default function(part) { + let { + macro, + options, + Point, + Path, + points, + paths, + snippets, + Snippet, + complete, + paperless + } = part.shorthand(); + + let colors = [ + "fabric", + "lining", + "interfacing", + "canvas", + "various", + "mark", + "contrast", + "note" + ]; + let sizes = ["xs", "sm", "", "l", "xl"]; + let utility = ["dotted", "dashed", "lashed", "sa", "help", "hidden"]; + + let y = 0; + let w = options.width; + macro("hd", { + from: new Point(0, y), + to: new Point(w, y) + }); + for (let i in colors) { + y += 15; + points["l" + i] = new Point(0, y); + points["r" + i] = new Point(w, y); + paths["heading" + i] = new Path() + .move(points["l" + i]) + .line(points["r" + i]) + .attr("class", colors[i]) + .attr("data-text", colors[i]); + for (let j in sizes) { + y += 10; + points["sl" + i + j] = new Point(0, y); + points["sr" + i + j] = new Point(w, y); + paths["size" + i + j] = new Path() + .move(points["sl" + i + j]) + .line(points["sr" + i + j]) + .attr("class", colors[i]) + .attr("class", "stroke-" + sizes[j]) + .attr( + "data-text", + "path." + colors[i] + (sizes[j] === "" ? "" : ".stroke-" + sizes[j]) + ) + .attr("data-text-class", "center"); + } + for (let j in utility) { + y += 10; + points["ul" + i + j] = new Point(0, y); + points["ur" + i + j] = new Point(w, y); + paths["util" + i + j] = new Path() + .move(points["ul" + i + j]) + .line(points["ur" + i + j]) + .attr("class", colors[i]) + .attr("class", utility[j]) + .attr("data-text", "path." + colors[i] + "." + utility[j]) + .attr("data-text-class", "center"); + } + } + + y += 10; + points.ftl = new Point(0, y); + points.ftr = new Point(w, y); + paths.snip = new Path() + .move(points.ftl) + .line(points.ftr) + .attr("data-text", "fill"); + y += 15; + for (let i of colors) { + let h = 10; + points["_bl" + i] = new Point(0, y); + points["_br" + i] = new Point(w, y); + points["_tr" + i] = new Point(w, y - h); + points["_tl" + i] = new Point(0, y - h); + paths["box" + i] = new Path() + .move(points["_bl" + i]) + .line(points["_br" + i]) + .line(points["_tr" + i]) + .line(points["_tl" + i]) + .close() + .attr("class", i) + .attr("class", "fill-" + i) + .attr("data-text", ".fill-" + i); + if (i === "fabric") paths["box" + i].attr("data-text-class", "fill-canvas"); + y += h * 1.2; + } + + let text = ["xs", "sm", "", "l", "xl", "xxl"]; + y += 10; + points.tl = new Point(0, y); + points.tr = new Point(w, y); + paths.text = new Path() + .move(points.tl) + .line(points.tr) + .attr("data-text", "text"); + y += 10; + points.tlc = new Point(0, y); + points.trc = new Point(w, y); + paths.textc = new Path() + .move(points.tlc) + .line(points.trc) + .attr("data-text", "text.center") + .attr("data-text-class", "center"); + y += 10; + points.tlr = new Point(0, y); + points.trr = new Point(w, y); + paths.textr = new Path() + .move(points.tlr) + .line(points.trr) + .attr("data-text", "text.right") + .attr("data-text-class", "right"); + for (let i in text) { + y += 15; + points["t" + i] = new Point(0, y) + .attr("data-text", "text" + text[i] === "" ? "" : ".text-" + text[i]) + .attr("data-text-class", "text-" + text[i]); + } + let snips = { + logo: 25, + notch: 15, + bnotch: 15, + button: 15, + buttonhole: 15 + }; + y += 10; + points.tl = new Point(0, y); + points.tr = new Point(w, y); + paths.texts = new Path() + .move(points.tl) + .line(points.tr) + .attr("data-text", "snippets"); + y += 10; + points["sl1"] = new Point(w * 0.25, y); + points["sl2"] = new Point(w * 0.5, y); + points["sl3"] = new Point(w * 0.75, y); + points["sl1"] + .attr("data-text", "data-scale: 1\ndata-rotate: 0") + .attr("data-text-class", "center text-sm") + .attr("data-text-lineheight", 5); + points["sl2"] + .attr("data-text", "data-scale: 1.25\ndata-rotate: 0") + .attr("data-text-class", "center text-sm") + .attr("data-text-lineheight", 5); + points["sl3"] + .attr("data-text", "data-scale: 0.75\ndata-rotate: 90") + .attr("data-text-class", "center text-sm") + .attr("data-text-lineheight", 5); + y += 55; + for (let i in snips) { + points["snt" + i] = new Point(0, y); + points["snt" + i].attr("data-text", i); + points["sn1" + i] = new Point(w * 0.25, y); + points["sn2" + i] = new Point(w * 0.5, y); + points["sn3" + i] = new Point(w * 0.75, y); + snippets["sn1" + i] = new Snippet(i, points["sn1" + i]); + snippets["sn2" + i] = new Snippet(i, points["sn2" + i]); + snippets["sn2" + i].attr("data-scale", 1.25); + snippets["sn3" + i] = new Snippet(i, points["sn3" + i]); + snippets["sn3" + i].attr("data-scale", 0.75).attr("data-rotate", 90); + y += snips[i]; + } + + y += 10; + points.ml = new Point(0, y); + points.mr = new Point(w, y); + paths.macros = new Path() + .move(points.ml) + .line(points.mr) + .attr("data-text", "macros"); + + y += 40; + macro("title", { + at: new Point(w / 2, y), + nr: 5, + title: "title" + }); + + y += 40; + macro("grainline", { + from: new Point(0, y), + to: new Point(w, y) + }); + + y += 20; + macro("cutonfold", { + from: new Point(w, y), + to: new Point(0, y) + }); + + y += 70; + points.dimf = new Point(20, y); + points.dimt = new Point(w - 20, y + 120); + points.dimv = new Point(20, y + 80); + paths.dims = new Path().move(points.dimf)._curve(points.dimv, points.dimt); + macro("hd", { + from: points.dimf, + to: points.dimt, + text: "hd", + y: y - 15 + }); + macro("vd", { + from: points.dimt, + to: points.dimf, + text: "vd", + x: 0 + }); + macro("ld", { + from: points.dimf, + to: points.dimt, + text: "ld" + }); + macro("pd", { + path: paths.dims, + text: "pd", + d: 10 + }); + + y += 170; + macro("scalebox", { + at: new Point(w / 2, y) + }); + + // Make sure nothing is cut off + paths.box = new Path() + .move(new Point(-10, -10)) + .line(new Point(w + 10, y + 10)) + .attr("class", "hidden"); + + // Complete? + if (complete) { + } + + // Paperless? + if (paperless) { + } + + return part; +} diff --git a/packages/rendertest/src/index.js b/packages/rendertest/src/index.js new file mode 100644 index 00000000000..b8dcbd5fdc1 --- /dev/null +++ b/packages/rendertest/src/index.js @@ -0,0 +1,13 @@ +import freesewing from "@freesewing/core"; +import plugins from "@freesewing/plugin-bundle"; +import config from "../config"; +// Parts +import draftColors from "./colors"; + +// Create design +const Pattern = new freesewing.Design(config, plugins); + +// Attach draft methods to prototype +Pattern.prototype.draftColors = part => draftColors(part); + +export default Pattern;