@pixi/graphics
Advanced tools
Comparing version 7.1.3 to 7.1.4
@@ -26,4 +26,3 @@ 'use strict'; | ||
const eoy = oy + eyy; | ||
verts.push(eix, eiy); | ||
verts.push(eox, eoy); | ||
verts.push(eix, eiy, eox, eoy); | ||
return 2; | ||
@@ -49,19 +48,13 @@ } | ||
if (clockwise) { | ||
verts.push(cx, cy); | ||
verts.push(sx, sy); | ||
verts.push(cx, cy, sx, sy); | ||
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { | ||
verts.push(cx, cy); | ||
verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius); | ||
verts.push(cx, cy, cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius); | ||
} | ||
verts.push(cx, cy); | ||
verts.push(ex, ey); | ||
verts.push(cx, cy, ex, ey); | ||
} else { | ||
verts.push(sx, sy); | ||
verts.push(cx, cy); | ||
verts.push(sx, sy, cx, cy); | ||
for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { | ||
verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius); | ||
verts.push(cx, cy); | ||
verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius, cx, cy); | ||
} | ||
verts.push(ex, ey); | ||
verts.push(cx, cy); | ||
verts.push(ex, ey, cx, cy); | ||
} | ||
@@ -126,4 +119,3 @@ return segCount * 2; | ||
} | ||
verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight); | ||
verts.push(x0 + perpx * outerWeight, y0 + perpy * outerWeight); | ||
verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight, x0 + perpx * outerWeight, y0 + perpy * outerWeight); | ||
for (let i = 1; i < length - 1; ++i) { | ||
@@ -158,4 +150,3 @@ x0 = points[(i - 1) * 2]; | ||
if (Math.abs(cross) < 1e-3 * Math.abs(dot)) { | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight); | ||
verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
if (dot >= 0) { | ||
@@ -167,4 +158,3 @@ if (style.join === _const.LINE_JOIN.ROUND) { | ||
} | ||
verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight); | ||
verts.push(x1 + perp1x * innerWeight, y1 + perp1y * innerWeight); | ||
verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight, x1 + perp1x * innerWeight, y1 + perp1y * innerWeight); | ||
} | ||
@@ -186,55 +176,56 @@ continue; | ||
const insideMiterOk = pdist <= smallerInsideDiagonalSq; | ||
let join = style.join; | ||
if (join === _const.LINE_JOIN.MITER && pdist / widthSquared > miterLimitSquared) { | ||
join = _const.LINE_JOIN.BEVEL; | ||
} | ||
if (insideMiterOk) { | ||
if (style.join === _const.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { | ||
if (clockwise) { | ||
verts.push(imx, imy); | ||
verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
verts.push(imx, imy); | ||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); | ||
} else { | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight); | ||
verts.push(omx, omy); | ||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight); | ||
verts.push(omx, omy); | ||
switch (join) { | ||
case _const.LINE_JOIN.MITER: { | ||
verts.push(imx, imy, omx, omy); | ||
break; | ||
} | ||
indexCount += 2; | ||
} else if (style.join === _const.LINE_JOIN.ROUND) { | ||
if (clockwise) { | ||
verts.push(imx, imy); | ||
verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4; | ||
verts.push(imx, imy); | ||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); | ||
} else { | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight); | ||
verts.push(omx, omy); | ||
indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4; | ||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight); | ||
verts.push(omx, omy); | ||
case _const.LINE_JOIN.BEVEL: { | ||
if (clockwise) { | ||
verts.push(imx, imy, x1 + perpx * outerWeight, y1 + perpy * outerWeight, imx, imy, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); | ||
} else { | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, omx, omy, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, omx, omy); | ||
} | ||
indexCount += 2; | ||
break; | ||
} | ||
} else { | ||
verts.push(imx, imy); | ||
verts.push(omx, omy); | ||
case _const.LINE_JOIN.ROUND: { | ||
if (clockwise) { | ||
verts.push(imx, imy, x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4; | ||
verts.push(imx, imy, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); | ||
} else { | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, omx, omy); | ||
indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4; | ||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, omx, omy); | ||
} | ||
break; | ||
} | ||
} | ||
} else { | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight); | ||
verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
if (style.join === _const.LINE_JOIN.ROUND) { | ||
if (clockwise) { | ||
indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2; | ||
} else { | ||
indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2; | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
switch (join) { | ||
case _const.LINE_JOIN.MITER: { | ||
if (clockwise) { | ||
verts.push(omx, omy, omx, omy); | ||
} else { | ||
verts.push(imx, imy, imx, imy); | ||
} | ||
indexCount += 2; | ||
break; | ||
} | ||
} else if (style.join === _const.LINE_JOIN.MITER && pdist / widthSquared <= miterLimitSquared) { | ||
if (clockwise) { | ||
verts.push(omx, omy); | ||
verts.push(omx, omy); | ||
} else { | ||
verts.push(imx, imy); | ||
verts.push(imx, imy); | ||
case _const.LINE_JOIN.ROUND: { | ||
if (clockwise) { | ||
indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2; | ||
} else { | ||
indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2; | ||
} | ||
break; | ||
} | ||
indexCount += 2; | ||
} | ||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight); | ||
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); | ||
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); | ||
indexCount += 2; | ||
@@ -254,4 +245,3 @@ } | ||
perpy *= width; | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight); | ||
verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight); | ||
if (!closedShape) { | ||
@@ -258,0 +248,0 @@ if (style.cap === _const.LINE_CAP.ROUND) { |
{ | ||
"name": "@pixi/graphics", | ||
"version": "7.1.3", | ||
"version": "7.1.4", | ||
"main": "lib/index.js", | ||
@@ -43,3 +43,3 @@ "module": "lib/index.mjs", | ||
], | ||
"gitHead": "232489b10c051880a3cc4eff321ceebdd61a4562" | ||
"gitHead": "39c67e00abe2dd592bf43d23b2559e646ab9791b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
572673
4825