@ray-js/lamp-circle-picker 1.0.11-beta-4 → 1.0.11-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.
@@ -46,6 +46,7 @@ export default function Home() {
46
46
  value={temperature}
47
47
  useEventChannel
48
48
  hideThumb
49
+ lineCap="butt"
49
50
  onTouchMove={handleMove}
50
51
  onTouchEnd={handleEnd}
51
52
  />
@@ -15,6 +15,7 @@ export default function RectColor(props) {
15
15
  canvasId: props.canvasId,
16
16
  colorList: (_props$colorList = props.colorList) !== null && _props$colorList !== void 0 ? _props$colorList : [],
17
17
  useEventChannel: props.useEventChannel,
18
+ lineCap: props.lineCap || 'round',
18
19
  eventChannelName: props.eventChannelName,
19
20
  touchCircleStrokeStyle: props.touchCircleStrokeStyle,
20
21
  touchCircleLineWidth: touchCircleLineWidth,
@@ -35,6 +35,12 @@ export interface IProps {
35
35
  * @default false
36
36
  */
37
37
  useEventChannel?: boolean;
38
+ /**
39
+ * @description.zh 绘制的圆环末端样式
40
+ * @description.en Drawn ring end style
41
+ * @default round
42
+ */
43
+ lineCap?: 'butt' | 'round';
38
44
  /**
39
45
  * @description.zh 色盘渐变颜色列表
40
46
  * @description.en Color plate gradient color list
@@ -41,6 +41,10 @@ Component({
41
41
  type: String,
42
42
  value: 'lampCirclePickerEventChannel'
43
43
  },
44
+ lineCap: {
45
+ type: String,
46
+ value: 'round'
47
+ },
44
48
  touchCircleStrokeStyle: String,
45
49
  touchCircleLineWidth: Number,
46
50
  onTouchStart: Function,
@@ -106,6 +110,7 @@ Component({
106
110
  useEventChannel,
107
111
  eventChannelName,
108
112
  colorList,
113
+ lineCap = 'round',
109
114
  touchCircleStrokeStyle = '',
110
115
  touchCircleLineWidth = 0
111
116
  } = this.data;
@@ -117,6 +122,7 @@ Component({
117
122
  useEventChannel,
118
123
  eventChannelName,
119
124
  hideThumb,
125
+ lineCap,
120
126
  colorList,
121
127
  touchCircleStrokeStyle,
122
128
  touchCircleLineWidth
@@ -324,7 +324,7 @@ export default Render({
324
324
  // 环形色盘
325
325
  async renderAnnulusColor(id, radius, innerRingRadius, temp = 0, options = {}) {
326
326
  let canvas = null;
327
- const { touchCircleStrokeStyle = '', touchCircleLineWidth = 0, hideThumb = false } = options || {};
327
+ const { touchCircleStrokeStyle = '', touchCircleLineWidth = 0, hideThumb = false, lineCap = 'round' } = options || {};
328
328
  this.touchCircleStrokeStyle = touchCircleStrokeStyle;
329
329
  this.touchCircleLineWidth = touchCircleLineWidth;
330
330
  this.hideThumb = hideThumb;
@@ -348,18 +348,19 @@ export default Render({
348
348
 
349
349
  const startAngle = Math.PI * 0.75;
350
350
  const endAngle = Math.PI * 0.25;
351
-
351
+ const counterclockwise = false;
352
352
  ctx.beginPath();
353
353
  ctx.arc(
354
354
  radius * 2,
355
355
  radius * 2,
356
356
  innerRingRadius * 2 + (radius - innerRingRadius),
357
357
  startAngle,
358
- endAngle
358
+ endAngle,
359
+ counterclockwise
359
360
  );
360
361
 
361
362
  let grd = null;
362
- if (ctx.createConicGradient) {
363
+ if (ctx.createConicGradient && lineCap === 'round') {
363
364
  try {
364
365
  grd = ctx.createConicGradient(startAngle - Math.PI * 0.1, radius * 2, radius * 2);
365
366
  options.colorList?.forEach(item => {
@@ -370,7 +371,7 @@ export default Render({
370
371
  //给曲线着色
371
372
  ctx.strokeStyle = grd;
372
373
  //连接处样式
373
- ctx.lineCap = 'round';
374
+ ctx.lineCap = lineCap || 'round';
374
375
  //给环着色
375
376
  ctx.stroke();
376
377
  ctx.closePath();
package/lib/index.js CHANGED
@@ -16,6 +16,7 @@ const LampCirclePicker = props => {
16
16
  colorList,
17
17
  useEventChannel,
18
18
  eventChannelName,
19
+ lineCap,
19
20
  titleStyle,
20
21
  descStyle,
21
22
  descText,
@@ -57,6 +58,7 @@ const LampCirclePicker = props => {
57
58
  touchCircleStrokeStyle: touchCircleStrokeStyle,
58
59
  innerRingRadius: innerRingRadius,
59
60
  colorList: _colorList,
61
+ lineCap: lineCap,
60
62
  useEventChannel: useEventChannel || false,
61
63
  eventChannelName: eventChannelName,
62
64
  onTouchStart: onTouchStart,
package/lib/props.d.ts CHANGED
@@ -74,6 +74,12 @@ export interface IProps {
74
74
  * @default null
75
75
  */
76
76
  eventChannelName?: string;
77
+ /**
78
+ * @description.zh 绘制的圆环末端样式
79
+ * @description.en Drawn ring end style
80
+ * @default round
81
+ */
82
+ lineCap?: 'butt' | 'round';
77
83
  /**
78
84
  * @description.en titleStyle
79
85
  * @description.zh 标题样式
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-circle-picker",
3
- "version": "1.0.11-beta-4",
3
+ "version": "1.0.11-beta-5",
4
4
  "description": "照明缺角色环",
5
5
  "main": "lib/index",
6
6
  "files": [