Merge from vscode 7eaf220cafb9d9e901370ffce02229171cbf3ea6

This commit is contained in:
ADS Merger
2020-09-03 02:34:56 +00:00
committed by Anthony Dresser
parent 39d9eed585
commit a63578e6f7
519 changed files with 14338 additions and 6670 deletions

View File

@@ -8,6 +8,7 @@ import 'vs/css!./media/actions';
import * as nls from 'vs/nls';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { domEvent } from 'vs/base/browser/event';
import { Color } from 'vs/base/common/color';
import { Event } from 'vs/base/common/event';
import { IDisposable, toDisposable, dispose, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { getDomNodePagePosition, createStyleSheet, createCSSRule, append, $ } from 'vs/base/browser/dom';
@@ -123,14 +124,29 @@ class ToggleScreencastModeAction extends Action2 {
const onMouseUp = domEvent(container, 'mouseup', true);
const onMouseMove = domEvent(container, 'mousemove', true);
const updateMouseIndicatorColor = () => {
mouseMarker.style.borderColor = Color.fromHex(configurationService.getValue<string>('screencastMode.mouseIndicatorColor')).toString();
};
let mouseIndicatorSize: number;
const updateMouseIndicatorSize = () => {
mouseIndicatorSize = clamp(configurationService.getValue<number>('screencastMode.mouseIndicatorSize') || 20, 20, 100);
mouseMarker.style.height = `${mouseIndicatorSize}px`;
mouseMarker.style.width = `${mouseIndicatorSize}px`;
};
updateMouseIndicatorColor();
updateMouseIndicatorSize();
disposables.add(onMouseDown(e => {
mouseMarker.style.top = `${e.clientY - 10}px`;
mouseMarker.style.left = `${e.clientX - 10}px`;
mouseMarker.style.top = `${e.clientY - mouseIndicatorSize / 2}px`;
mouseMarker.style.left = `${e.clientX - mouseIndicatorSize / 2}px`;
mouseMarker.style.display = 'block';
const mouseMoveListener = onMouseMove(e => {
mouseMarker.style.top = `${e.clientY - 10}px`;
mouseMarker.style.left = `${e.clientX - 10}px`;
mouseMarker.style.top = `${e.clientY - mouseIndicatorSize / 2}px`;
mouseMarker.style.left = `${e.clientX - mouseIndicatorSize / 2}px`;
});
Event.once(onMouseUp)(() => {
@@ -150,8 +166,14 @@ class ToggleScreencastModeAction extends Action2 {
keyboardMarker.style.bottom = `${clamp(configurationService.getValue<number>('screencastMode.verticalOffset') || 0, 0, 90)}%`;
};
let keyboardMarkerTimeout: number;
const updateKeyboardMarkerTimeout = () => {
keyboardMarkerTimeout = clamp(configurationService.getValue<number>('screencastMode.keyboardOverlayTimeout') || 800, 500, 5000);
};
updateKeyboardFontSize();
updateKeyboardMarker();
updateKeyboardMarkerTimeout();
disposables.add(configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('screencastMode.verticalOffset')) {
@@ -161,6 +183,18 @@ class ToggleScreencastModeAction extends Action2 {
if (e.affectsConfiguration('screencastMode.fontSize')) {
updateKeyboardFontSize();
}
if (e.affectsConfiguration('screencastMode.keyboardOverlayTimeout')) {
updateKeyboardMarkerTimeout();
}
if (e.affectsConfiguration('screencastMode.mouseIndicatorColor')) {
updateMouseIndicatorColor();
}
if (e.affectsConfiguration('screencastMode.mouseIndicatorSize')) {
updateMouseIndicatorSize();
}
}));
const onKeyDown = domEvent(window, 'keydown', true);
@@ -190,7 +224,7 @@ class ToggleScreencastModeAction extends Action2 {
append(keyboardMarker, key);
}
const promise = timeout(800);
const promise = timeout(keyboardMarkerTimeout);
keyboardTimeout = toDisposable(() => promise.cancel());
promise.then(() => {
@@ -276,8 +310,30 @@ configurationRegistry.registerConfiguration({
},
'screencastMode.onlyKeyboardShortcuts': {
type: 'boolean',
description: nls.localize('screencastMode.onlyKeyboardShortcuts', "Only show keyboard shortcuts in Screencast Mode."),
description: nls.localize('screencastMode.onlyKeyboardShortcuts', "Only show keyboard shortcuts in screencast mode."),
default: false
}
},
'screencastMode.keyboardOverlayTimeout': {
type: 'number',
default: 800,
minimum: 500,
maximum: 5000,
description: nls.localize('screencastMode.keyboardOverlayTimeout', "Controls how long (in milliseconds) the keyboard overlay is shown in screencast mode.")
},
'screencastMode.mouseIndicatorColor': {
type: 'string',
format: 'color-hex',
default: '#FF0000',
minLength: 4,
maxLength: 9,
description: nls.localize('screencastMode.mouseIndicatorColor', "Controls the color in hex (#RGB, #RGBA, #RRGGBB or #RRGGBBAA) of the mouse indicator in screencast mode.")
},
'screencastMode.mouseIndicatorSize': {
type: 'number',
default: 20,
minimum: 20,
maximum: 100,
description: nls.localize('screencastMode.mouseIndicatorSize', "Controls the size (in pixels) of the mouse indicator in screencast mode.")
},
}
});