Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2c3f7431
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2c3f7431
编写于
3月 03, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify usage of ViewLayer
上级
4e849f2c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
191 addition
and
154 deletion
+191
-154
src/vs/editor/browser/view/viewLayer.ts
src/vs/editor/browser/view/viewLayer.ts
+64
-65
src/vs/editor/browser/view/viewOverlays.ts
src/vs/editor/browser/view/viewOverlays.ts
+42
-19
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
...editor/browser/viewParts/contentWidgets/contentWidgets.ts
+7
-7
src/vs/editor/browser/viewParts/lines/viewLines.ts
src/vs/editor/browser/viewParts/lines/viewLines.ts
+68
-49
src/vs/editor/browser/viewParts/margin/margin.ts
src/vs/editor/browser/viewParts/margin/margin.ts
+1
-1
src/vs/editor/browser/viewParts/minimap/minimap.ts
src/vs/editor/browser/viewParts/minimap/minimap.ts
+1
-1
src/vs/editor/common/view/renderingContext.ts
src/vs/editor/common/view/renderingContext.ts
+8
-7
src/vs/editor/common/viewLayout/viewLayout.ts
src/vs/editor/common/viewLayout/viewLayout.ts
+0
-4
src/vs/editor/common/viewModel/viewModel.ts
src/vs/editor/common/viewModel/viewModel.ts
+0
-1
未找到文件。
src/vs/editor/browser/view/viewLayer.ts
浏览文件 @
2c3f7431
...
...
@@ -4,9 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/fastDomNode
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
ViewportData
}
from
'
vs/editor/common/viewLayout/viewLinesViewportData
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
...
...
@@ -32,28 +30,23 @@ export interface IVisibleLine {
layoutLine
(
lineNumber
:
number
,
deltaTop
:
number
):
void
;
}
interface
IRendererContext
<
T
extends
IVisibleLine
>
{
readonly
domNode
:
HTMLElement
;
rendLineNumberStart
:
number
;
lines
:
T
[];
linesLength
:
number
;
readonly
viewportData
:
ViewportData
;
}
export
interface
ILine
{
onContentChanged
():
void
;
onTokensChanged
():
void
;
}
export
class
RenderedLinesCollection
<
T
extends
ILine
>
{
private
readonly
_createLine
:
()
=>
T
;
private
_lines
:
T
[];
private
_rendLineNumberStart
:
number
;
private
_createLine
:
()
=>
T
;
constructor
(
createLine
:
()
=>
T
)
{
this
.
_lines
=
[];
this
.
_rendLineNumberStart
=
1
;
this
.
_createLine
=
createLine
;
this
.
_set
(
1
,
[]);
}
public
flush
():
void
{
this
.
_set
(
1
,
[]);
}
_set
(
rendLineNumberStart
:
number
,
lines
:
T
[]):
void
{
...
...
@@ -251,27 +244,29 @@ export class RenderedLinesCollection<T extends ILine> {
}
}
export
abstract
class
ViewLayer
<
T
extends
IVisibleLine
>
extends
ViewPart
{
export
interface
IVisibleLinesHost
<
T
extends
IVisibleLine
>
{
createVisibleLine
():
T
;
}
protected
domNode
:
FastDomNode
<
HTMLElement
>
;
protected
_linesCollection
:
RenderedLinesCollection
<
T
>
;
private
_renderer
:
ViewLayerRenderer
<
T
>
;
export
class
VisibleLinesCollection
<
T
extends
IVisibleLine
>
{
constructor
(
context
:
ViewContext
)
{
super
(
context
);
private
readonly
_host
:
IVisibleLinesHost
<
T
>
;
public
readonly
domNode
:
FastDomNode
<
HTMLElement
>
;
private
readonly
_linesCollection
:
RenderedLinesCollection
<
T
>
;
constructor
(
host
:
IVisibleLinesHost
<
T
>
)
{
this
.
_host
=
host
;
this
.
domNode
=
this
.
_createDomNode
();
this
.
_linesCollection
=
new
RenderedLinesCollection
<
T
>
(()
=>
this
.
_createLine
());
this
.
_renderer
=
new
ViewLayerRenderer
<
T
>
(
()
=>
this
.
_createLine
()
);
this
.
_linesCollection
=
new
RenderedLinesCollection
<
T
>
(()
=>
this
.
_host
.
createVisibleLine
());
}
public
dispose
():
void
{
super
.
dispose
();
this
.
_linesCollection
=
null
;
private
_createDomNode
():
FastDomNode
<
HTMLElement
>
{
let
domNode
=
createFastDomNode
(
document
.
createElement
(
'
div
'
));
domNode
.
setClassName
(
'
view-layer
'
);
domNode
.
setPosition
(
'
absolute
'
);
domNode
.
domNode
.
setAttribute
(
'
role
'
,
'
presentation
'
);
domNode
.
domNode
.
setAttribute
(
'
aria-hidden
'
,
'
true
'
);
return
domNode
;
}
// ---- begin view event handlers
...
...
@@ -281,7 +276,7 @@ export abstract class ViewLayer<T extends IVisibleLine> extends ViewPart {
}
public
onFlushed
(
e
:
viewEvents
.
ViewFlushedEvent
):
boolean
{
this
.
_linesCollection
=
new
RenderedLinesCollection
<
T
>
(()
=>
this
.
_createLine
()
);
this
.
_linesCollection
.
flush
(
);
// No need to clear the dom node because a full .innerHTML will occur in ViewLayerRenderer._render
return
true
;
}
...
...
@@ -334,56 +329,61 @@ export abstract class ViewLayer<T extends IVisibleLine> extends ViewPart {
// ---- end view event handlers
public
_renderLines
(
viewportData
:
ViewportData
):
void
{
public
getStartLineNumber
():
number
{
return
this
.
_linesCollection
.
getStartLineNumber
();
}
public
getEndLineNumber
():
number
{
return
this
.
_linesCollection
.
getEndLineNumber
();
}
public
getVisibleLine
(
lineNumber
:
number
):
T
{
return
this
.
_linesCollection
.
getLine
(
lineNumber
);
}
public
renderLines
(
viewportData
:
ViewportData
):
void
{
let
inp
=
this
.
_linesCollection
.
_get
();
let
renderer
=
new
ViewLayerRenderer
<
T
>
(
this
.
domNode
.
domNode
,
this
.
_host
,
viewportData
);
let
ctx
:
IRendererContext
<
T
>
=
{
domNode
:
this
.
domNode
.
domNode
,
rendLineNumberStart
:
inp
.
rendLineNumberStart
,
lines
:
inp
.
lines
,
linesLength
:
inp
.
lines
.
length
,
viewportData
:
viewportData
linesLength
:
inp
.
lines
.
length
};
// Decide if this render will do a single update (single large .innerHTML) or many updates (inserting/removing dom nodes)
let
resCtx
=
this
.
_renderer
.
renderWithManyUpdates
(
ctx
,
viewportData
.
startLineNumber
,
viewportData
.
endLineNumber
,
viewportData
.
relativeVerticalOffset
);
let
resCtx
=
renderer
.
render
(
ctx
,
viewportData
.
startLineNumber
,
viewportData
.
endLineNumber
,
viewportData
.
relativeVerticalOffset
);
this
.
_linesCollection
.
_set
(
resCtx
.
rendLineNumberStart
,
resCtx
.
lines
);
}
}
private
_createDomNode
():
FastDomNode
<
HTMLElement
>
{
let
domNode
=
createFastDomNode
(
document
.
createElement
(
'
div
'
));
domNode
.
setClassName
(
'
view-layer
'
);
domNode
.
setPosition
(
'
absolute
'
);
domNode
.
domNode
.
setAttribute
(
'
role
'
,
'
presentation
'
);
domNode
.
domNode
.
setAttribute
(
'
aria-hidden
'
,
'
true
'
);
return
domNode
;
}
protected
abstract
_createLine
():
T
;
interface
IRendererContext
<
T
extends
IVisibleLine
>
{
rendLineNumberStart
:
number
;
lines
:
T
[];
linesLength
:
number
;
}
class
ViewLayerRenderer
<
T
extends
IVisibleLine
>
{
private
_createLine
:
()
=>
T
;
constructor
(
createLine
:
()
=>
T
)
{
this
.
_createLine
=
createLine
;
}
readonly
domNode
:
HTMLElement
;
readonly
host
:
IVisibleLinesHost
<
T
>
;
readonly
viewportData
:
ViewportData
;
public
renderWithManyUpdates
(
ctx
:
IRendererContext
<
T
>
,
startLineNumber
:
number
,
stopLineNumber
:
number
,
deltaTop
:
number
[]):
IRendererContext
<
T
>
{
return
this
.
_render
(
ctx
,
startLineNumber
,
stopLineNumber
,
deltaTop
);
constructor
(
domNode
:
HTMLElement
,
host
:
IVisibleLinesHost
<
T
>
,
viewportData
:
ViewportData
)
{
this
.
domNode
=
domNode
;
this
.
host
=
host
;
this
.
viewportData
=
viewportData
;
}
p
rivate
_
render
(
inContext
:
IRendererContext
<
T
>
,
startLineNumber
:
number
,
stopLineNumber
:
number
,
deltaTop
:
number
[]):
IRendererContext
<
T
>
{
p
ublic
render
(
inContext
:
IRendererContext
<
T
>
,
startLineNumber
:
number
,
stopLineNumber
:
number
,
deltaTop
:
number
[]):
IRendererContext
<
T
>
{
let
ctx
:
IRendererContext
<
T
>
=
{
domNode
:
inContext
.
domNode
,
rendLineNumberStart
:
inContext
.
rendLineNumberStart
,
lines
:
inContext
.
lines
.
slice
(
0
),
linesLength
:
inContext
.
linesLength
,
viewportData
:
inContext
.
viewportData
,
linesLength
:
inContext
.
linesLength
};
if
((
ctx
.
rendLineNumberStart
+
ctx
.
linesLength
-
1
<
startLineNumber
)
||
(
stopLineNumber
<
ctx
.
rendLineNumberStart
))
{
...
...
@@ -392,7 +392,7 @@ class ViewLayerRenderer<T extends IVisibleLine> {
ctx
.
linesLength
=
stopLineNumber
-
startLineNumber
+
1
;
ctx
.
lines
=
[];
for
(
let
x
=
startLineNumber
;
x
<=
stopLineNumber
;
x
++
)
{
ctx
.
lines
[
x
-
startLineNumber
]
=
this
.
_creat
eLine
();
ctx
.
lines
[
x
-
startLineNumber
]
=
this
.
host
.
createVisibl
eLine
();
}
this
.
_finishRendering
(
ctx
,
true
,
deltaTop
);
return
ctx
;
...
...
@@ -467,7 +467,7 @@ class ViewLayerRenderer<T extends IVisibleLine> {
let
newLines
:
T
[]
=
[];
let
newLinesLen
=
0
;
for
(
let
lineNumber
=
fromLineNumber
;
lineNumber
<=
toLineNumber
;
lineNumber
++
)
{
newLines
[
newLinesLen
++
]
=
this
.
_creat
eLine
();
newLines
[
newLinesLen
++
]
=
this
.
host
.
createVisibl
eLine
();
}
ctx
.
lines
=
newLines
.
concat
(
ctx
.
lines
);
}
...
...
@@ -476,7 +476,7 @@ class ViewLayerRenderer<T extends IVisibleLine> {
for
(
let
i
=
0
;
i
<
removeCount
;
i
++
)
{
let
lineDomNode
=
ctx
.
lines
[
i
].
getDomNode
();
if
(
lineDomNode
)
{
ctx
.
domNode
.
removeChild
(
lineDomNode
);
this
.
domNode
.
removeChild
(
lineDomNode
);
}
}
ctx
.
lines
.
splice
(
0
,
removeCount
);
...
...
@@ -486,7 +486,7 @@ class ViewLayerRenderer<T extends IVisibleLine> {
let
newLines
:
T
[]
=
[];
let
newLinesLen
=
0
;
for
(
let
lineNumber
=
fromLineNumber
;
lineNumber
<=
toLineNumber
;
lineNumber
++
)
{
newLines
[
newLinesLen
++
]
=
this
.
_creat
eLine
();
newLines
[
newLinesLen
++
]
=
this
.
host
.
createVisibl
eLine
();
}
ctx
.
lines
=
ctx
.
lines
.
concat
(
newLines
);
}
...
...
@@ -497,21 +497,21 @@ class ViewLayerRenderer<T extends IVisibleLine> {
for
(
let
i
=
0
;
i
<
removeCount
;
i
++
)
{
let
lineDomNode
=
ctx
.
lines
[
removeIndex
+
i
].
getDomNode
();
if
(
lineDomNode
)
{
ctx
.
domNode
.
removeChild
(
lineDomNode
);
this
.
domNode
.
removeChild
(
lineDomNode
);
}
}
ctx
.
lines
.
splice
(
removeIndex
,
removeCount
);
}
private
_finishRenderingNewLines
(
ctx
:
IRendererContext
<
T
>
,
domNodeIsEmpty
:
boolean
,
newLinesHTML
:
string
[],
wasNew
:
boolean
[]):
void
{
let
lastChild
=
<
HTMLElement
>
ctx
.
domNode
.
lastChild
;
let
lastChild
=
<
HTMLElement
>
this
.
domNode
.
lastChild
;
if
(
domNodeIsEmpty
||
!
lastChild
)
{
ctx
.
domNode
.
innerHTML
=
newLinesHTML
.
join
(
''
);
this
.
domNode
.
innerHTML
=
newLinesHTML
.
join
(
''
);
}
else
{
lastChild
.
insertAdjacentHTML
(
'
afterend
'
,
newLinesHTML
.
join
(
''
));
}
let
currChild
=
<
HTMLElement
>
ctx
.
domNode
.
lastChild
;
let
currChild
=
<
HTMLElement
>
this
.
domNode
.
lastChild
;
for
(
let
i
=
ctx
.
linesLength
-
1
;
i
>=
0
;
i
--
)
{
let
line
=
ctx
.
lines
[
i
];
if
(
wasNew
[
i
])
{
...
...
@@ -553,7 +553,7 @@ class ViewLayerRenderer<T extends IVisibleLine> {
wasNew
[
i
]
=
false
;
wasInvalid
[
i
]
=
false
;
let
renderResult
=
line
.
renderLine
(
lineNumber
,
deltaTop
[
i
],
ctx
.
viewportData
);
let
renderResult
=
line
.
renderLine
(
lineNumber
,
deltaTop
[
i
],
this
.
viewportData
);
if
(
renderResult
!==
null
)
{
// Line needs rendering
...
...
@@ -581,4 +581,3 @@ class ViewLayerRenderer<T extends IVisibleLine> {
}
}
}
src/vs/editor/browser/view/viewOverlays.ts
浏览文件 @
2c3f7431
...
...
@@ -7,22 +7,28 @@
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/fastDomNode
'
;
import
{
IConfiguration
}
from
'
vs/editor/common/editorCommon
'
;
import
*
as
editorBrowser
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IVisibleLine
,
Vi
ewLayer
}
from
'
vs/editor/browser/view/viewLayer
'
;
import
{
IVisibleLine
,
Vi
sibleLinesCollection
,
IVisibleLinesHost
}
from
'
vs/editor/browser/view/viewLayer
'
;
import
{
DynamicViewOverlay
}
from
'
vs/editor/browser/view/dynamicViewOverlay
'
;
import
{
Configuration
}
from
'
vs/editor/browser/config/configuration
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
RenderingContext
,
RestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
ViewportData
}
from
'
vs/editor/common/viewLayout/viewLinesViewportData
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
export
class
ViewOverlays
extends
View
Layer
<
ViewOverlayLine
>
{
export
class
ViewOverlays
extends
View
Part
implements
IVisibleLinesHost
<
ViewOverlayLine
>
{
private
readonly
_visibleLines
:
VisibleLinesCollection
<
ViewOverlayLine
>
;
protected
readonly
domNode
:
FastDomNode
<
HTMLElement
>
;
private
_dynamicOverlays
:
DynamicViewOverlay
[];
private
_isFocused
:
boolean
;
constructor
(
context
:
ViewContext
)
{
super
(
context
);
this
.
_visibleLines
=
new
VisibleLinesCollection
<
ViewOverlayLine
>
(
this
);
this
.
domNode
=
this
.
_visibleLines
.
domNode
;
this
.
_dynamicOverlays
=
[];
this
.
_isFocused
=
false
;
...
...
@@ -58,6 +64,14 @@ export class ViewOverlays extends ViewLayer<ViewOverlayLine> {
return
this
.
domNode
.
domNode
;
}
// ---- begin IVisibleLinesHost
public
createVisibleLine
():
ViewOverlayLine
{
return
new
ViewOverlayLine
(
this
.
_context
.
configuration
,
this
.
_dynamicOverlays
);
}
// ---- end IVisibleLinesHost
public
addDynamicOverlay
(
overlay
:
DynamicViewOverlay
):
void
{
this
.
_dynamicOverlays
.
push
(
overlay
);
}
...
...
@@ -65,27 +79,42 @@ export class ViewOverlays extends ViewLayer<ViewOverlayLine> {
// ----- event handlers
public
onConfigurationChanged
(
e
:
viewEvents
.
ViewConfigurationChangedEvent
):
boolean
{
super
.
onConfigurationChanged
(
e
);
let
startLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
endLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
this
.
_visibleLines
.
onConfigurationChanged
(
e
);
let
startLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
endLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
for
(
let
lineNumber
=
startLineNumber
;
lineNumber
<=
endLineNumber
;
lineNumber
++
)
{
let
line
=
this
.
_
linesCollection
.
get
Line
(
lineNumber
);
let
line
=
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
);
line
.
onConfigurationChanged
(
e
);
}
return
true
;
}
public
onFlushed
(
e
:
viewEvents
.
ViewFlushedEvent
):
boolean
{
return
this
.
_visibleLines
.
onFlushed
(
e
);
}
public
onFocusChanged
(
e
:
viewEvents
.
ViewFocusChangedEvent
):
boolean
{
this
.
_isFocused
=
e
.
isFocused
;
return
true
;
}
// ----- end event handlers
_createLine
():
ViewOverlayLine
{
return
new
ViewOverlayLine
(
this
.
_context
.
configuration
,
this
.
_dynamicOverlays
);
public
onLinesChanged
(
e
:
viewEvents
.
ViewLinesChangedEvent
):
boolean
{
return
this
.
_visibleLines
.
onLinesChanged
(
e
);
}
public
onLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
this
.
_visibleLines
.
onLinesDeleted
(
e
);
}
public
onLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
this
.
_visibleLines
.
onLinesInserted
(
e
);
}
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChangedEvent
):
boolean
{
return
this
.
_visibleLines
.
onScrollChanged
(
e
)
||
true
;
}
public
onTokensChanged
(
e
:
viewEvents
.
ViewTokensChangedEvent
):
boolean
{
return
this
.
_visibleLines
.
onTokensChanged
(
e
);
}
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
this
.
_visibleLines
.
onZonesChanged
(
e
);
}
// ----- end event handlers
public
prepareRender
(
ctx
:
RenderingContext
):
void
{
let
toRender
=
this
.
_dynamicOverlays
.
filter
(
overlay
=>
overlay
.
shouldRender
());
...
...
@@ -107,7 +136,7 @@ export class ViewOverlays extends ViewLayer<ViewOverlayLine> {
}
_viewOverlaysRender
(
ctx
:
RestrictedRenderingContext
):
void
{
super
.
_
renderLines
(
ctx
.
viewportData
);
this
.
_visibleLines
.
renderLines
(
ctx
.
viewportData
);
}
}
...
...
@@ -211,13 +240,11 @@ export class ContentViewOverlays extends ViewOverlays {
export
class
MarginViewOverlays
extends
ViewOverlays
{
private
_contentLeft
:
number
;
private
_canUseTranslate3d
:
boolean
;
constructor
(
context
:
ViewContext
)
{
super
(
context
);
this
.
_contentLeft
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
contentLeft
;
this
.
_canUseTranslate3d
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
canUseTranslate3d
;
this
.
domNode
.
setClassName
(
editorBrowser
.
ClassNames
.
MARGIN_VIEW_OVERLAYS
);
this
.
domNode
.
setWidth
(
1
);
...
...
@@ -231,10 +258,6 @@ export class MarginViewOverlays extends ViewOverlays {
Configuration
.
applyFontInfo
(
this
.
domNode
,
this
.
_context
.
configuration
.
editor
.
fontInfo
);
shouldRender
=
true
;
}
if
(
e
.
viewInfo
.
canUseTranslate3d
)
{
this
.
_canUseTranslate3d
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
canUseTranslate3d
;
shouldRender
=
true
;
}
if
(
e
.
layoutInfo
)
{
this
.
_contentLeft
=
this
.
_context
.
configuration
.
editor
.
layoutInfo
.
contentLeft
;
shouldRender
=
true
;
...
...
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
浏览文件 @
2c3f7431
...
...
@@ -233,11 +233,11 @@ export class ViewContentWidgets extends ViewPart {
// And its left
let
actualLeft
=
topLeft
.
left
;
if
(
actualLeft
+
width
>
ctx
.
viewport
Left
+
ctx
.
viewportWidth
)
{
actualLeft
=
ctx
.
viewport
Left
+
ctx
.
viewportWidth
-
width
;
if
(
actualLeft
+
width
>
ctx
.
scroll
Left
+
ctx
.
viewportWidth
)
{
actualLeft
=
ctx
.
scroll
Left
+
ctx
.
viewportWidth
-
width
;
}
if
(
actualLeft
<
ctx
.
viewport
Left
)
{
actualLeft
=
ctx
.
viewport
Left
;
if
(
actualLeft
<
ctx
.
scroll
Left
)
{
actualLeft
=
ctx
.
scroll
Left
;
}
return
{
...
...
@@ -250,7 +250,7 @@ export class ViewContentWidgets extends ViewPart {
}
private
_layoutBoxInPage
(
topLeft
:
Coordinate
,
width
:
number
,
height
:
number
,
ctx
:
RenderingContext
):
IBoxLayoutResult
{
let
left0
=
topLeft
.
left
-
ctx
.
viewport
Left
;
let
left0
=
topLeft
.
left
-
ctx
.
scroll
Left
;
if
(
left0
+
width
<
0
||
left0
>
this
.
_contentWidth
)
{
return
null
;
...
...
@@ -314,7 +314,7 @@ export class ViewContentWidgets extends ViewPart {
return
null
;
}
const
top
=
ctx
.
getVerticalOffsetForLineNumber
(
position
.
lineNumber
)
-
ctx
.
viewport
Top
;
const
top
=
ctx
.
getVerticalOffsetForLineNumber
(
position
.
lineNumber
)
-
ctx
.
scroll
Top
;
return
new
Coordinate
(
top
,
visibleRange
.
left
);
}
...
...
@@ -429,7 +429,7 @@ export class ViewContentWidgets extends ViewPart {
domNode
.
setTop
(
data
[
widgetId
].
top
);
domNode
.
setLeft
(
data
[
widgetId
].
left
);
}
else
{
domNode
.
setTop
(
data
[
widgetId
].
top
+
ctx
.
viewport
Top
-
ctx
.
bigNumbersDelta
);
domNode
.
setTop
(
data
[
widgetId
].
top
+
ctx
.
scroll
Top
-
ctx
.
bigNumbersDelta
);
domNode
.
setLeft
(
data
[
widgetId
].
left
);
}
if
(
!
widget
.
isVisible
)
{
...
...
src/vs/editor/browser/viewParts/lines/viewLines.ts
浏览文件 @
2c3f7431
...
...
@@ -11,14 +11,14 @@ import { Range } from 'vs/editor/common/core/range';
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ClassNames
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
Vi
ewLayer
}
from
'
vs/editor/browser/view/viewLayer
'
;
import
{
Vi
sibleLinesCollection
,
IVisibleLinesHost
}
from
'
vs/editor/browser/view/viewLayer
'
;
import
{
ViewLineOptions
,
DomReadingContext
,
ViewLine
}
from
'
vs/editor/browser/viewParts/lines/viewLine
'
;
import
{
Configuration
}
from
'
vs/editor/browser/config/configuration
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
ViewportData
}
from
'
vs/editor/common/viewLayout/viewLinesViewportData
'
;
import
{
IViewLines
,
HorizontalRange
,
LineVisibleRanges
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
IViewLayout
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
PartFingerprint
,
PartFingerprints
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
ViewPart
,
PartFingerprint
,
PartFingerprints
}
from
'
vs/editor/browser/view/viewPart
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
class
LastRenderedData
{
...
...
@@ -38,7 +38,7 @@ class LastRenderedData {
}
}
export
class
ViewLines
extends
View
Layer
<
ViewLine
>
implements
IViewLines
{
export
class
ViewLines
extends
View
Part
implements
IVisibleLinesHost
<
ViewLine
>
,
IViewLines
{
/**
* Width to extends a line to render the line feed at the end of the line
*/
...
...
@@ -48,9 +48,11 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
*/
private
static
HORIZONTAL_EXTRA_PX
=
30
;
private
_linesContent
:
FastDomNode
<
HTMLElement
>
;
private
_viewLayout
:
IViewLayout
;
private
_textRangeRestingSpot
:
HTMLElement
;
private
readonly
_linesContent
:
FastDomNode
<
HTMLElement
>
;
private
readonly
_viewLayout
:
IViewLayout
;
private
readonly
_textRangeRestingSpot
:
HTMLElement
;
private
readonly
_visibleLines
:
VisibleLinesCollection
<
ViewLine
>
;
private
readonly
domNode
:
FastDomNode
<
HTMLElement
>
;
// --- config
private
_lineHeight
:
number
;
...
...
@@ -69,12 +71,16 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
constructor
(
context
:
ViewContext
,
linesContent
:
FastDomNode
<
HTMLElement
>
,
viewLayout
:
IViewLayout
)
{
super
(
context
);
this
.
_linesContent
=
linesContent
;
this
.
_viewLayout
=
viewLayout
;
this
.
_textRangeRestingSpot
=
document
.
createElement
(
'
div
'
);
this
.
_visibleLines
=
new
VisibleLinesCollection
(
this
);
this
.
domNode
=
this
.
_visibleLines
.
domNode
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_isViewportWrapping
=
this
.
_context
.
configuration
.
editor
.
wrappingInfo
.
isViewportWrapping
;
this
.
_revealHorizontalRightPadding
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
revealHorizontalRightPadding
;
this
.
_canUseTranslate3d
=
this
.
_context
.
configuration
.
editor
.
viewInfo
.
canUseTranslate3d
;
this
.
_viewLineOptions
=
new
ViewLineOptions
(
this
.
_context
.
configuration
);
this
.
_viewLayout
=
viewLayout
;
PartFingerprints
.
write
(
this
.
domNode
.
domNode
,
PartFingerprint
.
ViewLines
);
this
.
domNode
.
setClassName
(
ClassNames
.
VIEW_LINES
);
...
...
@@ -89,13 +95,10 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
this
.
_lastRenderedData
=
new
LastRenderedData
();
this
.
_lastCursorRevealRangeHorizontallyEvent
=
null
;
this
.
_textRangeRestingSpot
=
document
.
createElement
(
'
div
'
);
this
.
_textRangeRestingSpot
.
className
=
'
textRangeRestingSpot
'
;
}
public
dispose
():
void
{
this
.
_asyncUpdateLineWidths
.
dispose
();
this
.
_viewLayout
=
null
;
super
.
dispose
();
}
...
...
@@ -103,10 +106,18 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
return
this
.
domNode
.
domNode
;
}
// ---- begin IVisibleLinesHost
public
createVisibleLine
():
ViewLine
{
return
new
ViewLine
(
this
.
_viewLineOptions
);
}
// ---- end IVisibleLinesHost
// ---- begin view event handlers
public
onConfigurationChanged
(
e
:
viewEvents
.
ViewConfigurationChangedEvent
):
boolean
{
super
.
onConfigurationChanged
(
e
);
this
.
_visibleLines
.
onConfigurationChanged
(
e
);
if
(
e
.
wrappingInfo
)
{
this
.
_maxLineWidth
=
0
;
}
...
...
@@ -131,10 +142,10 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
if
(
!
this
.
_viewLineOptions
.
equals
(
newViewLineOptions
))
{
this
.
_viewLineOptions
=
newViewLineOptions
;
let
startLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
endLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
let
startLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
endLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
for
(
let
lineNumber
=
startLineNumber
;
lineNumber
<=
endLineNumber
;
lineNumber
++
)
{
let
line
=
this
.
_
linesCollection
.
get
Line
(
lineNumber
);
let
line
=
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
);
line
.
onOptionsChanged
(
this
.
_viewLineOptions
);
}
}
...
...
@@ -146,21 +157,29 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
return
true
;
}
public
onDecorationsChanged
(
e
:
viewEvents
.
ViewDecorationsChangedEvent
):
boolean
{
let
shouldRender
=
super
.
onDecorationsChanged
(
e
);
if
(
true
/*e.inlineDecorationsChanged*/
)
{
let
rendStartLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
let
rendStartLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
for
(
let
lineNumber
=
rendStartLineNumber
;
lineNumber
<=
rendEndLineNumber
;
lineNumber
++
)
{
this
.
_
linesCollection
.
get
Line
(
lineNumber
).
onDecorationsChanged
();
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
).
onDecorationsChanged
();
}
}
return
shouldRender
||
true
;
return
true
;
}
public
onFlushed
(
e
:
viewEvents
.
ViewFlushedEvent
):
boolean
{
let
shouldRender
=
super
.
onFlushed
(
e
);
let
shouldRender
=
this
.
_visibleLines
.
onFlushed
(
e
);
this
.
_maxLineWidth
=
0
;
return
shouldRender
;
}
public
onLinesChanged
(
e
:
viewEvents
.
ViewLinesChangedEvent
):
boolean
{
return
this
.
_visibleLines
.
onLinesChanged
(
e
);
}
public
onLinesDeleted
(
e
:
viewEvents
.
ViewLinesDeletedEvent
):
boolean
{
return
this
.
_visibleLines
.
onLinesDeleted
(
e
);
}
public
onLinesInserted
(
e
:
viewEvents
.
ViewLinesInsertedEvent
):
boolean
{
return
this
.
_visibleLines
.
onLinesInserted
(
e
);
}
public
onRevealRangeRequest
(
e
:
viewEvents
.
ViewRevealRangeRequestEvent
):
boolean
{
let
newScrollTop
=
this
.
_computeScrollTopToRevealRange
(
this
.
_viewLayout
.
getCurrentViewport
(),
e
.
range
,
e
.
verticalType
);
...
...
@@ -176,7 +195,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
}
public
onScrollChanged
(
e
:
viewEvents
.
ViewScrollChangedEvent
):
boolean
{
this
.
domNode
.
setWidth
(
e
.
scrollWidth
);
return
super
.
onScrollChanged
(
e
)
||
true
;
return
this
.
_visibleLines
.
onScrollChanged
(
e
)
||
true
;
}
public
onScrollRequest
(
e
:
viewEvents
.
ViewScrollRequestEvent
):
boolean
{
let
currentScrollTop
=
this
.
_viewLayout
.
getScrollTop
();
...
...
@@ -186,6 +205,12 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
});
return
true
;
}
public
onTokensChanged
(
e
:
viewEvents
.
ViewTokensChangedEvent
):
boolean
{
return
this
.
_visibleLines
.
onTokensChanged
(
e
);
}
public
onZonesChanged
(
e
:
viewEvents
.
ViewZonesChangedEvent
):
boolean
{
return
this
.
_visibleLines
.
onZonesChanged
(
e
);
}
// ---- end view event handlers
...
...
@@ -214,14 +239,14 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
return
new
Position
(
lineNumber
,
1
);
}
let
rendStartLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
let
rendStartLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
if
(
lineNumber
<
rendStartLineNumber
||
lineNumber
>
rendEndLineNumber
)
{
// Couldn't find line
return
null
;
}
let
column
=
this
.
_
linesCollection
.
get
Line
(
lineNumber
).
getColumnOfNodeOffset
(
lineNumber
,
spanNode
,
offset
);
let
column
=
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
).
getColumnOfNodeOffset
(
lineNumber
,
spanNode
,
offset
);
let
minColumn
=
this
.
_context
.
model
.
getLineMinColumn
(
lineNumber
);
if
(
column
<
minColumn
)
{
column
=
minColumn
;
...
...
@@ -243,28 +268,26 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
* @returns the line number of this view line dom node.
*/
private
_getLineNumberFor
(
domNode
:
HTMLElement
):
number
{
const
inp
=
this
.
_linesCollection
.
_get
();
const
rendLineNumberStart
=
inp
.
rendLineNumberStart
;
const
lines
=
inp
.
lines
;
for
(
let
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
let
lineDomNode
=
lines
[
i
].
getDomNode
();
if
(
domNode
===
lineDomNode
)
{
return
rendLineNumberStart
+
i
;
let
startLineNumber
=
this
.
_visibleLines
.
getStartLineNumber
();
let
endLineNumber
=
this
.
_visibleLines
.
getEndLineNumber
();
for
(
let
lineNumber
=
startLineNumber
;
lineNumber
<=
endLineNumber
;
lineNumber
++
)
{
let
line
=
this
.
_visibleLines
.
getVisibleLine
(
lineNumber
);
if
(
domNode
===
line
.
getDomNode
())
{
return
lineNumber
;
}
}
return
-
1
;
}
public
getLineWidth
(
lineNumber
:
number
):
number
{
let
rendStartLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
let
rendStartLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
if
(
lineNumber
<
rendStartLineNumber
||
lineNumber
>
rendEndLineNumber
)
{
// Couldn't find line
return
-
1
;
}
return
this
.
_
linesCollection
.
get
Line
(
lineNumber
).
getWidth
();
return
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
).
getWidth
();
}
public
linesVisibleRangesForRange
(
range
:
Range
,
includeNewLines
:
boolean
):
LineVisibleRanges
[]
{
...
...
@@ -288,8 +311,8 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
nextLineModelLineNumber
=
this
.
_context
.
model
.
coordinatesConverter
.
convertViewPositionToModelPosition
(
new
Position
(
range
.
startLineNumber
,
1
)).
lineNumber
;
}
let
rendStartLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
let
rendStartLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
for
(
let
lineNumber
=
range
.
startLineNumber
;
lineNumber
<=
range
.
endLineNumber
;
lineNumber
++
)
{
if
(
lineNumber
<
rendStartLineNumber
||
lineNumber
>
rendEndLineNumber
)
{
...
...
@@ -298,7 +321,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
let
startColumn
=
lineNumber
===
range
.
startLineNumber
?
range
.
startColumn
:
1
;
let
endColumn
=
lineNumber
===
range
.
endLineNumber
?
range
.
endColumn
:
this
.
_context
.
model
.
getLineMaxColumn
(
lineNumber
);
let
visibleRangesForLine
=
this
.
_
linesCollection
.
get
Line
(
lineNumber
).
getVisibleRangesForRange
(
startColumn
,
endColumn
,
domReadingContext
);
let
visibleRangesForLine
=
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
).
getVisibleRangesForRange
(
startColumn
,
endColumn
,
domReadingContext
);
if
(
!
visibleRangesForLine
||
visibleRangesForLine
.
length
===
0
)
{
continue
;
...
...
@@ -339,8 +362,8 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
let
result
:
HorizontalRange
[]
=
[];
let
domReadingContext
=
new
DomReadingContext
(
this
.
domNode
.
domNode
,
this
.
_textRangeRestingSpot
);
let
rendStartLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
let
rendStartLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
for
(
let
lineNumber
=
range
.
startLineNumber
;
lineNumber
<=
range
.
endLineNumber
;
lineNumber
++
)
{
if
(
lineNumber
<
rendStartLineNumber
||
lineNumber
>
rendEndLineNumber
)
{
...
...
@@ -349,7 +372,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
let
startColumn
=
lineNumber
===
range
.
startLineNumber
?
range
.
startColumn
:
1
;
let
endColumn
=
lineNumber
===
range
.
endLineNumber
?
range
.
endColumn
:
this
.
_context
.
model
.
getLineMaxColumn
(
lineNumber
);
let
visibleRangesForLine
=
this
.
_
linesCollection
.
get
Line
(
lineNumber
).
getVisibleRangesForRange
(
startColumn
,
endColumn
,
domReadingContext
);
let
visibleRangesForLine
=
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
).
getVisibleRangesForRange
(
startColumn
,
endColumn
,
domReadingContext
);
if
(
!
visibleRangesForLine
||
visibleRangesForLine
.
length
===
0
)
{
continue
;
...
...
@@ -367,17 +390,13 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
// --- implementation
protected
_createLine
():
ViewLine
{
return
new
ViewLine
(
this
.
_viewLineOptions
);
}
private
_updateLineWidths
():
void
{
let
rendStartLineNumber
=
this
.
_
linesCollection
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
linesCollection
.
getEndLineNumber
();
let
rendStartLineNumber
=
this
.
_
visibleLines
.
getStartLineNumber
();
let
rendEndLineNumber
=
this
.
_
visibleLines
.
getEndLineNumber
();
let
localMaxLineWidth
=
1
;
for
(
let
lineNumber
=
rendStartLineNumber
;
lineNumber
<=
rendEndLineNumber
;
lineNumber
++
)
{
let
widthInPx
=
this
.
_
linesCollection
.
get
Line
(
lineNumber
).
getWidth
();
let
widthInPx
=
this
.
_
visibleLines
.
getVisible
Line
(
lineNumber
).
getWidth
();
localMaxLineWidth
=
Math
.
max
(
localMaxLineWidth
,
widthInPx
);
}
...
...
@@ -399,7 +418,7 @@ export class ViewLines extends ViewLayer<ViewLine> implements IViewLines {
public
renderText
(
viewportData
:
ViewportData
,
onAfterLinesRendered
:
()
=>
void
):
void
{
// (1) render lines - ensures lines are in the DOM
super
.
_
renderLines
(
viewportData
);
this
.
_visibleLines
.
renderLines
(
viewportData
);
this
.
_lastRenderedData
.
setCurrentVisibleRange
(
viewportData
.
visibleRange
);
this
.
domNode
.
setWidth
(
this
.
_viewLayout
.
getScrollWidth
());
this
.
domNode
.
setHeight
(
Math
.
min
(
this
.
_viewLayout
.
getScrollHeight
(),
1000000
));
...
...
src/vs/editor/browser/viewParts/margin/margin.ts
浏览文件 @
2c3f7431
...
...
@@ -78,7 +78,7 @@ export class Margin extends ViewPart {
}
public
render
(
ctx
:
RestrictedRenderingContext
):
void
{
const
adjustedScrollTop
=
ctx
.
viewport
Top
-
ctx
.
bigNumbersDelta
;
const
adjustedScrollTop
=
ctx
.
scroll
Top
-
ctx
.
bigNumbersDelta
;
if
(
this
.
_canUseTranslate3d
)
{
let
transform
=
'
translate3d(0px,
'
+
-
adjustedScrollTop
+
'
px, 0px)
'
;
this
.
_domNode
.
setTransform
(
transform
);
...
...
src/vs/editor/browser/viewParts/minimap/minimap.ts
浏览文件 @
2c3f7431
...
...
@@ -645,7 +645,7 @@ export class Minimap extends ViewPart {
this
.
_shadow
.
setClassName
(
'
minimap-shadow-hidden
'
);
return
;
}
if
(
renderingCtx
.
viewport
Left
+
renderingCtx
.
viewportWidth
>=
renderingCtx
.
scrollWidth
)
{
if
(
renderingCtx
.
scroll
Left
+
renderingCtx
.
viewportWidth
>=
renderingCtx
.
scrollWidth
)
{
this
.
_shadow
.
setClassName
(
'
minimap-shadow-hidden
'
);
}
else
{
this
.
_shadow
.
setClassName
(
'
minimap-shadow-visible
'
);
...
...
src/vs/editor/common/view/renderingContext.ts
浏览文件 @
2c3f7431
...
...
@@ -25,10 +25,11 @@ export abstract class RestrictedRenderingContext {
public
readonly
visibleRange
:
Range
;
public
readonly
bigNumbersDelta
:
number
;
public
readonly
viewportTop
:
number
;
public
readonly
scrollTop
:
number
;
public
readonly
scrollLeft
:
number
;
public
readonly
viewportWidth
:
number
;
public
readonly
viewportHeight
:
number
;
public
readonly
viewportLeft
:
number
;
private
readonly
_viewLayout
:
IViewLayout
;
...
...
@@ -43,14 +44,14 @@ export abstract class RestrictedRenderingContext {
this
.
bigNumbersDelta
=
this
.
viewportData
.
bigNumbersDelta
;
const
vInfo
=
this
.
_viewLayout
.
getCurrentViewport
();
this
.
scrollTop
=
vInfo
.
top
;
this
.
scrollLeft
=
vInfo
.
left
;
this
.
viewportWidth
=
vInfo
.
width
;
this
.
viewportHeight
=
vInfo
.
height
;
this
.
viewportLeft
=
vInfo
.
left
;
this
.
viewportTop
=
vInfo
.
top
;
}
public
getScrolledTopFromAbsoluteTop
(
absoluteTop
:
number
):
number
{
return
this
.
_viewLayout
.
getScrolledTopFromAbsoluteTop
(
absoluteTop
)
;
return
absoluteTop
-
this
.
scrollTop
;
}
public
getVerticalOffsetForLineNumber
(
lineNumber
:
number
):
number
{
...
...
@@ -59,8 +60,8 @@ export abstract class RestrictedRenderingContext {
public
lineIsVisible
(
lineNumber
:
number
):
boolean
{
return
(
this
.
vi
ewportData
.
vi
sibleRange
.
startLineNumber
<=
lineNumber
&&
lineNumber
<=
this
.
vi
ewportData
.
vi
sibleRange
.
endLineNumber
this
.
visibleRange
.
startLineNumber
<=
lineNumber
&&
lineNumber
<=
this
.
visibleRange
.
endLineNumber
);
}
...
...
src/vs/editor/common/viewLayout/viewLayout.ts
浏览文件 @
2c3f7431
...
...
@@ -227,8 +227,4 @@ export class LayoutProvider extends Disposable implements IViewLayout {
public
setScrollPosition
(
position
:
editorCommon
.
INewScrollPosition
):
void
{
this
.
_scrollable
.
updateState
(
position
);
}
public
getScrolledTopFromAbsoluteTop
(
top
:
number
):
number
{
const
scrollState
=
this
.
_scrollable
.
getState
();
return
top
-
scrollState
.
scrollTop
;
}
}
src/vs/editor/common/viewModel/viewModel.ts
浏览文件 @
2c3f7431
...
...
@@ -21,7 +21,6 @@ export interface IViewLayout {
getScrollHeight
():
number
;
getScrollTop
():
number
;
getCurrentViewport
():
Viewport
;
getScrolledTopFromAbsoluteTop
(
top
:
number
):
number
;
getVerticalOffsetForLineNumber
(
lineNumber
:
number
):
number
;
setScrollPosition
(
position
:
INewScrollPosition
):
void
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录