mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -153,7 +153,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
|
||||
}
|
||||
|
||||
private static _digitCount(n: number): number {
|
||||
var r = 0;
|
||||
let r = 0;
|
||||
while (n) {
|
||||
n = Math.floor(n / 10);
|
||||
r++;
|
||||
@@ -211,7 +211,7 @@ const editorConfiguration: IConfigurationNode = {
|
||||
nls.localize('lineNumbers.interval', "Line numbers are rendered every 10 lines.")
|
||||
],
|
||||
'default': 'on',
|
||||
'description': nls.localize('lineNumbers', "Controls the display of line numbers. Possible values are 'on', 'off', and 'relative'.")
|
||||
'description': nls.localize('lineNumbers', "Controls the display of line numbers. Possible values are 'on', 'off', 'relative' and 'interval'.")
|
||||
},
|
||||
'editor.rulers': {
|
||||
'type': 'array',
|
||||
@@ -264,6 +264,12 @@ const editorConfiguration: IConfigurationNode = {
|
||||
'default': EDITOR_DEFAULTS.viewInfo.minimap.enabled,
|
||||
'description': nls.localize('minimap.enabled', "Controls if the minimap is shown")
|
||||
},
|
||||
'editor.minimap.side': {
|
||||
'type': 'string',
|
||||
'enum': ['left', 'right'],
|
||||
'default': EDITOR_DEFAULTS.viewInfo.minimap.side,
|
||||
'description': nls.localize('minimap.side', "Controls the side where to render the minimap. Possible values are \'right\' and \'left\'")
|
||||
},
|
||||
'editor.minimap.showSlider': {
|
||||
'type': 'string',
|
||||
'enum': ['always', 'mouseover'],
|
||||
@@ -293,7 +299,8 @@ const editorConfiguration: IConfigurationNode = {
|
||||
'editor.find.globalFindClipboard': {
|
||||
'type': 'boolean',
|
||||
'default': EDITOR_DEFAULTS.contribInfo.find.globalFindClipboard,
|
||||
'description': nls.localize('find.globalFindClipboard', "Controls if the Find Widget should read or modify the shared find clipboard on macOS")
|
||||
'description': nls.localize('find.globalFindClipboard', "Controls if the Find Widget should read or modify the shared find clipboard on macOS"),
|
||||
'included': platform.isMacintosh
|
||||
},
|
||||
'editor.wordWrap': {
|
||||
'type': 'string',
|
||||
@@ -351,8 +358,8 @@ const editorConfiguration: IConfigurationNode = {
|
||||
'type': 'string',
|
||||
'enum': ['ctrlCmd', 'alt'],
|
||||
'enumDescriptions': [
|
||||
nls.localize('multiCursorModifier.ctrlCmd', "Maps to `Control` on Windows and Linux and to `Command` on OSX."),
|
||||
nls.localize('multiCursorModifier.alt', "Maps to `Alt` on Windows and Linux and to `Option` on OSX.")
|
||||
nls.localize('multiCursorModifier.ctrlCmd', "Maps to `Control` on Windows and Linux and to `Command` on macOS."),
|
||||
nls.localize('multiCursorModifier.alt', "Maps to `Alt` on Windows and Linux and to `Option` on macOS.")
|
||||
],
|
||||
'default': 'alt',
|
||||
'description': nls.localize({
|
||||
@@ -361,7 +368,7 @@ const editorConfiguration: IConfigurationNode = {
|
||||
'- `ctrlCmd` refers to a value the setting can take and should not be localized.',
|
||||
'- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized.'
|
||||
]
|
||||
}, "The modifier to be used to add multiple cursors with the mouse. `ctrlCmd` maps to `Control` on Windows and Linux and to `Command` on OSX. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier.")
|
||||
}, "The modifier to be used to add multiple cursors with the mouse. `ctrlCmd` maps to `Control` on Windows and Linux and to `Command` on macOS. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier.")
|
||||
},
|
||||
'editor.quickSuggestions': {
|
||||
'anyOf': [
|
||||
@@ -461,6 +468,17 @@ const editorConfiguration: IConfigurationNode = {
|
||||
'default': EDITOR_DEFAULTS.contribInfo.wordBasedSuggestions,
|
||||
'description': nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.")
|
||||
},
|
||||
'editor.suggestSelection': {
|
||||
'type': 'string',
|
||||
'enum': ['first', 'recentlyUsed', 'recentlyUsedByPrefix'],
|
||||
'enumDescriptions': [
|
||||
nls.localize('suggestSelection.first', "Always select the first suggestion."),
|
||||
nls.localize('suggestSelection.recentlyUsed', "Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),
|
||||
nls.localize('suggestSelection.recentlyUsedByPrefix', "Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`."),
|
||||
],
|
||||
'default': 'recentlyUsed',
|
||||
'description': nls.localize('suggestSelection', "Controls how suggestions are pre-selected when showing the suggest list.")
|
||||
},
|
||||
'editor.suggestFontSize': {
|
||||
'type': 'integer',
|
||||
'default': 0,
|
||||
@@ -510,6 +528,11 @@ const editorConfiguration: IConfigurationNode = {
|
||||
'default': editorOptions.cursorStyleToString(EDITOR_DEFAULTS.viewInfo.cursorStyle),
|
||||
'description': nls.localize('cursorStyle', "Controls the cursor style, accepted values are 'block', 'block-outline', 'line', 'line-thin', 'underline' and 'underline-thin'")
|
||||
},
|
||||
'editor.cursorWidth': {
|
||||
'type': 'integer',
|
||||
'default': EDITOR_DEFAULTS.viewInfo.cursorWidth,
|
||||
'description': nls.localize('cursorWidth', "Controls the width of the cursor when editor.cursorStyle is set to 'line'")
|
||||
},
|
||||
'editor.fontLigatures': {
|
||||
'type': 'boolean',
|
||||
'default': EDITOR_DEFAULTS.viewInfo.fontLigatures,
|
||||
|
||||
@@ -102,6 +102,11 @@ export interface IEditorMinimapOptions {
|
||||
* Defaults to false.
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* Control the side of the minimap in editor.
|
||||
* Defaults to 'right'.
|
||||
*/
|
||||
side?: 'right' | 'left';
|
||||
/**
|
||||
* Control the rendering of the minimap slider.
|
||||
* Defaults to 'mouseover'.
|
||||
@@ -256,6 +261,10 @@ export interface IEditorOptions {
|
||||
* Defaults to 'line'.
|
||||
*/
|
||||
cursorStyle?: string;
|
||||
/**
|
||||
* Control the width of the cursor when cursorStyle is set to 'line'
|
||||
*/
|
||||
cursorWidth?: number;
|
||||
/**
|
||||
* Enable font ligatures.
|
||||
* Defaults to false.
|
||||
@@ -448,6 +457,10 @@ export interface IEditorOptions {
|
||||
* Enable word based suggestions. Defaults to 'true'
|
||||
*/
|
||||
wordBasedSuggestions?: boolean;
|
||||
/**
|
||||
* The history mode for suggestions.
|
||||
*/
|
||||
suggestSelection?: string;
|
||||
/**
|
||||
* The font size for the suggest widget.
|
||||
* Defaults to the editor font size.
|
||||
@@ -736,6 +749,7 @@ export interface InternalEditorScrollbarOptions {
|
||||
|
||||
export interface InternalEditorMinimapOptions {
|
||||
readonly enabled: boolean;
|
||||
readonly side: 'right' | 'left';
|
||||
readonly showSlider: 'always' | 'mouseover';
|
||||
readonly renderCharacters: boolean;
|
||||
readonly maxColumn: number;
|
||||
@@ -786,6 +800,7 @@ export interface InternalEditorViewOptions {
|
||||
readonly cursorBlinking: TextEditorCursorBlinkingStyle;
|
||||
readonly mouseWheelZoom: boolean;
|
||||
readonly cursorStyle: TextEditorCursorStyle;
|
||||
readonly cursorWidth: number;
|
||||
readonly hideCursorInOverviewRuler: boolean;
|
||||
readonly scrollBeyondLastLine: boolean;
|
||||
readonly smoothScrolling: boolean;
|
||||
@@ -816,6 +831,7 @@ export interface EditorContribOptions {
|
||||
readonly acceptSuggestionOnCommitCharacter: boolean;
|
||||
readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none';
|
||||
readonly wordBasedSuggestions: boolean;
|
||||
readonly suggestSelection: 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix';
|
||||
readonly suggestFontSize: number;
|
||||
readonly suggestLineHeight: number;
|
||||
readonly selectionHighlight: boolean;
|
||||
@@ -1014,6 +1030,7 @@ export class InternalEditorOptions {
|
||||
&& a.contentWidth === b.contentWidth
|
||||
&& a.contentHeight === b.contentHeight
|
||||
&& a.renderMinimap === b.renderMinimap
|
||||
&& a.minimapLeft === b.minimapLeft
|
||||
&& a.minimapWidth === b.minimapWidth
|
||||
&& a.viewportColumn === b.viewportColumn
|
||||
&& a.verticalScrollbarWidth === b.verticalScrollbarWidth
|
||||
@@ -1054,6 +1071,7 @@ export class InternalEditorOptions {
|
||||
&& a.cursorBlinking === b.cursorBlinking
|
||||
&& a.mouseWheelZoom === b.mouseWheelZoom
|
||||
&& a.cursorStyle === b.cursorStyle
|
||||
&& a.cursorWidth === b.cursorWidth
|
||||
&& a.hideCursorInOverviewRuler === b.hideCursorInOverviewRuler
|
||||
&& a.scrollBeyondLastLine === b.scrollBeyondLastLine
|
||||
&& a.smoothScrolling === b.smoothScrolling
|
||||
@@ -1095,6 +1113,7 @@ export class InternalEditorOptions {
|
||||
private static _equalsMinimapOptions(a: InternalEditorMinimapOptions, b: InternalEditorMinimapOptions): boolean {
|
||||
return (
|
||||
a.enabled === b.enabled
|
||||
&& a.side === b.side
|
||||
&& a.showSlider === b.showSlider
|
||||
&& a.renderCharacters === b.renderCharacters
|
||||
&& a.maxColumn === b.maxColumn
|
||||
@@ -1162,6 +1181,7 @@ export class InternalEditorOptions {
|
||||
&& a.acceptSuggestionOnCommitCharacter === b.acceptSuggestionOnCommitCharacter
|
||||
&& a.snippetSuggestions === b.snippetSuggestions
|
||||
&& a.wordBasedSuggestions === b.wordBasedSuggestions
|
||||
&& a.suggestSelection === b.suggestSelection
|
||||
&& a.suggestFontSize === b.suggestFontSize
|
||||
&& a.suggestLineHeight === b.suggestLineHeight
|
||||
&& a.selectionHighlight === b.selectionHighlight
|
||||
@@ -1282,6 +1302,10 @@ export interface EditorLayoutInfo {
|
||||
*/
|
||||
readonly contentHeight: number;
|
||||
|
||||
/**
|
||||
* The position for the minimap
|
||||
*/
|
||||
readonly minimapLeft: number;
|
||||
/**
|
||||
* The width of the minimap
|
||||
*/
|
||||
@@ -1547,6 +1571,7 @@ export class EditorOptionsValidator {
|
||||
}
|
||||
return {
|
||||
enabled: _boolean(opts.enabled, defaults.enabled),
|
||||
side: _stringSet<'right' | 'left'>(opts.side, defaults.side, ['right', 'left']),
|
||||
showSlider: _stringSet<'always' | 'mouseover'>(opts.showSlider, defaults.showSlider, ['always', 'mouseover']),
|
||||
renderCharacters: _boolean(opts.renderCharacters, defaults.renderCharacters),
|
||||
maxColumn: _clampedInt(opts.maxColumn, defaults.maxColumn, 1, 10000),
|
||||
@@ -1647,6 +1672,7 @@ export class EditorOptionsValidator {
|
||||
cursorBlinking: _cursorBlinkingStyleFromString(opts.cursorBlinking, defaults.cursorBlinking),
|
||||
mouseWheelZoom: _boolean(opts.mouseWheelZoom, defaults.mouseWheelZoom),
|
||||
cursorStyle: _cursorStyleFromString(opts.cursorStyle, defaults.cursorStyle),
|
||||
cursorWidth: _clampedInt(opts.cursorWidth, defaults.cursorWidth, 0, Number.MAX_VALUE),
|
||||
hideCursorInOverviewRuler: _boolean(opts.hideCursorInOverviewRuler, defaults.hideCursorInOverviewRuler),
|
||||
scrollBeyondLastLine: _boolean(opts.scrollBeyondLastLine, defaults.scrollBeyondLastLine),
|
||||
smoothScrolling: _boolean(opts.smoothScrolling, defaults.smoothScrolling),
|
||||
@@ -1686,6 +1712,7 @@ export class EditorOptionsValidator {
|
||||
acceptSuggestionOnCommitCharacter: _boolean(opts.acceptSuggestionOnCommitCharacter, defaults.acceptSuggestionOnCommitCharacter),
|
||||
snippetSuggestions: _stringSet<'top' | 'bottom' | 'inline' | 'none'>(opts.snippetSuggestions, defaults.snippetSuggestions, ['top', 'bottom', 'inline', 'none']),
|
||||
wordBasedSuggestions: _boolean(opts.wordBasedSuggestions, defaults.wordBasedSuggestions),
|
||||
suggestSelection: _stringSet<'first' | 'recentlyUsed' | 'recentlyUsedByPrefix'>(opts.suggestSelection, defaults.suggestSelection, ['first', 'recentlyUsed', 'recentlyUsedByPrefix']),
|
||||
suggestFontSize: _clampedInt(opts.suggestFontSize, defaults.suggestFontSize, 0, 1000),
|
||||
suggestLineHeight: _clampedInt(opts.suggestLineHeight, defaults.suggestLineHeight, 0, 1000),
|
||||
selectionHighlight: _boolean(opts.selectionHighlight, defaults.selectionHighlight),
|
||||
@@ -1749,6 +1776,7 @@ export class InternalEditorOptionsFactory {
|
||||
cursorBlinking: opts.viewInfo.cursorBlinking,
|
||||
mouseWheelZoom: opts.viewInfo.mouseWheelZoom,
|
||||
cursorStyle: opts.viewInfo.cursorStyle,
|
||||
cursorWidth: opts.viewInfo.cursorWidth,
|
||||
hideCursorInOverviewRuler: opts.viewInfo.hideCursorInOverviewRuler,
|
||||
scrollBeyondLastLine: opts.viewInfo.scrollBeyondLastLine,
|
||||
smoothScrolling: opts.viewInfo.smoothScrolling,
|
||||
@@ -1761,6 +1789,7 @@ export class InternalEditorOptionsFactory {
|
||||
scrollbar: opts.viewInfo.scrollbar,
|
||||
minimap: {
|
||||
enabled: (accessibilityIsOn ? false : opts.viewInfo.minimap.enabled), // DISABLED WHEN SCREEN READER IS ATTACHED
|
||||
side: opts.viewInfo.minimap.side,
|
||||
renderCharacters: opts.viewInfo.minimap.renderCharacters,
|
||||
showSlider: opts.viewInfo.minimap.showSlider,
|
||||
maxColumn: opts.viewInfo.minimap.maxColumn
|
||||
@@ -1784,6 +1813,7 @@ export class InternalEditorOptionsFactory {
|
||||
acceptSuggestionOnCommitCharacter: opts.contribInfo.acceptSuggestionOnCommitCharacter,
|
||||
snippetSuggestions: opts.contribInfo.snippetSuggestions,
|
||||
wordBasedSuggestions: opts.contribInfo.wordBasedSuggestions,
|
||||
suggestSelection: opts.contribInfo.suggestSelection,
|
||||
suggestFontSize: opts.contribInfo.suggestFontSize,
|
||||
suggestLineHeight: opts.contribInfo.suggestLineHeight,
|
||||
selectionHighlight: (accessibilityIsOn ? false : opts.contribInfo.selectionHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED
|
||||
@@ -1842,6 +1872,7 @@ export class InternalEditorOptionsFactory {
|
||||
scrollbarArrowSize: opts.viewInfo.scrollbar.arrowSize,
|
||||
verticalScrollbarHasArrows: opts.viewInfo.scrollbar.verticalHasArrows,
|
||||
minimap: opts.viewInfo.minimap.enabled,
|
||||
minimapSide: opts.viewInfo.minimap.side,
|
||||
minimapRenderCharacters: opts.viewInfo.minimap.renderCharacters,
|
||||
minimapMaxColumn: opts.viewInfo.minimap.maxColumn,
|
||||
pixelRatio: env.pixelRatio
|
||||
@@ -1974,6 +2005,7 @@ export interface IEditorLayoutProviderOpts {
|
||||
horizontalScrollbarHeight: number;
|
||||
|
||||
minimap: boolean;
|
||||
minimapSide: string;
|
||||
minimapRenderCharacters: boolean;
|
||||
minimapMaxColumn: number;
|
||||
pixelRatio: number;
|
||||
@@ -1999,6 +2031,7 @@ export class EditorLayoutProvider {
|
||||
const scrollbarArrowSize = _opts.scrollbarArrowSize | 0;
|
||||
const horizontalScrollbarHeight = _opts.horizontalScrollbarHeight | 0;
|
||||
const minimap = _opts.minimap;
|
||||
const minimapSide = _opts.minimapSide;
|
||||
const minimapRenderCharacters = _opts.minimapRenderCharacters;
|
||||
const minimapMaxColumn = _opts.minimapMaxColumn | 0;
|
||||
const pixelRatio = _opts.pixelRatio;
|
||||
@@ -2014,17 +2047,19 @@ export class EditorLayoutProvider {
|
||||
glyphMarginWidth = lineHeight;
|
||||
}
|
||||
|
||||
const glyphMarginLeft = 0;
|
||||
const lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;
|
||||
const decorationsLeft = lineNumbersLeft + lineNumbersWidth;
|
||||
const contentLeft = decorationsLeft + lineDecorationsWidth;
|
||||
let glyphMarginLeft = 0;
|
||||
let lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;
|
||||
let decorationsLeft = lineNumbersLeft + lineNumbersWidth;
|
||||
let contentLeft = decorationsLeft + lineDecorationsWidth;
|
||||
|
||||
const remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;
|
||||
|
||||
let renderMinimap: RenderMinimap;
|
||||
let minimapLeft: number;
|
||||
let minimapWidth: number;
|
||||
let contentWidth: number;
|
||||
if (!minimap) {
|
||||
minimapLeft = 0;
|
||||
minimapWidth = 0;
|
||||
renderMinimap = RenderMinimap.None;
|
||||
contentWidth = remainingWidth;
|
||||
@@ -2056,6 +2091,16 @@ export class EditorLayoutProvider {
|
||||
minimapWidth = Math.floor(minimapMaxColumn * minimapCharWidth);
|
||||
}
|
||||
contentWidth = remainingWidth - minimapWidth;
|
||||
|
||||
if (minimapSide === 'left') {
|
||||
minimapLeft = 0;
|
||||
glyphMarginLeft += minimapWidth;
|
||||
lineNumbersLeft += minimapWidth;
|
||||
decorationsLeft += minimapWidth;
|
||||
contentLeft += minimapWidth;
|
||||
} else {
|
||||
minimapLeft = outerWidth - minimapWidth - verticalScrollbarWidth;
|
||||
}
|
||||
}
|
||||
|
||||
const viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth) / typicalHalfwidthCharacterWidth));
|
||||
@@ -2083,6 +2128,7 @@ export class EditorLayoutProvider {
|
||||
contentHeight: outerHeight,
|
||||
|
||||
renderMinimap: renderMinimap,
|
||||
minimapLeft: minimapLeft,
|
||||
minimapWidth: minimapWidth,
|
||||
|
||||
viewportColumn: viewportColumn,
|
||||
@@ -2172,6 +2218,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
|
||||
cursorBlinking: TextEditorCursorBlinkingStyle.Blink,
|
||||
mouseWheelZoom: false,
|
||||
cursorStyle: TextEditorCursorStyle.Line,
|
||||
cursorWidth: 0,
|
||||
hideCursorInOverviewRuler: false,
|
||||
scrollBeyondLastLine: true,
|
||||
smoothScrolling: false,
|
||||
@@ -2198,6 +2245,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
|
||||
minimap: {
|
||||
// {{SQL CARBON EDIT}}
|
||||
enabled: false,
|
||||
side: 'right',
|
||||
showSlider: 'mouseover',
|
||||
renderCharacters: true,
|
||||
maxColumn: 120
|
||||
@@ -2221,6 +2269,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
|
||||
acceptSuggestionOnCommitCharacter: true,
|
||||
snippetSuggestions: 'inline',
|
||||
wordBasedSuggestions: true,
|
||||
suggestSelection: 'recentlyUsed',
|
||||
suggestFontSize: 0,
|
||||
suggestLineHeight: 0,
|
||||
selectionHighlight: true,
|
||||
@@ -2232,7 +2281,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
|
||||
find: {
|
||||
seedSearchStringFromSelection: true,
|
||||
autoFindInSelection: false,
|
||||
globalFindClipboard: true
|
||||
globalFindClipboard: false
|
||||
},
|
||||
colorDecorators: true,
|
||||
lightbulbEnabled: true
|
||||
|
||||
@@ -14,6 +14,16 @@ import { EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions';
|
||||
*/
|
||||
const GOLDEN_LINE_HEIGHT_RATIO = platform.isMacintosh ? 1.5 : 1.35;
|
||||
|
||||
/**
|
||||
* Font settings maximum and minimum limits
|
||||
*/
|
||||
const MINIMUM_FONT_SIZE = 8;
|
||||
const MAXIMUM_FONT_SIZE = 100;
|
||||
const MINIMUM_LINE_HEIGHT = 8;
|
||||
const MAXIMUM_LINE_HEIGHT = 150;
|
||||
const MINIMUM_LETTER_SPACING = -5;
|
||||
const MAXIMUM_LETTER_SPACING = 20;
|
||||
|
||||
function safeParseFloat(n: number | string, defaultValue: number): number {
|
||||
if (typeof n === 'number') {
|
||||
return n;
|
||||
@@ -70,24 +80,25 @@ export class BareFontInfo {
|
||||
let fontFamily = _string(opts.fontFamily, EDITOR_FONT_DEFAULTS.fontFamily);
|
||||
let fontWeight = _string(opts.fontWeight, EDITOR_FONT_DEFAULTS.fontWeight);
|
||||
|
||||
|
||||
let fontSize = safeParseFloat(opts.fontSize, EDITOR_FONT_DEFAULTS.fontSize);
|
||||
fontSize = clamp(fontSize, 0, 100);
|
||||
fontSize = clamp(fontSize, 0, MAXIMUM_FONT_SIZE);
|
||||
if (fontSize === 0) {
|
||||
fontSize = EDITOR_FONT_DEFAULTS.fontSize;
|
||||
} else if (fontSize < 8) {
|
||||
fontSize = 8;
|
||||
} else if (fontSize < MINIMUM_FONT_SIZE) {
|
||||
fontSize = MINIMUM_FONT_SIZE;
|
||||
}
|
||||
|
||||
let lineHeight = safeParseInt(opts.lineHeight, 0);
|
||||
lineHeight = clamp(lineHeight, 0, 150);
|
||||
lineHeight = clamp(lineHeight, 0, MAXIMUM_LINE_HEIGHT);
|
||||
if (lineHeight === 0) {
|
||||
lineHeight = Math.round(GOLDEN_LINE_HEIGHT_RATIO * fontSize);
|
||||
} else if (lineHeight < 8) {
|
||||
lineHeight = 8;
|
||||
} else if (lineHeight < MINIMUM_LINE_HEIGHT) {
|
||||
lineHeight = MINIMUM_LINE_HEIGHT;
|
||||
}
|
||||
|
||||
let letterSpacing = safeParseFloat(opts.letterSpacing, 0);
|
||||
letterSpacing = clamp(letterSpacing, -20, 20);
|
||||
letterSpacing = clamp(letterSpacing, MINIMUM_LETTER_SPACING, MAXIMUM_LETTER_SPACING);
|
||||
|
||||
let editorZoomLevelMultiplier = 1 + (EditorZoom.getZoomLevel() * 0.1);
|
||||
fontSize *= editorZoomLevelMultiplier;
|
||||
|
||||
Reference in New Issue
Block a user