@ray-js/lamp-circle-picker 1.0.13-beta-2 → 1.0.13-beta-3

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.
@@ -283,16 +283,25 @@ 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
+
286
289
  // 起始端点(135度位置)
287
290
  const startAngleRad = (startAngle * Math.PI) / 180;
288
- const startX = centerX + midRadius * Math.cos(startAngleRad);
289
- const startY = centerY + midRadius * Math.sin(startAngleRad);
291
+ // 切线方向是半径方向顺时针旋转90度(+π/2),沿色环正向平移
292
+ const startTangentAngle = startAngleRad + Math.PI / 2;
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);
290
297
  const startColor = gradientColors[1] || gradientColors[0]; // 使用第一个颜色
291
298
 
292
299
  // 结束端点(405度位置)
293
300
  const endAngleRad = (endAngle * Math.PI) / 180;
294
- const endX = centerX + midRadius * Math.cos(endAngleRad);
295
- const endY = centerY + midRadius * Math.sin(endAngleRad);
301
+ // 切线方向是半径方向逆时针旋转90度(-π/2),沿色环反向平移
302
+ const endTangentAngle = endAngleRad - Math.PI / 2;
303
+ const endX = centerX + midRadius * Math.cos(endAngleRad) + offset * Math.cos(endTangentAngle);
304
+ const endY = centerY + midRadius * Math.sin(endAngleRad) + offset * Math.sin(endTangentAngle);
296
305
  const endColor =
297
306
  gradientColors[gradientColors.length - 2] || gradientColors[gradientColors.length - 1]; // 使用最后一个颜色
298
307
 
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-3",
4
4
  "description": "照明缺角色环",
5
5
  "main": "lib/index",
6
6
  "files": [