File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
apps/desktop/src/components Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 2121 import { inject } from ' @gitbutler/core/context' ;
2222 import { persisted } from ' @gitbutler/shared/persisted' ;
2323 import { DRAG_STATE_SERVICE } from ' @gitbutler/ui/drag/dragStateService.svelte' ;
24+ import { resizeObserver } from ' @gitbutler/ui/utils/resizeObserver' ;
2425 import { isDefined } from ' @gitbutler/ui/utils/typeguards' ;
2526 import { flip } from ' svelte/animate' ;
2627 import type { Stack } from ' $lib/stacks/stack' ;
5556 let visibleIndexes = $state <number []>([0 ]);
5657 let isCreateNewVisible = $state <boolean >(false );
5758
59+ /** Used to offset content shift from opening an unassigned change preview. */
60+ let lastWidth = $state <number >();
61+
5862 const projectState = $derived (uiState .project (projectId ));
5963 const exclusiveAction = $derived (projectState .exclusiveAction .current );
6064 const isCommitting = $derived (exclusiveAction ?.type === ' commit' );
154158 .filter (isDefined )
155159 });
156160 }}
161+ use:resizeObserver ={(data ) => {
162+ if (lastWidth && lanesScrollableEl ) {
163+ const diff = lastWidth - lanesScrollableEl .clientWidth ;
164+ if (Math .abs (diff ) > 100 ) {
165+ lanesScrollableEl .scrollBy ({ left: diff });
166+ }
167+ }
168+ lastWidth = data .frame .width ;
169+ }}
157170>
158171 <div class =" lanes-scrollable" >
159172 <StackDraft {projectId } visible ={isDraftStackVisible } />
You can’t perform that action at this time.
0 commit comments