kfb-view 2.1.13 → 2.1.14
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/.idea/workspace.xml +21 -20
- package/lib/kfb-view.js +1 -1
- package/package.json +1 -1
- package/src/tool/Combination.js +4 -7
- package/src/util/canvas.js +1 -0
package/package.json
CHANGED
package/src/tool/Combination.js
CHANGED
|
@@ -42,13 +42,13 @@ class Combination extends Brush {
|
|
|
42
42
|
points[0].y + region.height - centerPoint.y);
|
|
43
43
|
ctx.lineTo(points[0].x - centerPoint.x, points[0].y - centerPoint.y);
|
|
44
44
|
} else if (tool === ELLIPSE) {
|
|
45
|
-
ctx.drawOval(0, 0, region.width / 2,
|
|
45
|
+
ctx.drawOval(0, 0, Math.abs(region.width / 2),
|
|
46
|
+
Math.abs(region.height / 2), false);
|
|
46
47
|
}
|
|
47
48
|
ctx.closePath();
|
|
48
49
|
ctx.restore();
|
|
49
50
|
children.forEach(({tool, points}) => {
|
|
50
51
|
ctx.save();
|
|
51
|
-
ctx.beginPath();
|
|
52
52
|
const region = pointsToRegion(points);
|
|
53
53
|
const centerPoint = {
|
|
54
54
|
x: region.x + region.width / 2,
|
|
@@ -71,11 +71,8 @@ class Combination extends Brush {
|
|
|
71
71
|
points[0].y - centerPoint.y);
|
|
72
72
|
ctx.lineTo(points[0].x - centerPoint.x, points[0].y - centerPoint.y);
|
|
73
73
|
} else if (tool === ELLIPSE) {
|
|
74
|
-
ctx.drawOval(0, 0, region.width / 2,
|
|
75
|
-
|
|
76
|
-
if (this.options.fillStyle) {
|
|
77
|
-
ctx.fillStyle = this.options.fillStyle;
|
|
78
|
-
ctx.fill();
|
|
74
|
+
ctx.drawOval(0, 0, Math.abs(region.width / 2),
|
|
75
|
+
Math.abs(region.height / 2), true);
|
|
79
76
|
}
|
|
80
77
|
ctx.restore();
|
|
81
78
|
});
|
package/src/util/canvas.js
CHANGED
|
@@ -60,6 +60,7 @@ CanvasRenderingContext2D.prototype.drawOval = function drawOval(
|
|
|
60
60
|
this.save();
|
|
61
61
|
// 选择a、b中的较大者作为arc方法的半径参数
|
|
62
62
|
const r = (a > b) ? a : b;
|
|
63
|
+
console.log(r);
|
|
63
64
|
const ratioX = a / r; // 横轴缩放比率
|
|
64
65
|
const ratioY = b / r; // 纵轴缩放比率
|
|
65
66
|
this.scale(ratioX, ratioY); // 进行缩放(均匀压缩)
|