Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
aaf7b701
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,发现更多精彩内容 >>
提交
aaf7b701
编写于
10月 17, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
allow to dnd group reordering
上级
b48eef3f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
92 addition
and
71 deletion
+92
-71
src/vs/workbench/browser/parts/editor/media/sidebyside.css
src/vs/workbench/browser/parts/editor/media/sidebyside.css
+30
-7
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
...workbench/browser/parts/editor/sideBySideEditorControl.ts
+62
-64
未找到文件。
src/vs/workbench/browser/parts/editor/media/sidebyside.css
浏览文件 @
aaf7b701
...
...
@@ -40,12 +40,12 @@
outline-offset
:
-2px
;
}
.vs
.monaco-workbench
>
.editor
>
.content.dragging
{
.vs
.monaco-workbench
>
.editor
>
.content.
vertical-layout.
dragging
{
border-left
:
1px
solid
#E7E7E7
;
border-right
:
1px
solid
#E7E7E7
;
}
.vs-dark
.monaco-workbench
>
.editor
>
.content.dragging
{
.vs-dark
.monaco-workbench
>
.editor
>
.content.
vertical-layout.
dragging
{
border-left
:
1px
solid
#444
;
border-right
:
1px
solid
#444
;
}
...
...
@@ -73,11 +73,16 @@
box-sizing
:
content-box
;
}
.vs
.monaco-workbench
>
.editor
>
.content
>
.one-editor-silo.dragging
{
.vs
.monaco-workbench
>
.editor
>
.content
.vertical-layout
>
.one-editor-silo.dragging
{
border-left
:
1px
solid
#E7E7E7
;
border-right
:
1px
solid
#E7E7E7
;
}
.vs
.monaco-workbench
>
.editor
>
.content.horizontal-layout
>
.one-editor-silo.dragging
{
border-top
:
1px
solid
#E7E7E7
;
border-bottom
:
1px
solid
#E7E7E7
;
}
.vs
.monaco-workbench
>
.editor
>
.content.vertical-layout
>
.one-editor-silo.editor-center
,
.vs
.monaco-workbench
>
.editor
>
.content.vertical-layout
>
.one-editor-silo.editor-right
{
border-left
:
1px
solid
#E7E7E7
;
...
...
@@ -88,11 +93,16 @@
border-top
:
1px
solid
#E7E7E7
;
}
.vs-dark
.monaco-workbench
>
.editor
>
.content
>
.one-editor-silo.dragging
{
.vs-dark
.monaco-workbench
>
.editor
>
.content
.vertical-layout
>
.one-editor-silo.dragging
{
border-left
:
1px
solid
#444
;
border-right
:
1px
solid
#444
;
}
.vs-dark
.monaco-workbench
>
.editor
>
.content.horizontal-layout
>
.one-editor-silo.dragging
{
border-top
:
1px
solid
#444
;
border-bottom
:
1px
solid
#444
;
}
.vs-dark
.monaco-workbench
>
.editor
>
.content.vertical-layout
>
.one-editor-silo.editor-center
,
.vs-dark
.monaco-workbench
>
.editor
>
.content.vertical-layout
>
.one-editor-silo.editor-right
{
border-left
:
1px
solid
#444
;
...
...
@@ -103,11 +113,16 @@
border-top
:
1px
solid
#444
;
}
.hc-black
.monaco-workbench
>
.editor
>
.content
>
.one-editor-silo.dragging
{
.hc-black
.monaco-workbench
>
.editor
>
.content
.vertical-layout
>
.one-editor-silo.dragging
{
border-left
:
1px
solid
#6FC3DF
;
border-right
:
1px
solid
#6FC3DF
;
}
.hc-black
.monaco-workbench
>
.editor
>
.content.horizontal-layout
>
.one-editor-silo.dragging
{
border-top
:
1px
solid
#6FC3DF
;
border-bottom
:
1px
solid
#6FC3DF
;
}
.hc-black
.monaco-workbench
>
.editor
>
.content.vertical-layout
>
.one-editor-silo.editor-center
,
.hc-black
.monaco-workbench
>
.editor
>
.content.vertical-layout
>
.one-editor-silo.editor-right
{
border-left
:
1px
solid
#6FC3DF
;
...
...
@@ -118,14 +133,22 @@
border-top
:
1px
solid
#6FC3DF
;
}
.monaco-workbench
>
.editor
>
.content
>
.one-editor-silo.draggedunder
{
.monaco-workbench
>
.editor
>
.content
.vertical-layout
>
.one-editor-silo.draggedunder
{
transition
:
left
200ms
ease-out
;
}
.monaco-workbench
>
.editor
>
.content
>
.editor-right.draggedunder
{
.monaco-workbench
>
.editor
>
.content
.vertical-layout
>
.editor-right.draggedunder
{
transition-property
:
right
;
}
.monaco-workbench
>
.editor
>
.content.horizontal-layout
>
.one-editor-silo.draggedunder
{
transition
:
top
200ms
ease-out
;
}
.monaco-workbench
>
.editor
>
.content.horizontal-layout
>
.editor-right.draggedunder
{
transition-property
:
bottom
;
}
.monaco-workbench
>
.editor
>
.content
>
.one-editor-silo
>
.container
{
height
:
100%
;
}
...
...
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
浏览文件 @
aaf7b701
...
...
@@ -1004,22 +1004,11 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
// Update overlay styles
if
(
canSplit
&&
isOverSplitRightOrBottom
)
{
if
(
$this
.
layoutVertically
)
{
overlay
.
style
({
left
:
'
50%
'
,
width
:
'
50%
'
});
}
else
{
overlay
.
style
({
top
:
'
50%
'
,
height
:
'
50%
'
});
}
overlay
.
style
(
$this
.
layoutVertically
?
{
left
:
'
50%
'
,
width
:
'
50%
'
}
:
{
top
:
'
50%
'
,
height
:
'
50%
'
});
}
else
if
(
canSplit
&&
isOverSplitLeftOrUp
)
{
if
(
$this
.
layoutVertically
)
{
overlay
.
style
({
width
:
'
50%
'
});
}
else
{
overlay
.
style
({
height
:
'
50%
'
});
}
overlay
.
style
(
$this
.
layoutVertically
?
{
width
:
'
50%
'
}
:
{
height
:
'
50%
'
});
}
else
{
overlay
.
style
({
left
:
'
0
'
,
width
:
'
100%
'
});
overlay
.
style
({
left
:
'
0
'
,
width
:
'
100%
'
});
}
// Make sure the overlay is visible
...
...
@@ -1188,8 +1177,8 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
const
visibleEditorCount
=
this
.
getVisibleEditorCount
();
const
mouseDownEvent
=
new
StandardMouseEvent
(
e
);
const
start
X
=
mouseDownEvent
.
posx
;
let
oldNew
Left
:
number
=
null
;
const
start
Pos
=
this
.
layoutVertically
?
mouseDownEvent
.
posx
:
mouseDownEvent
.
posy
;
let
oldNew
Pos
:
number
=
null
;
this
.
silos
[
position
].
addClass
(
'
drag
'
);
this
.
parent
.
addClass
(
'
drag
'
);
...
...
@@ -1199,63 +1188,63 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
DOM
.
EventHelper
.
stop
(
e
,
false
);
const
mouseMoveEvent
=
new
StandardMouseEvent
(
e
);
const
diff
X
=
mouseMoveEvent
.
posx
-
startX
;
let
new
Left
:
number
=
null
;
const
diff
Pos
=
(
this
.
layoutVertically
?
mouseMoveEvent
.
posx
:
mouseMoveEvent
.
posy
)
-
startPos
;
let
new
Pos
:
number
=
null
;
if
(
Math
.
abs
(
diff
X
)
>
5
)
{
if
(
Math
.
abs
(
diff
Pos
)
>
5
)
{
wasDragged
=
true
;
}
switch
(
position
)
{
// [ ! ]|[ ]: Moves only to the right
but not outside of dimension width to the right
// [ ! ]|[ ]: Moves only to the right
/bottom but not outside of dimension to the right/bottom
case
Position
.
LEFT
:
{
new
Left
=
Math
.
max
(
-
1
/* 1px border accomodation */
,
Math
.
min
(
diffX
,
this
.
dimension
.
width
-
this
.
silosSize
[
Position
.
LEFT
]));
new
Pos
=
Math
.
max
(
-
1
/* 1px border accomodation */
,
Math
.
min
(
diffPos
,
this
.
totalSize
-
this
.
silosSize
[
Position
.
LEFT
]));
break
;
}
case
Position
.
CENTER
:
{
// [ ]|[ ! ]: Moves only to the left
but not outside of dimension width to the left
// [ ]|[ ! ]: Moves only to the left
/top but not outside of dimension to the left/top
if
(
visibleEditorCount
===
2
)
{
new
Left
=
Math
.
min
(
this
.
silosSize
[
Position
.
LEFT
],
Math
.
max
(
-
1
/* 1px border accomodation */
,
this
.
silosSize
[
Position
.
LEFT
]
+
diffX
));
new
Pos
=
Math
.
min
(
this
.
silosSize
[
Position
.
LEFT
],
Math
.
max
(
-
1
/* 1px border accomodation */
,
this
.
silosSize
[
Position
.
LEFT
]
+
diffPos
));
}
// [ ]|[ ! ]|[ ]: Moves to left
and right but not outside of dimensions width
on both sides
// [ ]|[ ! ]|[ ]: Moves to left
/top and right/bottom but not outside of dimensions
on both sides
else
{
new
Left
=
Math
.
min
(
this
.
dimension
.
width
-
this
.
silosSize
[
Position
.
CENTER
],
Math
.
max
(
-
1
/* 1px border accomodation */
,
this
.
silosSize
[
Position
.
LEFT
]
+
diffX
));
new
Pos
=
Math
.
min
(
this
.
totalSize
-
this
.
silosSize
[
Position
.
CENTER
],
Math
.
max
(
-
1
/* 1px border accomodation */
,
this
.
silosSize
[
Position
.
LEFT
]
+
diffPos
));
}
break
;
}
// [ ]|[ ]|[ ! ]: Moves to the right
but not outside of dimension width on the left
side
// [ ]|[ ]|[ ! ]: Moves to the right
/bottom but not outside of dimension on the left/top
side
case
Position
.
RIGHT
:
{
new
Left
=
Math
.
min
(
this
.
silosSize
[
Position
.
LEFT
]
+
this
.
silosSize
[
Position
.
CENTER
],
Math
.
max
(
-
1
/* 1px border accomodation */
,
this
.
silosSize
[
Position
.
LEFT
]
+
this
.
silosSize
[
Position
.
CENTER
]
+
diffX
));
new
Pos
=
Math
.
min
(
this
.
silosSize
[
Position
.
LEFT
]
+
this
.
silosSize
[
Position
.
CENTER
],
Math
.
max
(
-
1
/* 1px border accomodation */
,
this
.
silosSize
[
Position
.
LEFT
]
+
this
.
silosSize
[
Position
.
CENTER
]
+
diffPos
));
break
;
}
}
// Return early if position did not change
if
(
oldNew
Left
===
newLeft
)
{
if
(
oldNew
Pos
===
newPos
)
{
return
;
}
oldNew
Left
=
newLeft
;
oldNew
Pos
=
newPos
;
// Live drag Feedback
const
moveTo
:
Position
=
this
.
findMoveTarget
(
position
,
diff
X
);
const
moveTo
:
Position
=
this
.
findMoveTarget
(
position
,
diff
Pos
);
switch
(
position
)
{
case
Position
.
LEFT
:
{
if
(
moveTo
===
Position
.
LEFT
||
moveTo
===
null
)
{
this
.
silos
[
Position
.
CENTER
].
style
({
left
:
this
.
silosSize
[
Position
.
LEFT
]
+
'
px
'
,
right
:
'
auto
'
,
borderLeftWidth
:
'
1px
'
}
);
this
.
silos
[
Position
.
RIGHT
].
style
({
left
:
'
auto
'
,
right
:
0
}
);
this
.
posSilo
(
Position
.
CENTER
,
`
${
this
.
silosSize
[
Position
.
LEFT
]}
px`
,
'
auto
'
);
this
.
posSilo
(
Position
.
RIGHT
,
'
auto
'
,
0
);
}
else
if
(
moveTo
===
Position
.
CENTER
)
{
this
.
silos
[
Position
.
CENTER
].
style
({
left
:
0
,
right
:
'
auto
'
,
borderLeftWidth
:
0
}
);
this
.
posSilo
(
Position
.
CENTER
,
0
,
'
auto
'
);
this
.
silos
[
Position
.
CENTER
].
addClass
(
'
draggedunder
'
);
this
.
silos
[
Position
.
RIGHT
].
style
({
left
:
'
auto
'
,
right
:
0
}
);
this
.
posSilo
(
Position
.
RIGHT
,
'
auto
'
,
0
);
}
else
if
(
moveTo
===
Position
.
RIGHT
)
{
this
.
silos
[
Position
.
CENTER
].
style
({
left
:
0
,
right
:
'
auto
'
}
);
this
.
silos
[
Position
.
RIGHT
].
style
({
left
:
'
auto
'
,
right
:
this
.
silosSize
[
Position
.
LEFT
]
+
'
px
'
}
);
this
.
posSilo
(
Position
.
CENTER
,
0
,
'
auto
'
);
this
.
posSilo
(
Position
.
RIGHT
,
'
auto
'
,
`
${
this
.
silosSize
[
Position
.
LEFT
]}
px`
);
this
.
silos
[
Position
.
RIGHT
].
addClass
(
'
draggedunder
'
);
}
break
;
...
...
@@ -1263,38 +1252,38 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
case
Position
.
CENTER
:
{
if
(
moveTo
===
Position
.
LEFT
)
{
this
.
silos
[
Position
.
LEFT
].
style
({
left
:
this
.
silosSize
[
Position
.
CENTER
]
+
'
px
'
,
right
:
'
auto
'
}
);
this
.
posSilo
(
Position
.
LEFT
,
`
${
this
.
silosSize
[
Position
.
CENTER
]}
px`
,
'
auto
'
);
this
.
silos
[
Position
.
LEFT
].
addClass
(
'
draggedunder
'
);
}
else
if
(
moveTo
===
Position
.
CENTER
||
moveTo
===
null
)
{
this
.
silos
[
Position
.
LEFT
].
style
({
left
:
0
,
right
:
'
auto
'
}
);
this
.
silos
[
Position
.
RIGHT
].
style
({
left
:
'
auto
'
,
right
:
0
}
);
this
.
posSilo
(
Position
.
LEFT
,
0
,
'
auto
'
);
this
.
posSilo
(
Position
.
RIGHT
,
'
auto
'
,
0
);
}
else
if
(
moveTo
===
Position
.
RIGHT
)
{
this
.
silos
[
Position
.
RIGHT
].
style
({
left
:
'
auto
'
,
right
:
this
.
silosSize
[
Position
.
CENTER
]
+
'
px
'
}
);
this
.
posSilo
(
Position
.
RIGHT
,
'
auto
'
,
`
${
this
.
silosSize
[
Position
.
CENTER
]}
px`
);
this
.
silos
[
Position
.
RIGHT
].
addClass
(
'
draggedunder
'
);
this
.
silos
[
Position
.
LEFT
].
style
({
left
:
0
,
right
:
'
auto
'
}
);
this
.
posSilo
(
Position
.
LEFT
,
0
,
'
auto
'
);
}
break
;
}
case
Position
.
RIGHT
:
{
if
(
moveTo
===
Position
.
LEFT
)
{
this
.
silos
[
Position
.
LEFT
].
style
({
left
:
this
.
silosSize
[
Position
.
RIGHT
]
+
'
px
'
,
right
:
'
auto
'
}
);
this
.
posSilo
(
Position
.
LEFT
,
`
${
this
.
silosSize
[
Position
.
RIGHT
]}
px`
,
'
auto
'
);
this
.
silos
[
Position
.
LEFT
].
addClass
(
'
draggedunder
'
);
}
else
if
(
moveTo
===
Position
.
CENTER
)
{
this
.
silos
[
Position
.
LEFT
].
style
({
left
:
0
,
right
:
'
auto
'
}
);
this
.
silos
[
Position
.
CENTER
].
style
({
left
:
(
this
.
silosSize
[
Position
.
LEFT
]
+
this
.
silosSize
[
Position
.
RIGHT
])
+
'
px
'
,
right
:
'
auto
'
}
);
this
.
posSilo
(
Position
.
LEFT
,
0
,
'
auto
'
);
this
.
posSilo
(
Position
.
CENTER
,
`
${
this
.
silosSize
[
Position
.
LEFT
]
+
this
.
silosSize
[
Position
.
RIGHT
]}
px`
,
'
auto
'
);
this
.
silos
[
Position
.
CENTER
].
addClass
(
'
draggedunder
'
);
}
else
if
(
moveTo
===
Position
.
RIGHT
||
moveTo
===
null
)
{
this
.
silos
[
Position
.
LEFT
].
style
({
left
:
0
,
right
:
'
auto
'
}
);
this
.
silos
[
Position
.
CENTER
].
style
({
left
:
this
.
silosSize
[
Position
.
LEFT
]
+
'
px
'
,
right
:
'
auto
'
}
);
this
.
posSilo
(
Position
.
LEFT
,
0
,
'
auto
'
);
this
.
posSilo
(
Position
.
CENTER
,
`
${
this
.
silosSize
[
Position
.
LEFT
]}
px`
,
'
auto
'
);
}
break
;
}
}
// Move the editor to provide feedback to the user and add class
if
(
new
Left
!==
null
)
{
this
.
silos
[
position
].
style
(
{
left
:
newLeft
+
'
px
'
});
if
(
new
Pos
!==
null
)
{
this
.
silos
[
position
].
style
(
this
.
layoutVertically
?
{
left
:
`
${
newPos
}
px`
}
:
{
top
:
`
${
newPos
}
px`
});
this
.
silos
[
position
].
addClass
(
'
dragging
'
);
this
.
parent
.
addClass
(
'
dragging
'
);
}
...
...
@@ -1316,14 +1305,15 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
parent
.
removeClass
(
'
dragging
'
);
this
.
silos
[
position
].
removeClass
(
'
dragging
'
);
POSITIONS
.
forEach
(
p
=>
this
.
silos
[
p
].
removeClass
(
'
draggedunder
'
));
this
.
silos
[
Position
.
LEFT
].
style
({
left
:
0
,
right
:
'
auto
'
});
this
.
silos
[
Position
.
CENTER
].
style
({
left
:
'
auto
'
,
right
:
'
auto
'
,
borderLeftWidth
:
'
1px
'
});
this
.
silos
[
Position
.
RIGHT
].
style
({
left
:
'
auto
'
,
right
:
0
,
borderLeftWidth
:
'
1px
'
});
this
.
posSilo
(
Position
.
LEFT
,
0
,
'
auto
'
);
this
.
posSilo
(
Position
.
CENTER
,
'
auto
'
,
'
auto
'
);
this
.
posSilo
(
Position
.
RIGHT
,
'
auto
'
,
0
);
// Find move target
const
mouseUpEvent
=
new
StandardMouseEvent
(
e
);
const
diff
X
=
mouseUpEvent
.
posx
-
startX
;
const
moveTo
:
Position
=
this
.
findMoveTarget
(
position
,
diff
X
);
const
diff
Pos
=
(
this
.
layoutVertically
?
mouseUpEvent
.
posx
:
mouseUpEvent
.
posy
)
-
startPos
;
const
moveTo
:
Position
=
this
.
findMoveTarget
(
position
,
diff
Pos
);
// Move to valid position if any
if
(
moveTo
!==
null
)
{
...
...
@@ -1345,63 +1335,71 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
});
}
private
findMoveTarget
(
position
:
Position
,
diffX
:
number
):
Position
{
private
posSilo
(
pos
:
number
,
leftTop
:
string
|
number
,
rightBottom
?:
string
|
number
):
void
{
if
(
this
.
layoutVertically
)
{
this
.
silos
[
pos
].
style
({
left
:
leftTop
,
right
:
rightBottom
});
}
else
{
this
.
silos
[
pos
].
style
({
top
:
leftTop
,
bottom
:
rightBottom
});
}
}
private
findMoveTarget
(
position
:
Position
,
diffPos
:
number
):
Position
{
const
visibleEditorCount
=
this
.
getVisibleEditorCount
();
switch
(
position
)
{
case
Position
.
LEFT
:
{
// [ ! ]|[] -> []|[ ! ]
if
(
visibleEditorCount
===
2
&&
(
diff
X
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
||
diffX
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
))
{
if
(
visibleEditorCount
===
2
&&
(
diff
Pos
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
||
diffPos
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
))
{
return
Position
.
CENTER
;
}
// [ ! ]|[]|[] -> []|[]|[ ! ]
if
(
visibleEditorCount
===
3
&&
(
diff
X
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
]
||
diffX
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
]))
{
if
(
visibleEditorCount
===
3
&&
(
diff
Pos
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
]
||
diffPos
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
]))
{
return
Position
.
RIGHT
;
}
// [ ! ]|[]|[] -> []|[ ! ]|[]
if
(
visibleEditorCount
===
3
&&
(
diff
X
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
||
diffX
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
))
{
if
(
visibleEditorCount
===
3
&&
(
diff
Pos
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
||
diffPos
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
))
{
return
Position
.
CENTER
;
}
break
;
}
case
Position
.
CENTER
:
{
if
(
visibleEditorCount
===
2
&&
diff
X
>
0
)
{
if
(
visibleEditorCount
===
2
&&
diff
Pos
>
0
)
{
return
null
;
// Return early since CENTER cannot be moved to the RIGHT unless there is a RIGHT position
}
// []|[ ! ] -> [ ! ]|[]
if
(
visibleEditorCount
===
2
&&
(
Math
.
abs
(
diff
X
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
||
Math
.
abs
(
diffX
)
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
))
{
if
(
visibleEditorCount
===
2
&&
(
Math
.
abs
(
diff
Pos
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
||
Math
.
abs
(
diffPos
)
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
))
{
return
Position
.
LEFT
;
}
// []|[ ! ]|[] -> [ ! ]|[]|[]
if
(
visibleEditorCount
===
3
&&
((
diff
X
<
0
&&
Math
.
abs
(
diffX
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
)
||
(
diffX
<
0
&&
Math
.
abs
(
diffX
)
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
)))
{
if
(
visibleEditorCount
===
3
&&
((
diff
Pos
<
0
&&
Math
.
abs
(
diffPos
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
)
||
(
diffPos
<
0
&&
Math
.
abs
(
diffPos
)
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
)))
{
return
Position
.
LEFT
;
}
// []|[ ! ]|[] -> []|[]|[ ! ]
if
(
visibleEditorCount
===
3
&&
((
diff
X
>
0
&&
Math
.
abs
(
diffX
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
)
||
(
diffX
>
0
&&
Math
.
abs
(
diffX
)
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
)))
{
if
(
visibleEditorCount
===
3
&&
((
diff
Pos
>
0
&&
Math
.
abs
(
diffPos
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
)
||
(
diffPos
>
0
&&
Math
.
abs
(
diffPos
)
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
)))
{
return
Position
.
RIGHT
;
}
break
;
}
case
Position
.
RIGHT
:
{
if
(
diff
X
>
0
)
{
if
(
diff
Pos
>
0
)
{
return
null
;
// Return early since RIGHT cannot be moved more to the RIGHT
}
// []|[]|[ ! ] -> [ ! ]|[]|[]
if
(
Math
.
abs
(
diff
X
)
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
]
||
Math
.
abs
(
diffX
)
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
])
{
if
(
Math
.
abs
(
diff
Pos
)
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
]
||
Math
.
abs
(
diffPos
)
>=
this
.
silosSize
[
Position
.
LEFT
]
/
2
+
this
.
silosSize
[
Position
.
CENTER
])
{
return
Position
.
LEFT
;
}
// []|[]|[ ! ] -> []|[ ! ]|[]
if
(
Math
.
abs
(
diff
X
)
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
||
Math
.
abs
(
diffX
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
)
{
if
(
Math
.
abs
(
diff
Pos
)
>=
this
.
silosSize
[
Position
.
RIGHT
]
/
2
||
Math
.
abs
(
diffPos
)
>=
this
.
silosSize
[
Position
.
CENTER
]
/
2
)
{
return
Position
.
CENTER
;
}
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录