Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tianyazhichiC
algorithm-visualizer
提交
23e6b3ab
A
algorithm-visualizer
项目概览
tianyazhichiC
/
algorithm-visualizer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
algorithm-visualizer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
23e6b3ab
编写于
4月 18, 2018
作者:
J
Jason Park
提交者:
Jason
4月 30, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable dragging sections
上级
e7a3bbe9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
31 deletion
+47
-31
src/frontend/workspace/components/Droppable/index.jsx
src/frontend/workspace/components/Droppable/index.jsx
+2
-2
src/frontend/workspace/components/WSSectionContainer/index.jsx
...rontend/workspace/components/WSSectionContainer/index.jsx
+32
-24
src/frontend/workspace/components/WSTabContainer/index.jsx
src/frontend/workspace/components/WSTabContainer/index.jsx
+1
-1
src/frontend/workspace/components/WSTabContainer/stylesheet.scss
...ntend/workspace/components/WSTabContainer/stylesheet.scss
+1
-0
src/frontend/workspace/core/TabContainer.js
src/frontend/workspace/core/TabContainer.js
+2
-2
src/frontend/workspace/core/mixins/parentMixin.js
src/frontend/workspace/core/mixins/parentMixin.js
+9
-2
未找到文件。
src/frontend/workspace/components/Droppable/index.jsx
浏览文件 @
23e6b3ab
...
...
@@ -37,10 +37,10 @@ class Droppable extends React.Component {
const
{
onDropTab
,
onDropSection
}
=
this
.
props
;
switch
(
data
.
type
)
{
case
'
tab
'
:
onDropTab
(
data
.
tab
);
onDropTab
&&
onDropTab
(
data
.
tab
);
break
;
case
'
section
'
:
onDropSection
(
data
.
section
);
onDropSection
&&
onDropSection
(
data
.
section
);
break
;
}
}
...
...
src/frontend/workspace/components/WSSectionContainer/index.jsx
浏览文件 @
23e6b3ab
...
...
@@ -23,18 +23,26 @@ class WSSectionContainer extends React.Component {
handleDropTabToContainer
(
tab
,
index
)
{
const
tabContainer
=
new
TabContainer
();
this
.
core
.
addChild
(
tabContainer
,
index
);
this
.
handleDropSectionToContainer
(
tabContainer
,
index
);
tabContainer
.
addChild
(
tab
);
}
handleDropSectionToContainer
(
section
,
index
)
{
this
.
core
.
addChild
(
section
,
index
);
}
handleDropTabToSection
(
tab
,
index
,
before
=
false
)
{
const
child
=
this
.
core
.
children
[
index
];
const
tabContainer
=
new
TabContainer
();
this
.
handleDropSectionToSection
(
tabContainer
,
index
,
before
);
tabContainer
.
addChild
(
tab
);
}
handleDropSectionToSection
(
section
,
index
,
before
=
false
)
{
const
child
=
this
.
core
.
children
[
index
];
const
sectionContainer
=
new
SectionContainer
({
horizontal
:
!
this
.
core
.
horizontal
});
this
.
core
.
addChild
(
sectionContainer
,
index
);
sectionContainer
.
addChild
(
child
);
sectionContainer
.
addChild
(
tabContainer
,
before
?
0
:
1
);
tabContainer
.
addChild
(
tab
);
sectionContainer
.
addChild
(
section
,
before
?
0
:
1
);
}
render
()
{
...
...
@@ -54,41 +62,41 @@ class WSSectionContainer extends React.Component {
elements
.
push
(
<
Divider
key
=
{
`divider-
${
i
}
`
}
horizontal
=
{
horizontal
}
onResize
=
{
(
target
,
x
,
y
)
=>
this
.
handleResize
(
visibleIndex
-
1
,
target
,
x
,
y
)
}
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
,
i
)
}
/>
);
}
if
(
child
instanceof
SectionContainer
||
visibleChildren
.
length
===
1
)
{
elements
.
push
(
<
div
key
=
{
child
.
key
}
className
=
{
styles
.
wrapper
}
style
=
{
style
}
>
{
child
.
element
}
</
div
>
);
}
else
{
elements
.
push
(
<
div
key
=
{
child
.
key
}
className
=
{
classes
(
styles
.
wrapper
,
!
horizontal
&&
styles
.
horizontal
)
}
style
=
{
style
}
>
<
Divider
horizontal
=
{
!
horizontal
}
onDrop
=
{
data
=>
this
.
handleDropToSection
(
data
,
i
,
true
)
}
/>
{
child
.
element
}
<
Divider
horizontal
=
{
!
horizontal
}
onDrop
=
{
data
=>
this
.
handleDropToSection
(
data
,
i
)
}
/>
</
div
>
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
,
i
)
}
onDropSection
=
{
section
=>
this
.
handleDropSectionToContainer
(
section
,
i
)
}
/>
);
}
elements
.
push
(
<
div
key
=
{
child
.
key
}
className
=
{
classes
(
styles
.
wrapper
,
!
horizontal
&&
styles
.
horizontal
)
}
style
=
{
style
}
>
<
Divider
horizontal
=
{
!
horizontal
}
onDropTab
=
{
tab
=>
this
.
handleDropTabToSection
(
tab
,
i
,
true
)
}
onDropSection
=
{
section
=>
this
.
handleDropSectionToSection
(
section
,
i
,
true
)
}
/>
{
child
.
element
}
<
Divider
horizontal
=
{
!
horizontal
}
onDropTab
=
{
tab
=>
this
.
handleDropTabToSection
(
tab
,
i
)
}
onDropSection
=
{
section
=>
this
.
handleDropSectionToSection
(
section
,
i
)
}
/>
</
div
>
);
});
if
(
elements
.
length
)
{
const
firstIndex
=
children
.
indexOf
(
visibleChildren
[
0
]);
const
lastIndex
=
children
.
indexOf
(
visibleChildren
[
visibleChildren
.
length
-
1
]);
elements
.
unshift
(
<
Divider
key
=
"divider-first"
horizontal
=
{
horizontal
}
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
,
firstIndex
)
}
/>
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
,
firstIndex
)
}
onDropSection
=
{
section
=>
this
.
handleDropSectionToContainer
(
section
,
firstIndex
)
}
/>
);
elements
.
push
(
<
Divider
key
=
"divider-last"
horizontal
=
{
horizontal
}
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
,
lastIndex
+
1
)
}
/>
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
,
lastIndex
+
1
)
}
onDropSection
=
{
section
=>
this
.
handleDropSectionToContainer
(
section
,
lastIndex
+
1
)
}
/>
);
}
else
{
elements
.
push
(
<
Droppable
key
=
"empty"
className
=
{
styles
.
wrapper
}
droppingClassName
=
{
styles
.
dropping
}
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
)
}
/>
onDropTab
=
{
tab
=>
this
.
handleDropTabToContainer
(
tab
)
}
onDropSection
=
{
section
=>
this
.
handleDropSectionToContainer
(
section
)
}
/>
);
}
...
...
src/frontend/workspace/components/WSTabContainer/index.jsx
浏览文件 @
23e6b3ab
...
...
@@ -26,7 +26,7 @@ class WSTabContainer extends React.Component {
e
.
stopPropagation
();
draggingData
.
set
(
e
,
{
type
:
'
section
'
,
section
:
this
.
section
,
section
:
this
.
core
,
})
}
...
...
src/frontend/workspace/components/WSTabContainer/stylesheet.scss
浏览文件 @
23e6b3ab
...
...
@@ -43,6 +43,7 @@
&
.fake
{
&
:first-child
{
flex-shrink
:
0
;
width
:
$line-height
/
2
;
}
...
...
src/frontend/workspace/core/TabContainer.js
浏览文件 @
23e6b3ab
...
...
@@ -22,13 +22,13 @@ class TabContainer extends parentMixin(Section) {
}
addChild
(
child
,
index
=
this
.
children
.
length
)
{
this
.
tabIndex
=
index
;
super
.
addChild
(
child
,
index
);
this
.
setTabIndex
(
Math
.
min
(
index
,
this
.
children
.
length
-
1
));
}
removeChild
(
index
)
{
this
.
tabIndex
=
Math
.
min
(
this
.
tabIndex
,
this
.
children
.
length
-
2
);
super
.
removeChild
(
index
);
this
.
setTabIndex
(
Math
.
min
(
this
.
tabIndex
,
this
.
children
.
length
-
1
));
}
setTabIndex
(
tabIndex
)
{
...
...
src/frontend/workspace/core/mixins/parentMixin.js
浏览文件 @
23e6b3ab
...
...
@@ -14,8 +14,15 @@ const parentMixin = (Base = Child) => class Parent extends Base {
}
addChild
(
child
,
index
=
this
.
children
.
length
)
{
this
.
children
.
splice
(
index
,
0
,
child
);
child
.
setParent
(
this
);
if
(
child
.
parent
===
this
)
{
const
oldIndex
=
this
.
children
.
indexOf
(
child
);
this
.
children
[
oldIndex
]
=
null
;
this
.
children
.
splice
(
index
,
0
,
child
);
this
.
children
=
this
.
children
.
filter
(
child
=>
child
);
}
else
{
this
.
children
.
splice
(
index
,
0
,
child
);
child
.
setParent
(
this
);
}
this
.
render
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录