From 3717d2e19e4a2cef9095d1d5ce65a51e86e93711 Mon Sep 17 00:00:00 2001 From: Ramin Tadayon <67011668+axosoft-ramint@users.noreply.github.com> Date: Wed, 30 Nov 2022 02:22:21 -0700 Subject: [PATCH] Add option to modify the scroll padding for the graph (#2378) * Add option to modify the scroll padding for the graph * Fix label ref --- package.json | 7 +++++++ src/config.ts | 1 + src/plus/webviews/graph/graphWebview.ts | 2 ++ src/plus/webviews/graph/protocol.ts | 1 + src/webviews/apps/plus/graph/GraphWrapper.tsx | 3 ++- src/webviews/apps/settings/partials/commit-graph.html | 15 +++++++++++++++ 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b5c5e07..9e776b9 100644 --- a/package.json +++ b/package.json @@ -2181,6 +2181,13 @@ "scope": "window", "order": 12 }, + "gitlens.graph.scrollRowPadding": { + "type": "number", + "default": 0, + "markdownDescription": "Specifies how many rows from the edge a selected row should be before scrolling starts", + "scope": "window", + "order": 14 + }, "gitlens.graph.showDetailsView": { "type": [ "boolean", diff --git a/src/config.ts b/src/config.ts index 325c353..ba3755b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -388,6 +388,7 @@ export interface GraphConfig { dateStyle: DateStyle | null; defaultItemLimit: number; highlightRowsOnRefHover: boolean; + scrollRowPadding: number; showDetailsView: 'open' | 'selection' | false; showGhostRefsOnRowHover: boolean; showRemoteNames: boolean; diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index cceb4f8..a6b24c3 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -511,6 +511,7 @@ export class GraphWebview extends WebviewBase { configuration.changed(e, 'graph.dateFormat') || configuration.changed(e, 'graph.dateStyle') || configuration.changed(e, 'graph.highlightRowsOnRefHover') || + configuration.changed(e, 'graph.scrollRowPadding') || configuration.changed(e, 'graph.showGhostRefsOnRowHover') || configuration.changed(e, 'graph.showRemoteNames') ) { @@ -1310,6 +1311,7 @@ export class GraphWebview extends WebviewBase { dateStyle: configuration.get('graph.dateStyle') ?? configuration.get('defaultDateStyle'), enableMultiSelection: false, highlightRowsOnRefHover: configuration.get('graph.highlightRowsOnRefHover'), + scrollRowPadding: configuration.get('graph.scrollRowPadding'), showGhostRefsOnRowHover: configuration.get('graph.showGhostRefsOnRowHover'), showRemoteNamesOnRefs: configuration.get('graph.showRemoteNames'), idLength: configuration.get('advanced.abbreviatedShaLength'), diff --git a/src/plus/webviews/graph/protocol.ts b/src/plus/webviews/graph/protocol.ts index 47411de..92546b3 100644 --- a/src/plus/webviews/graph/protocol.ts +++ b/src/plus/webviews/graph/protocol.ts @@ -102,6 +102,7 @@ export interface GraphComponentConfig { dateStyle: DateStyle; enableMultiSelection?: boolean; highlightRowsOnRefHover?: boolean; + scrollRowPadding?: number; showGhostRefsOnRowHover?: boolean; showRemoteNamesOnRefs?: boolean; idLength?: number; diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index b295db1..15d035e 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -402,7 +402,7 @@ export function GraphWrapper({ } if (id != null) { - queueMicrotask(() => graphRef.current?.selectCommits([id!], false)); + queueMicrotask(() => graphRef.current?.selectCommits([id!], false, true)); } }; @@ -728,6 +728,7 @@ export function GraphWrapper({ highlightedShas={searchResults?.ids as GraphContainerProps['highlightedShas']} highlightRowsOnRefHover={graphConfig?.highlightRowsOnRefHover} hiddenRefsById={hiddenRefsById} + scrollRowPadding={graphConfig?.scrollRowPadding} showGhostRefsOnRowHover={graphConfig?.showGhostRefsOnRowHover} showRemoteNamesOnRefs={graphConfig?.showRemoteNamesOnRefs} isLoadingRows={isLoading} diff --git a/src/webviews/apps/settings/partials/commit-graph.html b/src/webviews/apps/settings/partials/commit-graph.html index a6ed4d1..3da60e9 100644 --- a/src/webviews/apps/settings/partials/commit-graph.html +++ b/src/webviews/apps/settings/partials/commit-graph.html @@ -65,6 +65,21 @@
+
+ + + +
+
+ +