@ray-js/lamp-circle-picker 1.0.13-beta-3 → 1.0.13-beta-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/example/src/pages/index.tsx +1 -1
- package/lib/component/rjs/index.rjs +28 -25
- package/lib/index.js +2 -2
- package/package.json +1 -1
|
@@ -283,38 +283,36 @@ export default Render({
|
|
|
283
283
|
// 计算色环中线半径
|
|
284
284
|
const midRadius = (innerRadius + (outerRadius - innerRadius) / 2) * scale;
|
|
285
285
|
|
|
286
|
-
// 切线方向的平移距离(2px,考虑scale)
|
|
287
|
-
const offset = 2 * scale;
|
|
288
|
-
|
|
289
286
|
// 起始端点(135度位置)
|
|
290
287
|
const startAngleRad = (startAngle * Math.PI) / 180;
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
const startX =
|
|
294
|
-
centerX + midRadius * Math.cos(startAngleRad) + offset * Math.cos(startTangentAngle);
|
|
295
|
-
const startY =
|
|
296
|
-
centerY + midRadius * Math.sin(startAngleRad) + offset * Math.sin(startTangentAngle);
|
|
288
|
+
const startX = centerX + midRadius * Math.cos(startAngleRad);
|
|
289
|
+
const startY = centerY + midRadius * Math.sin(startAngleRad);
|
|
297
290
|
const startColor = gradientColors[1] || gradientColors[0]; // 使用第一个颜色
|
|
298
291
|
|
|
299
292
|
// 结束端点(405度位置)
|
|
300
293
|
const endAngleRad = (endAngle * Math.PI) / 180;
|
|
301
|
-
|
|
302
|
-
const
|
|
303
|
-
const endX = centerX + midRadius * Math.cos(endAngleRad) + offset * Math.cos(endTangentAngle);
|
|
304
|
-
const endY = centerY + midRadius * Math.sin(endAngleRad) + offset * Math.sin(endTangentAngle);
|
|
294
|
+
const endX = centerX + midRadius * Math.cos(endAngleRad);
|
|
295
|
+
const endY = centerY + midRadius * Math.sin(endAngleRad);
|
|
305
296
|
const endColor =
|
|
306
297
|
gradientColors[gradientColors.length - 2] || gradientColors[gradientColors.length - 1]; // 使用最后一个颜色
|
|
307
298
|
|
|
308
299
|
// 重置合成操作以正常绘制端点
|
|
309
300
|
ctx.globalCompositeOperation = 'source-over';
|
|
310
301
|
|
|
311
|
-
// 起始端点 -
|
|
312
|
-
//
|
|
313
|
-
const
|
|
314
|
-
const
|
|
302
|
+
// 起始端点 - 使用闭合路径绘制半圆,确保与色环无缝衔接
|
|
303
|
+
// 计算色环内外边缘的起点坐标
|
|
304
|
+
const startInnerX = centerX + innerRadius * scale * Math.cos(startAngleRad);
|
|
305
|
+
const startInnerY = centerY + innerRadius * scale * Math.sin(startAngleRad);
|
|
306
|
+
const startOuterX = centerX + outerRadius * scale * Math.cos(startAngleRad);
|
|
307
|
+
const startOuterY = centerY + outerRadius * scale * Math.sin(startAngleRad);
|
|
315
308
|
|
|
316
309
|
ctx.beginPath();
|
|
317
|
-
|
|
310
|
+
// 从内边缘开始
|
|
311
|
+
ctx.moveTo(startInnerX, startInnerY);
|
|
312
|
+
// 绘制半圆弧(从内边缘到外边缘)
|
|
313
|
+
ctx.arc(startX, startY, endpointRadius, startAngleRad, startAngleRad - Math.PI, true);
|
|
314
|
+
// 闭合路径(从外边缘回到内边缘)
|
|
315
|
+
ctx.closePath();
|
|
318
316
|
|
|
319
317
|
// 使用与色环相同的径向渐变
|
|
320
318
|
const startGradient = ctx.createRadialGradient(
|
|
@@ -330,15 +328,21 @@ export default Render({
|
|
|
330
328
|
|
|
331
329
|
ctx.fillStyle = startGradient;
|
|
332
330
|
ctx.fill();
|
|
333
|
-
ctx.closePath();
|
|
334
331
|
|
|
335
|
-
// 结束端点 -
|
|
336
|
-
//
|
|
337
|
-
const
|
|
338
|
-
const
|
|
332
|
+
// 结束端点 - 使用闭合路径绘制半圆,确保与色环无缝衔接
|
|
333
|
+
// 计算色环内外边缘的终点坐标
|
|
334
|
+
const endInnerX = centerX + innerRadius * scale * Math.cos(endAngleRad);
|
|
335
|
+
const endInnerY = centerY + innerRadius * scale * Math.sin(endAngleRad);
|
|
336
|
+
const endOuterX = centerX + outerRadius * scale * Math.cos(endAngleRad);
|
|
337
|
+
const endOuterY = centerY + outerRadius * scale * Math.sin(endAngleRad);
|
|
339
338
|
|
|
340
339
|
ctx.beginPath();
|
|
341
|
-
|
|
340
|
+
// 从内边缘开始
|
|
341
|
+
ctx.moveTo(endInnerX, endInnerY);
|
|
342
|
+
// 绘制半圆弧(从内边缘到外边缘)
|
|
343
|
+
ctx.arc(endX, endY, endpointRadius, endAngleRad, endAngleRad + Math.PI, false);
|
|
344
|
+
// 闭合路径(从外边缘回到内边缘)
|
|
345
|
+
ctx.closePath();
|
|
342
346
|
|
|
343
347
|
// 使用与色环相同的径向渐变
|
|
344
348
|
const endGradient = ctx.createRadialGradient(
|
|
@@ -354,7 +358,6 @@ export default Render({
|
|
|
354
358
|
|
|
355
359
|
ctx.fillStyle = endGradient;
|
|
356
360
|
ctx.fill();
|
|
357
|
-
ctx.closePath();
|
|
358
361
|
},
|
|
359
362
|
|
|
360
363
|
// 环形色盘 降级绘制
|
package/lib/index.js
CHANGED
|
@@ -52,9 +52,9 @@ const LampCirclePicker = props => {
|
|
|
52
52
|
return /*#__PURE__*/React.createElement(View, {
|
|
53
53
|
className: clsx(styled.container, styled.flexCenter),
|
|
54
54
|
style: style
|
|
55
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
56
|
-
className: clsx(styled.innerBox, styled.flexCenter)
|
|
57
55
|
}, showInnerCircle && /*#__PURE__*/React.createElement(View, {
|
|
56
|
+
className: clsx(styled.innerBox, styled.flexCenter)
|
|
57
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
58
58
|
className: styled.ringIcon,
|
|
59
59
|
style: {
|
|
60
60
|
width: innerImgRadius,
|