@@ -15,6 +15,7 @@ import { slide } from "svelte/transition";
1515import { expoOut } from " svelte/easing" ;
1616
1717import { getContext } from " svelte" ;
18+ import { stopPropagation } from " svelte/legacy" ;
1819
1920
2021interface Props {
@@ -35,7 +36,8 @@ function onmousedown(e: MouseEvent)
3536 dragging .sub_id = subtitle .id ;
3637
3738 if (dragging .ghost ) {
38- dragging .ghost .innerHTML = self .innerHTML ;
39+ // dragging.ghost.innerHTML = self.innerHTML;
40+ dragging .ghost .style .height = ` ${self .offsetHeight }px ` ;
3941 }
4042
4143 dragging .offset_y = self .getBoundingClientRect ().y - e .clientY ;
@@ -47,22 +49,14 @@ function onmouseenter(e: MouseEvent)
4749{
4850 e .stopPropagation ();
4951
50- console .log (" dragging.sub_id =" , dragging .sub_id );
51- console .log (" subtitle.id =" , subtitle .id );
52-
5352 if (! dragging .sub_id || dragging .sub_id === subtitle .id ) return ;
5453
55- // console.log("$subtitles.subs.before =", $subtitles.subs.map(sub => `${sub.id}-${sub.body}`));
5654 if (dragging .direction === " up" ) {
5755 $subtitles .reorder_before_by_id (dragging .sub_id , subtitle .id );
5856 } else {
5957 $subtitles .reorder_after_by_id (dragging .sub_id , subtitle .id );
6058 }
61- // console.log("$subtitles.subs.after =", $subtitles.subs.map(sub => `${sub.id}-${sub.body}`));
6259 $subtitles .subs = $subtitles .subs ;
63-
64- dragging .reordering_id = subtitle .id ;
65- requestAnimationFrame (() => { dragging .reordering_id = null ; });
6660}
6761
6862
@@ -93,18 +87,17 @@ function get(
9387
9488
9589<div style:position =" relative" >
96- <Insert {index } />
90+ <Insert {index } { dragging } />
9791
9892<!-- svelte-ignore a11y_no_static_element_interactions -->
9993<div
10094 class =" subtitle"
10195 class:grabbed ={dragging .sub_id === subtitle .id }
10296 bind:this ={self }
103- {onmousedown }
10497 {onmouseenter }
10598 transition:slide ={{ duration : 400 , easing : expoOut }}
10699>
107- <div class =" grabber" >
100+ <div class ="grabber" { onmousedown } >
108101 <div >=</div >
109102 </div >
110103
@@ -172,15 +165,16 @@ function get(
172165 box-shadow : 0 0 4px rgb (black , 20% );
173166 }
174167
175- & :has (.grabber :active ) {
176- user-select : none ;
177- border-color : $col-prot ;
178- outline-color : color .change ($col-prot , $alpha : 0.2 );
179- box-shadow : 0 0 0 rgb (black , 20% );
180- }
168+ // &:has(.grabber:active) {
169+ // user-select: none;
170+ // border-color: $col-prot;
171+ // outline-color: color.change($col-prot, $alpha: 0.2);
172+ // box-shadow: 0 0 0 rgb(black, 20%);
173+ // }
181174
182175 & .grabbed {
183- opacity : 0% ;
176+ user-select : none ;
177+ opacity : 0 ;
184178 }
185179}
186180
@@ -201,21 +195,23 @@ function get(
201195
202196
203197.grabber {
204- padding : 0 0.5 rem ;
198+ padding : 0 0.1 rem ;
205199 display : flex ;
206200 justify-content : center ;
207201 align-items : center ;
208202 @include font-code ;
209203 color : rgb (black , 20% );
204+ font-size : 150% ;
210205 opacity : 0 ;
211206 transition : all 0.1s ease-out ;
212207
213208 .subtitle :where (:hover , :focus-visible ) & {
214- opacity : 100 % ;
209+ opacity : 1 ;
215210 }
216211
217212 & :hover {
218213 cursor : grab ;
214+ color : rgb (black , 50% );
219215 }
220216
221217 & :active {
@@ -243,7 +239,7 @@ function get(
243239 transition : all 0.1s ease-out ;
244240
245241 .subtitle :where (:hover , :focus-visible , :focus-within ) &{
246- opacity : 100 % ;
242+ opacity : 1 ;
247243 }
248244 .subtitle :where(:hover , :focus-visible , :focus-within ) & [disabled ] {
249245 pointer-events : none ;
0 commit comments