Skip to content

Commit 2a8dc6d

Browse files
committed
refactor horizontal scrolling in DrawsTabs::tabs() method
1 parent 80315e8 commit 2a8dc6d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Themes/Default/Concerns/DrawsTabs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ protected function tabs(
3939

4040
// automatic horizontal tab scrolling
4141
if ($strippedWidth($top_row) > $width) {
42+
$scroll = $selected / ($tabs->count() - 1);
4243
$chars_to_kill = $strippedWidth($top_row) - $width;
43-
$percent = $selected / ($tabs->count() - 1);
44-
$left = (int) round($percent * $chars_to_kill);
44+
$offset = (int) round($scroll * $chars_to_kill);
4545
foreach ([&$top_row, &$middle_row, &$bottom_row] as &$row) {
46-
$row = mb_substr($row, $left, mb_strwidth($row) - $chars_to_kill);
46+
$row = mb_substr($row, $offset, mb_strwidth($row) - $chars_to_kill);
4747
}
4848
}
4949

0 commit comments

Comments
 (0)