File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
core/src/components/segment Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,7 @@ export class Segment implements ComponentInterface {
340340 * scroll container.
341341 */
342342 const centeredX = activeButtonLeft - scrollContainerBox . width / 2 + activeButtonBox . width / 2 ;
343+ console . log ( centeredX ) ;
343344
344345 /**
345346 * We intentionally use scrollBy here instead of scrollIntoView
@@ -354,10 +355,24 @@ export class Segment implements ComponentInterface {
354355 * within the scroll container, the browser will attempt
355356 * to center by as much as it can.
356357 */
357- el . scrollBy ( {
358- top : 0 ,
359- left : centeredX ,
358+ // el.scrollBy({
359+ // top: 0,
360+ // left: centeredX,
361+ // behavior: smoothScroll ? 'smooth' : 'instant',
362+ // });
363+
364+ activeButton . scrollIntoView ( {
360365 behavior : smoothScroll ? 'smooth' : 'instant' ,
366+ inline : 'center' ,
367+
368+ /**
369+ * Segment should scroll on the
370+ * horizontal axis. `block: 'nearest'`
371+ * ensures that the vertical axis
372+ * does not scroll if the segment
373+ * as a whole is already in view.
374+ */
375+ block : 'nearest' ,
361376 } ) ;
362377 }
363378 }
You can’t perform that action at this time.
0 commit comments