@ray-js/lamp-circle-picker 1.0.13-beta-4 → 1.0.13-beta-5
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/lib/component/rjs/index.rjs +35 -24
- package/package.json +1 -1
|
@@ -283,16 +283,27 @@ export default Render({
|
|
|
283
283
|
// 计算色环中线半径
|
|
284
284
|
const midRadius = (innerRadius + (outerRadius - innerRadius) / 2) * scale;
|
|
285
285
|
|
|
286
|
+
// 切向偏移量(4px,考虑scale),用于消除某些机型上的间隙
|
|
287
|
+
const tangentOffset = 4 * scale;
|
|
288
|
+
|
|
286
289
|
// 起始端点(135度位置)
|
|
287
290
|
const startAngleRad = (startAngle * Math.PI) / 180;
|
|
288
|
-
|
|
289
|
-
const
|
|
291
|
+
// 切向方向:顺时针旋转90度
|
|
292
|
+
const startTangentAngle = startAngleRad + Math.PI / 2;
|
|
293
|
+
const startX =
|
|
294
|
+
centerX + midRadius * Math.cos(startAngleRad) + tangentOffset * Math.cos(startTangentAngle);
|
|
295
|
+
const startY =
|
|
296
|
+
centerY + midRadius * Math.sin(startAngleRad) + tangentOffset * 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
|
-
|
|
295
|
-
const
|
|
301
|
+
// 切向方向:逆时针旋转90度
|
|
302
|
+
const endTangentAngle = endAngleRad - Math.PI / 2;
|
|
303
|
+
const endX =
|
|
304
|
+
centerX + midRadius * Math.cos(endAngleRad) + tangentOffset * Math.cos(endTangentAngle);
|
|
305
|
+
const endY =
|
|
306
|
+
centerY + midRadius * Math.sin(endAngleRad) + tangentOffset * Math.sin(endTangentAngle);
|
|
296
307
|
const endColor =
|
|
297
308
|
gradientColors[gradientColors.length - 2] || gradientColors[gradientColors.length - 1]; // 使用最后一个颜色
|
|
298
309
|
|
|
@@ -300,18 +311,19 @@ export default Render({
|
|
|
300
311
|
ctx.globalCompositeOperation = 'source-over';
|
|
301
312
|
|
|
302
313
|
// 起始端点 - 使用闭合路径绘制半圆,确保与色环无缝衔接
|
|
303
|
-
//
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
const
|
|
314
|
+
// 计算半圆弧的起始和结束点(基于半圆中心和半径)
|
|
315
|
+
const startArcInnerX = startX + endpointRadius * Math.cos(startAngleRad);
|
|
316
|
+
const startArcInnerY = startY + endpointRadius * Math.sin(startAngleRad);
|
|
317
|
+
const startArcOuterX = startX + endpointRadius * Math.cos(startAngleRad - Math.PI);
|
|
318
|
+
const startArcOuterY = startY + endpointRadius * Math.sin(startAngleRad - Math.PI);
|
|
308
319
|
|
|
309
320
|
ctx.beginPath();
|
|
310
|
-
//
|
|
311
|
-
ctx.moveTo(
|
|
312
|
-
//
|
|
321
|
+
// 从半圆弧的起点(内侧)开始
|
|
322
|
+
ctx.moveTo(startArcInnerX, startArcInnerY);
|
|
323
|
+
// 绘制半圆弧到外侧
|
|
313
324
|
ctx.arc(startX, startY, endpointRadius, startAngleRad, startAngleRad - Math.PI, true);
|
|
314
|
-
//
|
|
325
|
+
// 连接回起点,形成闭合路径
|
|
326
|
+
ctx.lineTo(startArcInnerX, startArcInnerY);
|
|
315
327
|
ctx.closePath();
|
|
316
328
|
|
|
317
329
|
// 使用与色环相同的径向渐变
|
|
@@ -325,23 +337,23 @@ export default Render({
|
|
|
325
337
|
);
|
|
326
338
|
startGradient.addColorStop(0, startColor);
|
|
327
339
|
startGradient.addColorStop(1, startColor);
|
|
328
|
-
|
|
329
340
|
ctx.fillStyle = startGradient;
|
|
330
341
|
ctx.fill();
|
|
331
342
|
|
|
332
343
|
// 结束端点 - 使用闭合路径绘制半圆,确保与色环无缝衔接
|
|
333
|
-
//
|
|
334
|
-
const
|
|
335
|
-
const
|
|
336
|
-
const
|
|
337
|
-
const
|
|
344
|
+
// 计算半圆弧的起始和结束点(基于半圆中心和半径)
|
|
345
|
+
const endArcInnerX = endX + endpointRadius * Math.cos(endAngleRad);
|
|
346
|
+
const endArcInnerY = endY + endpointRadius * Math.sin(endAngleRad);
|
|
347
|
+
const endArcOuterX = endX + endpointRadius * Math.cos(endAngleRad + Math.PI);
|
|
348
|
+
const endArcOuterY = endY + endpointRadius * Math.sin(endAngleRad + Math.PI);
|
|
338
349
|
|
|
339
350
|
ctx.beginPath();
|
|
340
|
-
//
|
|
341
|
-
ctx.moveTo(
|
|
342
|
-
//
|
|
351
|
+
// 从半圆弧的起点(内侧)开始
|
|
352
|
+
ctx.moveTo(endArcInnerX, endArcInnerY);
|
|
353
|
+
// 绘制半圆弧到外侧
|
|
343
354
|
ctx.arc(endX, endY, endpointRadius, endAngleRad, endAngleRad + Math.PI, false);
|
|
344
|
-
//
|
|
355
|
+
// 连接回起点,形成闭合路径
|
|
356
|
+
ctx.lineTo(endArcInnerX, endArcInnerY);
|
|
345
357
|
ctx.closePath();
|
|
346
358
|
|
|
347
359
|
// 使用与色环相同的径向渐变
|
|
@@ -355,7 +367,6 @@ export default Render({
|
|
|
355
367
|
);
|
|
356
368
|
endGradient.addColorStop(0, endColor);
|
|
357
369
|
endGradient.addColorStop(1, endColor);
|
|
358
|
-
|
|
359
370
|
ctx.fillStyle = endGradient;
|
|
360
371
|
ctx.fill();
|
|
361
372
|
},
|