(property, parent, id)
| 823 | } |
| 824 | |
| 825 | function drawGeometry(property, parent, id) { |
| 826 | if (!parent) { |
| 827 | parent = svg |
| 828 | } |
| 829 | let anchor = scaleAnchor(property.anchor) |
| 830 | let stroke = null |
| 831 | let lineWidth = scaleValue(1) |
| 832 | if (property.strokeStyle) { |
| 833 | lineWidth = scaleValue(property.strokeStyle.lineWidth || 1) |
| 834 | stroke = toPaint(property.strokeStyle.paint, anchor) |
| 835 | } |
| 836 | let paths = geometryPaths(property, zoom) |
| 837 | for (let i = 0; i < paths.length; i++) { |
| 838 | let path = paths[i] |
| 839 | let pathNode = parent.append('path') |
| 840 | if (id) { |
| 841 | pathNode.attr('id', id) |
| 842 | } |
| 843 | pathNode.attr('d', path.path) |
| 844 | let transform = `translate(${anchor[0]},${anchor[1]})` |
| 845 | if (path.scaleX && path.scaleY) { |
| 846 | transform += ` scale(${path.scaleX || 1},${path.scaleY || 1})` |
| 847 | } |
| 848 | pathNode.attr('transform', transform) |
| 849 | let fill = null |
| 850 | if (property.fillStyle) { |
| 851 | let scaleX = 1 / path.scaleX |
| 852 | let scaleY = 1 / path.scaleY |
| 853 | let params = { scaleX, scaleY } |
| 854 | if (property.fillStyle.type == 'bgFill') { |
| 855 | if (ctx.interior) { |
| 856 | params.tx = -ctx.interior.tx - anchor[0] |
| 857 | params.ty = -ctx.interior.ty - anchor[1] |
| 858 | } else { |
| 859 | params.tx = -anchor[0] |
| 860 | params.ty = -anchor[1] |
| 861 | } |
| 862 | params.width = anchor[2] |
| 863 | params.height = anchor[3] |
| 864 | params.rotation = -((property.rotation || 0) + (ctx.groupRotation || 0)) |
| 865 | } |
| 866 | fill = toPaint(property.fillStyle, anchor, params) |
| 867 | } |
| 868 | if (path.filled && fill) { |
| 869 | pathNode.attr('fill', fill) |
| 870 | } else { |
| 871 | pathNode.attr('fill', 'transparent') |
| 872 | } |
| 873 | if (path.stroked) { |
| 874 | pathNode.attr('stroke', stroke) |
| 875 | pathNode.attr('stroke-width', path.scaleY ? lineWidth / path.scaleY : lineWidth) |
| 876 | } |
| 877 | let filter = toShadow(property.shadow, anchor, path.scaleX, path.scaleY) |
| 878 | if (filter) { |
| 879 | pathNode.attr('filter', filter) |
| 880 | } |
| 881 | } |
| 882 | } |
no test coverage detected