@@ -272,31 +272,45 @@ const ModeToolsComponent = props => {
272272 const selectedShapeObject = selectableShapes
273273 . filter ( shape => shape . id === currentlySelectedShape ) [ 0 ] ;
274274 const generateShapeSVG = ( shapeObject ) => {
275- return `<svg
276- version="1.1"
277- xmlns="http://www.w3.org/2000/svg"
278- xmlns:xlink="http://www.w3.org/1999/xlink"
279-
280- width="${ shapeObject . icon . width } "
281- height="${ shapeObject . icon . height } "
282- viewBox="${ shapeObject . icon . viewBox } "
283-
284- >
285- <g transform="translate(${ shapeObject . icon . x } ,${ shapeObject . icon . y } )">
286- <g data-paper-data="{"isPaintingLayer":true}"
287- fill="none" fill-rule="nonzero" stroke="#575E75"
288-
289- stroke-width="${ shapeObject . icon . strokeWidth } "
290-
291- stroke-linecap="butt"
292- stroke-linejoin="round" stroke-dashoffset="0" style="mix-blend-mode: normal">
293-
294- <path d="${ shapeObject . path } "/>
295-
296- </g></g></svg>`
275+ const strokeColor = "#575e75" ;
276+ const icon = shapeObject . icon ;
277+ // extract viewbox
278+ const viewBoxStart = icon . substring ( icon . indexOf ( 'viewBox="' ) + 9 ) ;
279+ const viewBoxString = viewBoxStart
280+ . substring ( 0 , viewBoxStart . indexOf ( '"' ) ) ;
281+ // extract fill color
282+ const fillColorStart = icon . substring ( icon . indexOf ( 'fill="' ) + 6 ) ;
283+ const fillColorString = fillColorStart
284+ . substring ( 0 , fillColorStart . indexOf ( '"' ) ) ;
285+ // extract stroke width
286+ const strokeWidthStart = icon . substring ( icon . indexOf ( 'stroke-width="' ) + 14 ) ;
287+ const strokeWidthString = strokeWidthStart
288+ . substring ( 0 , strokeWidthStart . indexOf ( '"' ) ) ;
289+ // extract viewbox to array
290+ const viewBox = viewBoxString
291+ . replace ( / / gmi, ',' )
292+ . split ( ',' )
293+ . map ( value => value . trim ( ) )
294+ . map ( num => Number ( num ) ) ;
295+ const newViewBox = [
296+ viewBox [ 0 ] - 1.5 ,
297+ viewBox [ 1 ] - 1.5 ,
298+ viewBox [ 2 ] + ( 1.5 * 2 ) ,
299+ viewBox [ 3 ] + ( 1.5 * 2 )
300+ ] . join ( ',' ) ;
301+ const newIcon = icon
302+ . replace ( `viewBox="${ viewBoxString } "` , `viewBox="${ newViewBox } "` )
303+ . replace ( 'stroke="none"' , `stroke="${ strokeColor } "` )
304+ . replace ( `fill="${ fillColorString } "` , 'fill="none"' )
305+ . replace ( `stroke-width="${ strokeWidthString } "` , `stroke-width="${ shapeObject . strokeWidth } "` ) ;
306+ return `${ newIcon } `
297307 } ;
298308 const selectableShapesList = (
299- < InputGroup className = { classNames ( styles . modDashedBorder , styles . modLabeledIconHeight ) } >
309+ < InputGroup className = { classNames (
310+ styles . modDashedBorder ,
311+ // styles.modLabeledIconHeight,
312+ styles . dropdownMaxItemList
313+ ) } >
300314 { selectableShapes . map ( shape => {
301315 return ( < LabeledIconButton
302316 hideLabel = { hideLabel ( props . intl . locale ) }
0 commit comments