Skip to content

Commit 329e3fc

Browse files
authored
update custom block shape plugin to modify notch switch paths
1 parent 7c4e472 commit 329e3fc

1 file changed

Lines changed: 35 additions & 62 deletions

File tree

src/addons/addons/custom-block-shape/userscript.js

Lines changed: 35 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -45,70 +45,43 @@ export default async function ({ addon, console }) {
4545
BlockSvg.NOTCH_HEIGHT = 2 * GRID_UNIT * multiplier * notchSize;
4646
BlockSvg.NOTCH_START_PADDING = 3 * GRID_UNIT; //* multiplier
4747
BlockSvg.ICON_SEPARATOR_HEIGHT = 10 * GRID_UNIT * multiplier;
48+
4849
BlockSvg.NOTCH_PATH_LEFT =
49-
"c 2,0 3," +
50-
1 * notchSize +
51-
" 4," +
52-
2 * notchSize +
53-
" l " +
54-
4 * multiplier * notchSize +
55-
"," +
56-
4 * multiplier * notchSize +
57-
" c 1," +
58-
1 * notchSize +
59-
" 2," +
60-
2 * notchSize +
61-
" 4," +
62-
2 * notchSize +
63-
" h " +
64-
24 * (multiplier - 0.5) +
65-
" c 2,0 3,-" +
66-
1 * notchSize +
67-
" 4,-" +
68-
2 * notchSize +
69-
" l " +
70-
4 * multiplier * notchSize +
71-
"," +
72-
-4 * multiplier * notchSize +
73-
"c 1,-" +
74-
1 * notchSize +
75-
" 2,-" +
76-
2 * notchSize +
77-
" 4,-" +
78-
2 * notchSize;
50+
`c 2 0 3 ${1 * notchSize} 4 ${2 * notchSize} ` +
51+
`l ${4 * multiplier * notchSize} ${4 * multiplier * notchSize} ` +
52+
`c 1 ${1 * notchSize} 2 ${2 * notchSize} 4 ${2 * notchSize} ` +
53+
`h ${24 * (multiplier - 0.5)} ` +
54+
`c 2 0 3 ${-1 * notchSize} 4 ${-2 * notchSize} ` +
55+
`l ${4 * multiplier * notchSize} ${-4 * multiplier * notchSize} ` +
56+
`c 1 ${-1 * notchSize} 2 ${-2 * notchSize} 4 ${-2 * notchSize} `
7957
BlockSvg.NOTCH_PATH_RIGHT =
80-
"h " +
81-
(-4 * (cornerSize - 1) - 5 * (1 - notchSize)) +
82-
"c -2,0 -3," +
83-
1 * notchSize +
84-
" -4," +
85-
2 * notchSize +
86-
" l " +
87-
-4 * multiplier * notchSize +
88-
"," +
89-
4 * multiplier * notchSize +
90-
" c -1," +
91-
1 * notchSize +
92-
" -2," +
93-
2 * notchSize +
94-
" -4," +
95-
2 * notchSize +
96-
" h " +
97-
-24 * (multiplier - 0.5) +
98-
" c -2,0 -3,-" +
99-
1 * notchSize +
100-
" -4,-" +
101-
2 * notchSize +
102-
" l " +
103-
-4 * multiplier * notchSize +
104-
"," +
105-
-4 * multiplier * notchSize +
106-
"c -1,-" +
107-
1 * notchSize +
108-
" -2,-" +
109-
2 * notchSize +
110-
" -4,-" +
111-
2 * notchSize;
58+
`c -2 0 -3 ${1 * notchSize} -4 ${2 * notchSize} ` +
59+
`l ${-4 * multiplier * notchSize} ${4 * multiplier * notchSize} ` +
60+
`c -1 ${1 * notchSize} -2 ${2 * notchSize} -4 ${2 * notchSize} ` +
61+
`h ${-24 * (multiplier - 0.5)} ` +
62+
`c -2 0 -3 ${-1 * notchSize} -4 ${-2 * notchSize} ` +
63+
`l ${-4 * multiplier * notchSize} ${-4 * multiplier * notchSize} ` +
64+
`c -1 ${-1 * notchSize} -2 ${-2 * notchSize} -4 ${-2 * notchSize} `
65+
66+
BlockSvg.NOTCH_SWITCH_PATH_LEFT =
67+
`c 2 0 3 ${1 * notchSize} 4 ${2 * notchSize} ` +
68+
`l ${4 * multiplier * notchSize} ${4 * multiplier * notchSize} ` +
69+
`c 1 ${1 * notchSize} 2 ${2 * notchSize} 4 ${2 * notchSize} ` +
70+
`c ${4 * (multiplier - 0.5)} 0 ${8 * (multiplier - 0.5) * notchSize} ${-8 * (multiplier - 0.5) * notchSize} ${12 * (multiplier - 0.5) * notchSize} ${-8 * (multiplier - 0.5) * notchSize} ` +
71+
`c ${4 * (multiplier - 0.5)} 0 ${8 * (multiplier - 0.5) * notchSize} ${8 * (multiplier - 0.5) * notchSize} ${12 * (multiplier - 0.5) * notchSize} ${8 * (multiplier - 0.5) * notchSize} ` +
72+
`c 2 0 3 ${-1 * notchSize} 4 ${-2 * notchSize} ` +
73+
`l ${4 * multiplier * notchSize} ${-4 * multiplier * notchSize} ` +
74+
`c 1 ${-1 * notchSize} 2 ${-2 * notchSize} 4 ${-2 * notchSize} `
75+
BlockSvg.NOTCH_SWITCH_PATH_RIGHT =
76+
`c -2 0 -3 ${1 * notchSize} -4 ${2 * notchSize} ` +
77+
`l ${-4 * multiplier * notchSize} ${4 * multiplier * notchSize} ` +
78+
`c -1 ${1 * notchSize} -2 ${2 * notchSize} -4 ${2 * notchSize} ` +
79+
`c ${-4 * (multiplier - 0.5)} 0 ${-8 * (multiplier - 0.5) * notchSize} ${-8 * (multiplier - 0.5) * notchSize} ${-12 * (multiplier - 0.5) * notchSize} ${-8 * (multiplier - 0.5) * notchSize} ` +
80+
`c ${-4 * (multiplier - 0.5)} 0 ${-8 * (multiplier - 0.5) * notchSize} ${8 * (multiplier - 0.5) * notchSize} ${-12 * (multiplier - 0.5) * notchSize} ${8 * (multiplier - 0.5) * notchSize} ` +
81+
`c 2 0 3 ${-1 * notchSize} 4 ${-2 * notchSize} ` +
82+
`l ${4 * multiplier * notchSize} ${-4 * multiplier * notchSize} ` +
83+
`c 1 ${-1 * notchSize} 2 ${-2 * notchSize} 4 ${-2 * notchSize} `
84+
11285
BlockSvg.INPUT_SHAPE_HEXAGONAL =
11386
"M " +
11487
4 * GRID_UNIT * multiplier +

0 commit comments

Comments
 (0)