@ray-js/lamp-circle-picker 1.0.13-beta-2 → 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.
@@ -68,7 +68,7 @@ export default function Home() {
68
68
  <LampCirclePicker
69
69
  value={temperature}
70
70
  innerRingRadius={80}
71
- showInnerCircle
71
+ showInnerCircle={false}
72
72
  colorList={[
73
73
  { offset: 0, color: '#ff0000' },
74
74
  { offset: 0.5, color: '#00ff00' },
@@ -299,13 +299,20 @@ export default Render({
299
299
  // 重置合成操作以正常绘制端点
300
300
  ctx.globalCompositeOperation = 'source-over';
301
301
 
302
- // 起始端点 - 使用半圆,封闭色环起点
303
- // 半圆应该朝向色环外侧(逆时针方向),角度范围是从色环切线的外侧到内侧
304
- const startHalfCircleStart = startAngleRad - Math.PI; // 色环外侧
305
- const startHalfCircleEnd = startAngleRad; // 色环内侧
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);
306
308
 
307
309
  ctx.beginPath();
308
- ctx.arc(startX, startY, endpointRadius, startHalfCircleStart, startHalfCircleEnd, false);
310
+ // 从内边缘开始
311
+ ctx.moveTo(startInnerX, startInnerY);
312
+ // 绘制半圆弧(从内边缘到外边缘)
313
+ ctx.arc(startX, startY, endpointRadius, startAngleRad, startAngleRad - Math.PI, true);
314
+ // 闭合路径(从外边缘回到内边缘)
315
+ ctx.closePath();
309
316
 
310
317
  // 使用与色环相同的径向渐变
311
318
  const startGradient = ctx.createRadialGradient(
@@ -321,15 +328,21 @@ export default Render({
321
328
 
322
329
  ctx.fillStyle = startGradient;
323
330
  ctx.fill();
324
- ctx.closePath();
325
331
 
326
- // 结束端点 - 使用半圆,封闭色环终点
327
- // 半圆应该朝向色环外侧(顺时针方向),角度范围是从色环切线的内侧到外侧
328
- const endHalfCircleStart = endAngleRad; // 色环内侧
329
- const endHalfCircleEnd = endAngleRad + Math.PI; // 色环外侧
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);
330
338
 
331
339
  ctx.beginPath();
332
- ctx.arc(endX, endY, endpointRadius, endHalfCircleStart, endHalfCircleEnd, false);
340
+ // 从内边缘开始
341
+ ctx.moveTo(endInnerX, endInnerY);
342
+ // 绘制半圆弧(从内边缘到外边缘)
343
+ ctx.arc(endX, endY, endpointRadius, endAngleRad, endAngleRad + Math.PI, false);
344
+ // 闭合路径(从外边缘回到内边缘)
345
+ ctx.closePath();
333
346
 
334
347
  // 使用与色环相同的径向渐变
335
348
  const endGradient = ctx.createRadialGradient(
@@ -345,7 +358,6 @@ export default Render({
345
358
 
346
359
  ctx.fillStyle = endGradient;
347
360
  ctx.fill();
348
- ctx.closePath();
349
361
  },
350
362
 
351
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-circle-picker",
3
- "version": "1.0.13-beta-2",
3
+ "version": "1.0.13-beta-4",
4
4
  "description": "照明缺角色环",
5
5
  "main": "lib/index",
6
6
  "files": [