pptxtojson 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptxtojson",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A javascript tool for parsing .pptx file",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
package/src/shape.js CHANGED
@@ -33,11 +33,14 @@ export function shapeArc(cX, cY, rX, rY, stAng, endAng, isClose) {
33
33
 
34
34
  export function getCustomShapePath(custShapType, w, h) {
35
35
  const pathLstNode = getTextByPathList(custShapType, ['a:pathLst'])
36
- const pathNodes = getTextByPathList(pathLstNode, ['a:path'])
36
+ let pathNodes = getTextByPathList(pathLstNode, ['a:path'])
37
+
38
+ if (Array.isArray(pathNodes)) pathNodes = pathNodes.pop()
39
+
37
40
  const maxX = parseInt(pathNodes['attrs']['w'])
38
41
  const maxY = parseInt(pathNodes['attrs']['h'])
39
- const cX = (1 / maxX) * w
40
- const cY = (1 / maxY) * h
42
+ const cX = maxX === 0 ? 0 : (1 / maxX) * w
43
+ const cY = maxY === 0 ? 0 : (1 / maxY) * h
41
44
  let d = ''
42
45
 
43
46
  let moveToNode = getTextByPathList(pathNodes, ['a:moveTo'])