Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
990b43a2
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,发现更多精彩内容 >>
提交
990b43a2
编写于
9月 07, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Focus object on double click in scene inspector.
上级
19213aba
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
49 deletion
+49
-49
editor/js/Editor.js
editor/js/Editor.js
+22
-17
editor/js/Sidebar.Scene.js
editor/js/Sidebar.Scene.js
+5
-0
editor/js/Viewport.js
editor/js/Viewport.js
+11
-3
editor/js/libs/ui.js
editor/js/libs/ui.js
+1
-1
src/core/Object3D.js
src/core/Object3D.js
+10
-28
未找到文件。
editor/js/Editor.js
浏览文件 @
990b43a2
...
...
@@ -32,6 +32,8 @@ var Editor = function () {
geometryChanged
:
new
SIGNALS
.
Signal
(),
objectSelected
:
new
SIGNALS
.
Signal
(),
objectFocused
:
new
SIGNALS
.
Signal
(),
objectAdded
:
new
SIGNALS
.
Signal
(),
objectChanged
:
new
SIGNALS
.
Signal
(),
objectRemoved
:
new
SIGNALS
.
Signal
(),
...
...
@@ -283,35 +285,26 @@ Editor.prototype = {
select
:
function
(
object
)
{
this
.
selected
=
object
;
if
(
object
!==
null
)
{
if
(
this
.
selected
===
object
)
return
;
this
.
config
.
setKey
(
'
selected
'
,
object
.
uuid
)
;
var
uuid
=
null
;
}
else
{
if
(
object
!==
null
)
{
this
.
config
.
setKey
(
'
selected
'
,
null
)
;
uuid
=
object
.
uuid
;
}
this
.
selected
=
object
;
this
.
config
.
setKey
(
'
selected
'
,
uuid
);
this
.
signals
.
objectSelected
.
dispatch
(
object
);
},
selectById
:
function
(
id
)
{
var
scope
=
this
;
this
.
scene
.
traverse
(
function
(
child
)
{
if
(
child
.
id
===
id
)
{
scope
.
select
(
child
);
}
}
);
this
.
select
(
this
.
scene
.
getObjectById
(
id
,
true
)
);
},
...
...
@@ -335,6 +328,18 @@ Editor.prototype = {
this
.
select
(
null
);
},
focus
:
function
(
object
)
{
this
.
signals
.
objectFocused
.
dispatch
(
object
);
},
focusById
:
function
(
id
)
{
this
.
focus
(
this
.
scene
.
getObjectById
(
id
,
true
)
);
}
}
editor/js/Sidebar.Scene.js
浏览文件 @
990b43a2
...
...
@@ -24,6 +24,11 @@ Sidebar.Scene = function ( editor ) {
ignoreObjectSelectedSignal
=
false
;
}
);
outliner
.
onDblClick
(
function
()
{
editor
.
focusById
(
parseInt
(
outliner
.
getValue
()
)
);
}
);
container
.
add
(
outliner
);
container
.
add
(
new
UI
.
Break
()
);
...
...
editor/js/Viewport.js
浏览文件 @
990b43a2
...
...
@@ -149,9 +149,11 @@ var Viewport = function ( editor ) {
var
intersects
=
getIntersects
(
event
,
objects
);
if
(
intersects
.
length
>
0
&&
intersects
[
0
].
object
===
editor
.
selected
)
{
if
(
intersects
.
length
>
0
)
{
controls
.
focus
(
editor
.
selected
);
var
intersect
=
intersects
[
0
];
signals
.
objectFocused
.
dispatch
(
intersect
.
object
);
}
...
...
@@ -164,7 +166,7 @@ var Viewport = function ( editor ) {
// otherwise controls.enabled doesn't work.
var
controls
=
new
THREE
.
EditorControls
(
camera
,
container
.
dom
);
controls
.
center
.
fromArray
(
editor
.
config
.
getKey
(
'
camera/target
'
)
)
controls
.
center
.
fromArray
(
editor
.
config
.
getKey
(
'
camera/target
'
)
)
;
controls
.
addEventListener
(
'
change
'
,
function
()
{
transformControls
.
update
();
...
...
@@ -283,6 +285,12 @@ var Viewport = function ( editor ) {
}
);
signals
.
objectFocused
.
add
(
function
(
object
)
{
controls
.
focus
(
object
);
}
);
signals
.
geometryChanged
.
add
(
render
);
signals
.
objectAdded
.
add
(
function
(
object
)
{
...
...
editor/js/libs/ui.js
浏览文件 @
990b43a2
...
...
@@ -69,7 +69,7 @@ properties.forEach( function ( property ) {
// events
var
events
=
[
'
KeyUp
'
,
'
KeyDown
'
,
'
MouseOver
'
,
'
MouseOut
'
,
'
Click
'
,
'
Change
'
];
var
events
=
[
'
KeyUp
'
,
'
KeyDown
'
,
'
MouseOver
'
,
'
MouseOut
'
,
'
Click
'
,
'
DblClick
'
,
'
Change
'
];
events
.
forEach
(
function
(
event
)
{
...
...
src/core/Object3D.js
浏览文件 @
990b43a2
...
...
@@ -404,25 +404,16 @@ THREE.Object3D.prototype = {
getObjectById
:
function
(
id
,
recursive
)
{
if
(
this
.
id
===
id
)
return
this
;
for
(
var
i
=
0
,
l
=
this
.
children
.
length
;
i
<
l
;
i
++
)
{
var
child
=
this
.
children
[
i
];
var
object
=
child
.
getObjectById
(
id
,
recursive
);
if
(
child
.
id
===
id
)
{
return
child
;
}
if
(
recursive
===
true
)
{
if
(
object
!==
undefined
)
{
child
=
child
.
getObjectById
(
id
,
recursive
);
if
(
child
!==
undefined
)
{
return
child
;
}
return
object
;
}
...
...
@@ -434,25 +425,16 @@ THREE.Object3D.prototype = {
getObjectByName
:
function
(
name
,
recursive
)
{
if
(
this
.
name
===
name
)
return
this
;
for
(
var
i
=
0
,
l
=
this
.
children
.
length
;
i
<
l
;
i
++
)
{
var
child
=
this
.
children
[
i
];
var
object
=
child
.
getObjectByName
(
name
,
recursive
);
if
(
child
.
name
===
name
)
{
return
child
;
}
if
(
recursive
===
true
)
{
if
(
object
!==
undefined
)
{
child
=
child
.
getObjectByName
(
name
,
recursive
);
if
(
child
!==
undefined
)
{
return
child
;
}
return
object
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录