Skip to content

Commit affff12

Browse files
feat: update ColorPicker alpha drag
1 parent a48efff commit affff12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

components/colorpicker/ColorPicker.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ function handleUpdateAlpha(alpha: number): void {
440440
}
441441
// alpha slider mouse down
442442
function handleAlphaSliderMouseDown(e: MouseEvent): void {
443-
if (!alphaRailRef.value || !rgbaComputed.value) return
444443
document.addEventListener('mousemove', handleAlphaSliderMouseMove)
445444
document.addEventListener('mouseup', handleAlphaSliderMouseUp)
446445
handleAlphaSliderMouseMove(e)
@@ -452,7 +451,7 @@ function normalizeAlpha(alpha: number): number {
452451
function handleAlphaSliderMouseMove(e: MouseEvent): void {
453452
if (!alphaRailRef.value) return
454453
const { width, left } = alphaRailRef.value.getBoundingClientRect()
455-
const newAlpha = normalizeAlpha((e.clientX - left) / (width - HANDLE_SIZE_NUM))
454+
const newAlpha = normalizeAlpha((e.clientX - left - BORDER_RADIUS_NUM) / (width - HANDLE_SIZE_NUM))
456455
handleUpdateAlpha(newAlpha)
457456
}
458457
function handleAlphaSliderMouseUp(): void {
@@ -932,6 +931,7 @@ function onClear() {
932931
.color-picker-slider {
933932
margin-bottom: 8px;
934933
position: relative;
934+
cursor: pointer;
935935
&::after {
936936
content: '';
937937
position: absolute;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-amazing-ui",
3-
"version": "2.4.15",
3+
"version": "2.4.16",
44
"private": false,
55
"type": "module",
66
"author": "theMuseCatcher",

0 commit comments

Comments
 (0)