@@ -16,7 +16,10 @@ export class GlChartScroller extends GlElement {
1616 --track-left: 0;
1717 --track-width: 100%;
1818 --track-height: 1.2rem;
19+
1920 --thumb-height: 0.6rem;
21+ --thumb-width: 2rem;
22+ --thumb-left: 0;
2023 }
2124
2225 .track {
@@ -30,11 +33,16 @@ export class GlChartScroller extends GlElement {
3033 z-index: 1;
3134 }
3235
36+ .track[scrollable] {
37+ visibility: visible;
38+ }
39+
3340 .thumb {
3441 position: absolute;
3542 top: 0;
36- left: 0 ;
43+ left: var(--thumb-left) ;
3744 height: var(--thumb-height);
45+ width: var(--thumb-width);
3846 min-width: 2rem;
3947 background: transparent;
4048 transition: background 1s linear;
@@ -100,19 +108,16 @@ export class GlChartScroller extends GlElement {
100108
101109 override willUpdate ( _changedProperties : PropertyValues ) : void {
102110 ( { size : this . size , position : this . position } = this . calculateScrollState ( ) ) ;
111+
112+ this . style . setProperty ( '--thumb-width' , `${ this . size } %` ) ;
113+ this . style . setProperty ( '--thumb-left' , `${ this . position } %` ) ;
103114 }
104115
105116 override render ( ) : unknown {
106117 return html `< slot > </ slot >
107- < div
108- class ="track "
109- part ="track "
110- style ="visibility: ${ this . isScrollable ( ) ? 'visible' : 'hidden' } "
111- @pointerdown ="${ this . onTrackClick } "
112- >
118+ < div class ="track " part ="track " ?scrollable ="${ this . isScrollable ( ) } " @pointerdown ="${ this . onTrackClick } ">
113119 < div
114120 class ="thumb "
115- style ="width:${ this . size } %;left:${ this . position } %; "
116121 @pointerdown ="${ this . onDragStart } "
117122 @pointermove ="${ this . onDragMove } "
118123 @pointerup ="${ this . onDragEnd } "
@@ -215,7 +220,6 @@ export class GlChartScroller extends GlElement {
215220 return ;
216221 }
217222
218- e . preventDefault ( ) ;
219223 e . stopPropagation ( ) ;
220224 e . stopImmediatePropagation ( ) ;
221225
0 commit comments