adding opacity transition variable

This commit is contained in:
Aiday Marlen Kyzy 2023-08-25 13:01:53 +02:00
parent bb0a1b185b
commit 4e1b2aeb4a
No known key found for this signature in database
GPG key ID: 24A8B53DBD26FF4E
3 changed files with 18 additions and 2 deletions

View file

@ -749,7 +749,7 @@
"--vscode-sash-size",
"--vscode-editorStickyScroll-cursorOutsideHover",
"--vscode-editorStickyScroll-opacityOutsideHover",
"--vscode-editorStickyScroll-transitionOpacity",
"--vscode-editorStickyScroll-opacityTransition",
"--vscode-editorStickyScroll-scrollableWidth",
"--window-border-color",
"--workspace-trust-check-color",

View file

@ -39,6 +39,7 @@
float: right;
cursor: var(--vscode-editorStickyScroll-cursorOutsideHover, 'default');
opacity: var(--vscode-editorStickyScroll-opacityOutsideHover, '0');
transition: var(--vscode-editorStickyScroll-opacityTransition, 'opacity 0s');
}

View file

@ -176,11 +176,25 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
if (showFoldingControls !== 'mouseover') {
return;
}
this._foldingIconStore.add(dom.addDisposableListener(this._lineNumbersDomNode, dom.EventType.MOUSE_ENTER, () => {
this._foldingIconStore.add(dom.addDisposableListener(this._lineNumbersDomNode, dom.EventType.MOUSE_ENTER, (e) => {
let insideOfStickyScroll = false;
if ('fromElement' in e && (e.fromElement instanceof HTMLElement)) {
if (e.fromElement.classList.contains('codicon')) {
insideOfStickyScroll = true;
}
}
for (const line of this._stickyLines) {
const lineNumberDomNode = line.lineNumberDomNode;
if (insideOfStickyScroll) {
lineNumberDomNode.style.setProperty('--vscode-editorStickyScroll-opacityTransition', 'opacity 0s');
}
lineNumberDomNode.style.setProperty('--vscode-editorStickyScroll-cursorOutsideHover', `pointer`);
lineNumberDomNode.style.setProperty('--vscode-editorStickyScroll-opacityOutsideHover', `1`);
if (insideOfStickyScroll) {
setTimeout(() => {
lineNumberDomNode.style.setProperty('--vscode-editorStickyScroll-opacityTransition', 'opacity 0.5s');
}, 300);
}
}
}));
this._foldingIconStore.add(dom.addDisposableListener(this._lineNumbersDomNode, dom.EventType.MOUSE_LEAVE, () => {
@ -312,6 +326,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
container.style.setProperty('--vscode-editorStickyScroll-cursorOutsideHover', showFoldingControls === `mouseover` ? `default` : `pointer`);
container.style.setProperty('--vscode-editorStickyScroll-opacityOutsideHover', showFoldingControls === `mouseover` ? `0` : `1`);
}
container.style.setProperty('--vscode-editorStickyScroll-opacityTransition', 'opacity 0.5s');
// Setting the click listener
this._foldingIconStore.add(dom.addDisposableListener(foldingIcon, dom.EventType.CLICK, () => {