Skip to content

Commit 02cdeba

Browse files
committed
feat(core): Use scale instead of shadows when user is dragging
1 parent 0334dfd commit 02cdeba

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/ColorPicker.vue

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
2-
<div class="color-picker"
3-
tabindex="0"
2+
<div tabindex="0"
3+
class="color-picker"
4+
:class="{ 'dragging': isDragging }"
45
@keyup.enter="selectColor"
56
@keydown.up.right.prevent="rotate($event, true)"
67
@keydown.down.left.prevent="rotate($event, false)">
@@ -197,10 +198,10 @@
197198
198199
@function z-depth-all($depth: 1) {
199200
$color1: 0.12, 0.19, 0.38;
200-
$blur1: 10px, 50px, 30px;
201+
$blur1: 10px, 20px, 30px;
201202
202203
$color2: 0.16, 0.24, 0.48;
203-
$blur2: 5px, 15px, 15px;
204+
$blur2: 5px, 10px, 15px;
204205
@return 0 0 nth($blur1, $depth) rgba(0, 0, 0, nth($color1, $depth)), 0 0 nth($blur2, $depth) rgba(0, 0, 0, nth($color2, $depth));
205206
}
206207
@@ -209,12 +210,22 @@
209210
width: 280px;
210211
height: 280px;
211212
position: relative;
213+
transform: scale(1.001);
214+
transition: transform 0.15s cubic-bezier(0.68, 0, 0.47, 2);
212215
213216
&:focus {
214217
outline: 0;
218+
}
219+
220+
&:hover .knob {
221+
box-shadow: z-depth-all(2);
222+
}
223+
224+
&.dragging {
225+
transform: scale(1.04);
215226
216-
.knob {
217-
box-shadow: z-depth-all(3);
227+
.rotator {
228+
z-index: 1;
218229
}
219230
}
220231
@@ -277,10 +288,6 @@
277288
height: 100%;
278289
position: absolute;
279290
280-
&.dragging {
281-
z-index: 1;
282-
}
283-
284291
&.disabled {
285292
pointer-events: none;
286293
}
@@ -308,10 +315,6 @@
308315
}
309316
}
310317
311-
&:not(:focus) .knob:hover {
312-
box-shadow: z-depth-all(2);
313-
}
314-
315318
.selector {
316319
position: absolute;
317320
width: 25%;

0 commit comments

Comments
 (0)