diff options
author | Aaron Bockover <abock@microsoft.com> | 2019-04-02 23:39:18 +0300 |
---|---|---|
committer | Aaron Bockover <abock@microsoft.com> | 2019-04-02 23:39:18 +0300 |
commit | dcca642652154312f3525ba1cb826597ac0a7fb2 (patch) | |
tree | 5b9c26a3782ab6c0042b1d2e7d0f1a12aded917e /src/Editor/Text/Impl/EditorOperations/EditorOperations.cs | |
parent | ef5646ad0085b99e6e687fada5d3affdd6460d3f (diff) |
Sync with vs-editor-core@ca2b3268
Diffstat (limited to 'src/Editor/Text/Impl/EditorOperations/EditorOperations.cs')
-rw-r--r-- | src/Editor/Text/Impl/EditorOperations/EditorOperations.cs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Editor/Text/Impl/EditorOperations/EditorOperations.cs b/src/Editor/Text/Impl/EditorOperations/EditorOperations.cs index ec55c3b..7c01a8e 100644 --- a/src/Editor/Text/Impl/EditorOperations/EditorOperations.cs +++ b/src/Editor/Text/Impl/EditorOperations/EditorOperations.cs @@ -3228,28 +3228,30 @@ namespace Microsoft.VisualStudio.Text.Operations.Implementation _undoHistory.CurrentTransaction.AddUndo(beforeTextBufferChangeUndoPrimitive); } - public bool CanZoomIn => CanZoomTo && _textView.ZoomLevel < ZoomConstants.MaxZoom; + public bool CanZoomIn => CanZoomTo && _textView.ZoomLevel < _textView.Options.GlobalOptions.MaxZoom(); public void ZoomIn() { if (CanZoomIn) { - double zoomLevel = Math.Min(_textView.ZoomLevel * ZoomConstants.ScalingFactor, ZoomConstants.MaxZoom); - if (zoomLevel < ZoomConstants.MaxZoom || Math.Abs(zoomLevel - ZoomConstants.MaxZoom) < 0.00001) + var maxZoom = _textView.Options.GlobalOptions.MaxZoom(); + double zoomLevel = Math.Min(_textView.ZoomLevel * ZoomConstants.ScalingFactor, maxZoom); + if (zoomLevel < maxZoom || Math.Abs(zoomLevel - maxZoom) < 0.00001) { _textView.Options.GlobalOptions.SetOptionValue(DefaultTextViewOptions.ZoomLevelId, zoomLevel); } } } - public bool CanZoomOut => CanZoomTo && _textView.ZoomLevel > ZoomConstants.MinZoom; + public bool CanZoomOut => CanZoomTo && _textView.ZoomLevel > _textView.Options.GlobalOptions.MinZoom(); public void ZoomOut() { if (CanZoomOut) { - double zoomLevel = Math.Max(_textView.ZoomLevel / ZoomConstants.ScalingFactor, ZoomConstants.MinZoom); - if (zoomLevel > ZoomConstants.MinZoom || Math.Abs(zoomLevel - ZoomConstants.MinZoom) < 0.00001) + var minZoom = _textView.Options.GlobalOptions.MinZoom(); + double zoomLevel = Math.Max(_textView.ZoomLevel / ZoomConstants.ScalingFactor, minZoom); + if (zoomLevel > minZoom || Math.Abs(zoomLevel - minZoom) < 0.00001) { _textView.Options.GlobalOptions.SetOptionValue(DefaultTextViewOptions.ZoomLevelId, zoomLevel); } @@ -3262,7 +3264,7 @@ namespace Microsoft.VisualStudio.Text.Operations.Implementation { if (CanZoomTo) { - _textView.Options.GlobalOptions.SetOptionValue(DefaultTextViewOptions.ZoomLevelId, zoomLevel); + _textView.Options.GlobalOptions.SetZoomLevel(zoomLevel); } } |