@@ -274,6 +274,98 @@ export const DotElements = {
274274 z`
275275 )
276276
277+ return element
278+ } ,
279+ blob : ( args : BasicFigureDrawArgs , corners : Record < 'tl' | 'tr' | 'bl' | 'br' , 'round' | 'out' | 'square' > ) : SVGElement => {
280+ const { size, x, y, document } = args
281+ const dotSize = size / 7
282+
283+ const element = document . createElementNS ( 'http://www.w3.org/2000/svg' , 'path' )
284+
285+ const parts = [
286+ svgPath `M ${ x } ${ y + 2.5 * dotSize } `
287+ ]
288+
289+ let l = 2 * dotSize
290+
291+ if ( corners . bl == 'round' ) {
292+ parts . push (
293+ svgPath `v ${ l }
294+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 0 ${ dotSize * 2.5 } ${ dotSize * 2.5 } `
295+ )
296+ l = 2 * dotSize
297+ } else if ( corners . bl == 'out' ) {
298+ parts . push (
299+ svgPath `v ${ 5 * dotSize + l }
300+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 1 ${ dotSize * 2.5 } ${ dotSize * - 2.5 } `
301+ )
302+ l = 2 * dotSize
303+ } else {
304+ parts . push (
305+ svgPath `v ${ 2.5 * dotSize + l } `
306+ )
307+ l = 4.5 * dotSize
308+ }
309+
310+ if ( corners . br == 'round' ) {
311+ parts . push (
312+ svgPath `h ${ l }
313+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 0 ${ dotSize * 2.5 } ${ dotSize * - 2.5 } `
314+ )
315+ l = - 2 * dotSize
316+ } else if ( corners . br == 'out' ) {
317+ parts . push (
318+ svgPath `h ${ 5 * dotSize + l }
319+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 1 ${ dotSize * - 2.5 } ${ dotSize * - 2.5 } `
320+ )
321+ l = - 2 * dotSize
322+ } else {
323+ parts . push (
324+ svgPath `h ${ 2.5 * dotSize + l } `
325+ )
326+ l = - 4.5 * dotSize
327+ }
328+
329+ if ( corners . tr == 'round' ) {
330+ parts . push (
331+ svgPath `v ${ l }
332+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 0 ${ dotSize * - 2.5 } ${ dotSize * - 2.5 } `
333+ )
334+ l = - 2 * dotSize
335+ } else if ( corners . tr == 'out' ) {
336+ parts . push (
337+ svgPath `v ${ - 5 * dotSize + l }
338+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 1 ${ dotSize * - 2.5 } ${ dotSize * 2.5 } `
339+ )
340+ l = - 2 * dotSize
341+ } else {
342+ parts . push (
343+ svgPath `v ${ - 2.5 * dotSize + l } `
344+ )
345+ l = - 4.5 * dotSize
346+ }
347+
348+ if ( corners . tl == 'round' ) {
349+ parts . push (
350+ svgPath `h ${ l }
351+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 0 ${ dotSize * - 2.5 } ${ dotSize * 2.5 } `
352+ )
353+ } else if ( corners . tl == 'out' ) {
354+ parts . push (
355+ svgPath `h ${ - 5 * dotSize + l }
356+ a ${ 2.5 * dotSize } ${ 2.5 * dotSize } 0 0 1 ${ dotSize * 2.5 } ${ dotSize * 2.5 } `
357+ )
358+ } else {
359+ parts . push (
360+ svgPath `h ${ - 2.5 * dotSize + l } `
361+ )
362+ }
363+
364+ element . setAttribute (
365+ 'd' ,
366+ parts . join ( ' ' ) + ' z'
367+ )
368+
277369 return element
278370 }
279371}
0 commit comments