Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
b3711afa
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b3711afa
编写于
9月 23, 2019
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: ui.js clean up.
上级
a9d50e7f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
29 deletion
+33
-29
editor/js/libs/ui.js
editor/js/libs/ui.js
+33
-29
未找到文件。
editor/js/libs/ui.js
浏览文件 @
b3711afa
...
...
@@ -1025,8 +1025,8 @@ UI.TabbedPanel = function ( ) {
UI
.
Element
.
call
(
this
);
var
dom
=
document
.
createElement
(
'
div
'
);
var
dom
=
document
.
createElement
(
'
div
'
);
this
.
dom
=
dom
;
this
.
setClass
(
'
TabbedPanel
'
);
...
...
@@ -1047,7 +1047,7 @@ UI.TabbedPanel = function ( ) {
return
this
;
}
}
;
UI
.
TabbedPanel
.
prototype
=
Object
.
create
(
UI
.
Element
.
prototype
);
UI
.
TabbedPanel
.
prototype
.
constructor
=
UI
.
TabbedPanel
;
...
...
@@ -1057,9 +1057,10 @@ UI.TabbedPanel.prototype.select = function ( id ) {
var
tab
;
var
panel
;
var
scope
=
this
;
// Deselect current selection
if
(
this
.
selected
&&
this
.
selected
.
length
)
{
tab
=
this
.
tabs
.
find
(
function
(
item
)
{
return
item
.
dom
.
id
===
scope
.
selected
}
);
panel
=
this
.
panels
.
find
(
function
(
item
)
{
return
item
.
dom
.
id
===
scope
.
selected
}
);
...
...
@@ -1069,7 +1070,7 @@ UI.TabbedPanel.prototype.select = function ( id ) {
}
if
(
panel
)
{
if
(
panel
)
{
panel
.
setDisplay
(
'
none
'
);
...
...
@@ -1079,14 +1080,14 @@ UI.TabbedPanel.prototype.select = function ( id ) {
tab
=
this
.
tabs
.
find
(
function
(
item
)
{
return
item
.
dom
.
id
===
id
}
);
panel
=
this
.
panels
.
find
(
function
(
item
)
{
return
item
.
dom
.
id
===
id
}
);
if
(
tab
)
{
tab
.
addClass
(
'
selected
'
);
}
if
(
panel
)
{
if
(
panel
)
{
panel
.
setDisplay
(
''
);
...
...
@@ -1096,7 +1097,7 @@ UI.TabbedPanel.prototype.select = function ( id ) {
return
this
;
}
}
;
UI
.
TabbedPanel
.
prototype
.
addTab
=
function
(
id
,
label
,
items
)
{
...
...
@@ -1114,7 +1115,7 @@ UI.TabbedPanel.prototype.addTab = function ( id, label, items ) {
this
.
select
(
id
);
}
}
;
UI
.
TabbedPanel
.
Tab
=
function
(
text
,
parent
)
{
...
...
@@ -1124,15 +1125,16 @@ UI.TabbedPanel.Tab = function ( text, parent ) {
this
.
setClass
(
'
Tab
'
);
var
scope
=
this
;
this
.
dom
.
addEventListener
(
'
click
'
,
function
(
event
)
{
scope
.
parent
.
select
(
scope
.
dom
.
id
);
}
)
}
)
;
return
this
;
}
}
;
UI
.
TabbedPanel
.
Tab
.
prototype
=
Object
.
create
(
UI
.
Text
.
prototype
);
UI
.
TabbedPanel
.
Tab
.
prototype
.
constructor
=
UI
.
TabbedPanel
.
Tab
;
...
...
@@ -1154,7 +1156,7 @@ UI.Listbox = function ( ) {
return
this
;
}
}
;
UI
.
Listbox
.
prototype
=
Object
.
create
(
UI
.
Element
.
prototype
);
UI
.
Listbox
.
prototype
.
constructor
=
UI
.
ListboxItem
;
...
...
@@ -1169,23 +1171,23 @@ UI.Listbox.prototype.setItems = function ( items ) {
this
.
render
(
);
}
}
;
UI
.
Listbox
.
prototype
.
render
=
function
(
)
{
while
(
this
.
listitems
.
length
)
{
while
(
this
.
listitems
.
length
)
{
var
item
=
this
.
listitems
[
0
];
var
item
=
this
.
listitems
[
0
];
item
.
dom
.
remove
();
this
.
listitems
.
splice
(
0
,
1
);
this
.
listitems
.
splice
(
0
,
1
);
}
for
(
var
i
=
0
;
i
<
this
.
items
.
length
;
i
++
)
{
var
item
=
this
.
items
[
i
];
var
item
=
this
.
items
[
i
];
var
listitem
=
new
UI
.
Listbox
.
ListboxItem
(
this
);
listitem
.
setId
(
item
.
id
||
`Listbox-
${
i
}
`
);
...
...
@@ -1194,10 +1196,10 @@ UI.Listbox.prototype.render = function ( ) {
}
}
}
;
// Assuming user passes valid list items
UI
.
Listbox
.
prototype
.
add
=
function
(
)
{
UI
.
Listbox
.
prototype
.
add
=
function
()
{
var
items
=
Array
.
from
(
arguments
);
...
...
@@ -1205,25 +1207,25 @@ UI.Listbox.prototype.add = function ( ) {
UI
.
Element
.
prototype
.
add
.
apply
(
this
,
items
);
}
}
;
UI
.
Listbox
.
prototype
.
selectIndex
=
function
(
index
)
{
if
(
index
>=
0
&&
index
<
this
.
items
.
length
)
{
this
.
setValue
(
this
.
listitems
[
index
].
getId
(
)
);
this
.
setValue
(
this
.
listitems
[
index
].
getId
()
);
}
this
.
selectIndex
=
index
;
}
}
;
UI
.
Listbox
.
prototype
.
getValue
=
function
(
index
)
{
return
this
.
selectedValue
;
}
}
;
UI
.
Listbox
.
prototype
.
setValue
=
function
(
value
)
{
...
...
@@ -1236,7 +1238,7 @@ UI.Listbox.prototype.setValue = function ( value ) {
element
.
addClass
(
'
active
'
);
}
else
{
element
.
removeClass
(
'
active
'
);
}
...
...
@@ -1249,7 +1251,7 @@ UI.Listbox.prototype.setValue = function ( value ) {
changeEvent
.
initEvent
(
'
change
'
,
true
,
true
);
this
.
dom
.
dispatchEvent
(
changeEvent
);
}
}
;
// Listbox Item
UI
.
Listbox
.
ListboxItem
=
function
(
parent
)
{
...
...
@@ -1264,10 +1266,12 @@ UI.Listbox.ListboxItem = function ( parent ) {
var
scope
=
this
;
function
onClick
(
)
{
if
(
scope
.
parent
)
{
function
onClick
()
{
if
(
scope
.
parent
)
{
scope
.
parent
.
setValue
(
scope
.
getId
(
)
);
}
}
...
...
@@ -1276,7 +1280,7 @@ UI.Listbox.ListboxItem = function ( parent ) {
return
this
;
}
}
;
UI
.
Listbox
.
ListboxItem
.
prototype
=
Object
.
create
(
UI
.
Element
.
prototype
);
UI
.
Listbox
.
ListboxItem
.
prototype
.
constructor
=
UI
.
Listbox
.
ListboxItem
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录