Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c4792762
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,发现更多精彩内容 >>
提交
c4792762
编写于
8月 11, 2020
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #95888
上级
f6f87358
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
71 addition
and
8 deletion
+71
-8
src/vs/workbench/browser/parts/views/viewPaneContainer.ts
src/vs/workbench/browser/parts/views/viewPaneContainer.ts
+71
-8
未找到文件。
src/vs/workbench/browser/parts/views/viewPaneContainer.ts
浏览文件 @
c4792762
...
...
@@ -606,6 +606,8 @@ const enum DropDirection {
RIGHT
}
type
BoundingRect
=
{
top
:
number
,
left
:
number
,
bottom
:
number
,
right
:
number
};
class
ViewPaneDropOverlay
extends
Themable
{
private
static
readonly
OVERLAY_ID
=
'
monaco-workbench-pane-drop-overlay
'
;
...
...
@@ -627,6 +629,7 @@ class ViewPaneDropOverlay extends Themable {
constructor
(
private
paneElement
:
HTMLElement
,
private
orientation
:
Orientation
|
undefined
,
private
bounds
:
BoundingRect
|
undefined
,
protected
location
:
ViewContainerLocation
,
protected
themeService
:
IThemeService
,
)
{
...
...
@@ -758,7 +761,22 @@ class ViewPaneDropOverlay extends Themable {
this
.
doPositionOverlay
({
top
:
'
0
'
,
right
:
'
0
'
,
width
:
'
50%
'
,
height
:
'
100%
'
});
break
;
default
:
this
.
doPositionOverlay
({
top
:
'
0
'
,
left
:
'
0
'
,
width
:
'
100%
'
,
height
:
'
100%
'
});
// const top = this.bounds?.top || 0;
// const left = this.bounds?.bottom || 0;
let
top
=
'
0
'
;
let
left
=
'
0
'
;
let
width
=
'
100%
'
;
let
height
=
'
100%
'
;
if
(
this
.
bounds
)
{
const
boundingRect
=
this
.
container
.
getBoundingClientRect
();
top
=
`
${
this
.
bounds
.
top
-
boundingRect
.
top
}
px`
;
left
=
`
${
this
.
bounds
.
left
-
boundingRect
.
left
}
px`
;
height
=
`
${
this
.
bounds
.
bottom
-
this
.
bounds
.
top
}
px`
;
width
=
`
${
this
.
bounds
.
right
-
this
.
bounds
.
left
}
px`
;
}
this
.
doPositionOverlay
({
top
,
left
,
width
,
height
});
}
if
((
this
.
orientation
===
Orientation
.
VERTICAL
&&
paneHeight
<=
25
)
||
...
...
@@ -899,9 +917,35 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
this
.
_register
(
addDisposableListener
(
parent
,
EventType
.
CONTEXT_MENU
,
(
e
:
MouseEvent
)
=>
this
.
showContextMenu
(
new
StandardMouseEvent
(
e
))));
let
overlay
:
ViewPaneDropOverlay
|
undefined
;
const
getOverlayBounds
:
()
=>
BoundingRect
=
()
=>
{
const
fullSize
=
parent
.
getBoundingClientRect
();
const
lastPane
=
this
.
panes
[
this
.
panes
.
length
-
1
].
element
.
getBoundingClientRect
();
const
top
=
this
.
orientation
===
Orientation
.
VERTICAL
?
lastPane
.
bottom
:
fullSize
.
top
;
const
left
=
this
.
orientation
===
Orientation
.
HORIZONTAL
?
lastPane
.
right
:
fullSize
.
left
;
return
{
top
,
bottom
:
fullSize
.
bottom
,
left
,
right
:
fullSize
.
right
,
};
};
const
inBounds
=
(
bounds
:
BoundingRect
,
pos
:
{
x
:
number
,
y
:
number
})
=>
{
return
pos
.
x
>=
bounds
.
left
&&
pos
.
x
<=
bounds
.
right
&&
pos
.
y
>=
bounds
.
top
&&
pos
.
y
<=
bounds
.
bottom
;
};
let
bounds
:
BoundingRect
;
this
.
_register
(
CompositeDragAndDropObserver
.
INSTANCE
.
registerTarget
(
parent
,
{
onDragEnter
:
(
e
)
=>
{
if
(
!
overlay
&&
this
.
panes
.
length
===
0
)
{
bounds
=
getOverlayBounds
();
if
(
overlay
&&
overlay
.
disposed
)
{
overlay
=
undefined
;
}
if
(
!
overlay
&&
inBounds
(
bounds
,
e
.
eventData
))
{
const
dropData
=
e
.
dragAndDropData
.
getData
();
if
(
dropData
.
type
===
'
view
'
)
{
...
...
@@ -912,7 +956,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
return
;
}
overlay
=
new
ViewPaneDropOverlay
(
parent
,
undefined
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
overlay
=
new
ViewPaneDropOverlay
(
parent
,
undefined
,
bounds
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
}
if
(
dropData
.
type
===
'
composite
'
&&
dropData
.
id
!==
this
.
viewContainer
.
id
)
{
...
...
@@ -920,14 +964,22 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
const
viewsToMove
=
this
.
viewDescriptorService
.
getViewContainerModel
(
container
).
allViewDescriptors
;
if
(
!
viewsToMove
.
some
(
v
=>
!
v
.
canMoveView
)
&&
viewsToMove
.
length
>
0
)
{
overlay
=
new
ViewPaneDropOverlay
(
parent
,
undefined
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
overlay
=
new
ViewPaneDropOverlay
(
parent
,
undefined
,
bounds
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
}
}
}
},
onDragOver
:
(
e
)
=>
{
if
(
this
.
panes
.
length
===
0
)
{
if
(
overlay
&&
overlay
.
disposed
)
{
overlay
=
undefined
;
}
if
(
overlay
&&
!
inBounds
(
bounds
,
e
.
eventData
))
{
overlay
.
dispose
();
overlay
=
undefined
;
}
if
(
inBounds
(
bounds
,
e
.
eventData
))
{
toggleDropEffect
(
e
.
eventData
.
dataTransfer
,
'
move
'
,
overlay
!==
undefined
);
}
},
...
...
@@ -954,9 +1006,20 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
}
}
const
paneCount
=
this
.
panes
.
length
;
if
(
viewsToMove
.
length
>
0
)
{
this
.
viewDescriptorService
.
moveViewsToContainer
(
viewsToMove
,
this
.
viewContainer
);
}
if
(
paneCount
>
0
)
{
for
(
const
view
of
viewsToMove
)
{
const
paneToMove
=
this
.
panes
.
find
(
p
=>
p
.
id
===
view
.
id
);
if
(
paneToMove
)
{
this
.
movePane
(
paneToMove
,
this
.
panes
[
this
.
panes
.
length
-
1
]);
}
}
}
}
overlay
?.
dispose
();
...
...
@@ -1366,7 +1429,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
return
;
}
overlay
=
new
ViewPaneDropOverlay
(
pane
.
dropTargetElement
,
this
.
orientation
??
Orientation
.
VERTICAL
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
overlay
=
new
ViewPaneDropOverlay
(
pane
.
dropTargetElement
,
this
.
orientation
??
Orientation
.
VERTICAL
,
undefined
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
}
if
(
dropData
.
type
===
'
composite
'
&&
dropData
.
id
!==
this
.
viewContainer
.
id
&&
!
this
.
viewContainer
.
rejectAddedViews
)
{
...
...
@@ -1374,7 +1437,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
const
viewsToMove
=
this
.
viewDescriptorService
.
getViewContainerModel
(
container
).
allViewDescriptors
;
if
(
!
viewsToMove
.
some
(
v
=>
!
v
.
canMoveView
)
&&
viewsToMove
.
length
>
0
)
{
overlay
=
new
ViewPaneDropOverlay
(
pane
.
dropTargetElement
,
this
.
orientation
??
Orientation
.
VERTICAL
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
overlay
=
new
ViewPaneDropOverlay
(
pane
.
dropTargetElement
,
this
.
orientation
??
Orientation
.
VERTICAL
,
undefined
,
this
.
viewDescriptorService
.
getViewContainerLocation
(
this
.
viewContainer
)
!
,
this
.
themeService
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录