@jiaminghi/c-render
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -0,1 +1,7 @@ | ||
# 0.2.6-alpha (2019-05-14) | ||
### Perfect | ||
- **graph:** `polyline` Eliminate polyline blur due to 1px line width. | ||
# 0.2.5-alpha (2019-05-12) | ||
@@ -2,0 +8,0 @@ |
@@ -7,2 +7,3 @@ import beziercurve from '@jiaminghi/bezier-curve' | ||
deepClone, | ||
eliminateBlur, | ||
checkPointIsInCircle, | ||
@@ -465,3 +466,3 @@ getTwoPointDistance, | ||
draw ({ ctx }, { shape }) { | ||
draw ({ ctx }, { shape, style: { lineWidth } }) { | ||
ctx.beginPath() | ||
@@ -471,2 +472,4 @@ | ||
if (lineWidth === 1) points = eliminateBlur(points) | ||
drawPolylinePath(ctx, points) | ||
@@ -473,0 +476,0 @@ |
@@ -39,7 +39,16 @@ const { abs, sqrt, sin, cos, max, min, PI } = Math | ||
/** | ||
* @description Eliminate line blur due to 1px line width | ||
* @param {Array} points Line points | ||
* @return {Array} Line points after processed | ||
*/ | ||
export function eliminateBlur (points) { | ||
return points.map(([x, y]) => [parseInt(x) + 0.5, parseInt(y) + 0.5]) | ||
} | ||
/** | ||
* @description Check if the point is inside the circle | ||
* @param {Array} point Postion of point | ||
* @param {Number} rx Circle x coordinate | ||
* @param {Number} ry Circle y coordinate | ||
* @param {Number} r Circle radius | ||
* @param {Number} rx Circle x coordinate | ||
* @param {Number} ry Circle y coordinate | ||
* @param {Number} r Circle radius | ||
* @return {Boolean} Result of check | ||
@@ -329,2 +338,3 @@ */ | ||
deepClone, | ||
eliminateBlur, | ||
checkPointIsInCircle, | ||
@@ -331,0 +341,0 @@ checkPointIsInPolygon, |
{ | ||
"name": "@jiaminghi/c-render", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"author": "JiaMing <743192023@qq.com>", | ||
@@ -5,0 +5,0 @@ "description": "Canvas-based vector graphics rendering plugin", |
133100
1680