Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
d72663cc
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
d72663cc
编写于
12月 22, 2019
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Fix ui.three.js.
上级
dd0406e4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
28 deletion
+30
-28
editor/js/libs/ui.three.js
editor/js/libs/ui.three.js
+30
-28
未找到文件。
editor/js/libs/ui.three.js
浏览文件 @
d72663cc
...
...
@@ -9,6 +9,10 @@ import { TGALoader } from '../../../examples/jsm/loaders/TGALoader.js';
import
{
UIElement
,
UISpan
,
UIDiv
,
UIRow
,
UIButton
,
UICheckbox
,
UIText
,
UINumber
}
from
'
./ui.js
'
;
import
{
MoveObjectCommand
}
from
'
../commands/MoveObjectCommand.js
'
;
/**
* @author mrdoob / http://mrdoob.com/
*/
var
UITexture
=
function
(
mapping
)
{
UIElement
.
call
(
this
);
...
...
@@ -39,7 +43,7 @@ var UITexture = function ( mapping ) {
input
.
click
();
},
false
);
canvas
.
addEventListener
(
'
drop
'
,
function
(
event
)
{
canvas
.
addEventListener
(
'
drop
'
,
function
()
{
event
.
preventDefault
();
event
.
stopPropagation
();
...
...
@@ -48,12 +52,6 @@ var UITexture = function ( mapping ) {
},
false
);
dom
.
appendChild
(
canvas
);
var
name
=
document
.
createElement
(
'
input
'
);
name
.
disabled
=
true
;
name
.
style
.
width
=
'
64px
'
;
name
.
style
.
border
=
'
1px solid #ccc
'
;
dom
.
appendChild
(
name
);
function
loadFile
(
file
)
{
if
(
file
.
type
.
match
(
'
image.*
'
)
)
{
...
...
@@ -129,7 +127,6 @@ UITexture.prototype.getValue = function () {
UITexture
.
prototype
.
setValue
=
function
(
texture
)
{
var
canvas
=
this
.
dom
.
children
[
0
];
var
name
=
this
.
dom
.
children
[
1
];
var
context
=
canvas
.
getContext
(
'
2d
'
);
if
(
texture
!==
null
)
{
...
...
@@ -138,21 +135,21 @@ UITexture.prototype.setValue = function ( texture ) {
if
(
image
!==
undefined
&&
image
.
width
>
0
)
{
name
.
valu
e
=
texture
.
sourceFile
;
canvas
.
titl
e
=
texture
.
sourceFile
;
var
scale
=
canvas
.
width
/
image
.
width
;
context
.
drawImage
(
image
,
0
,
0
,
image
.
width
*
scale
,
image
.
height
*
scale
);
}
else
{
name
.
valu
e
=
texture
.
sourceFile
+
'
(error)
'
;
canvas
.
titl
e
=
texture
.
sourceFile
+
'
(error)
'
;
context
.
clearRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
}
}
else
{
name
.
value
=
'
'
;
canvas
.
title
=
'
empty
'
;
if
(
context
!==
null
)
{
...
...
@@ -203,7 +200,6 @@ var UIOutliner = function ( editor ) {
// hack
this
.
scene
=
editor
.
scene
;
this
.
editor
=
editor
;
// Prevent native scroll behavior
dom
.
addEventListener
(
'
keydown
'
,
function
(
event
)
{
...
...
@@ -373,7 +369,7 @@ UIOutliner.prototype.setOptions = function ( options ) {
if
(
newParentIsChild
)
return
;
scope
.
editor
.
execute
(
new
MoveObjectCommand
(
scope
.
editor
,
object
,
newParent
,
nextObject
)
);
editor
.
execute
(
new
MoveObjectCommand
(
editor
,
object
,
newParent
,
nextObject
)
);
var
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
changeEvent
.
initEvent
(
'
change
'
,
true
,
true
);
...
...
@@ -423,16 +419,16 @@ UIOutliner.prototype.setValue = function ( value ) {
for
(
var
i
=
0
;
i
<
this
.
options
.
length
;
i
++
)
{
var
UIE
lement
=
this
.
options
[
i
];
var
e
lement
=
this
.
options
[
i
];
if
(
UIE
lement
.
value
===
value
)
{
if
(
e
lement
.
value
===
value
)
{
UIE
lement
.
classList
.
add
(
'
active
'
);
e
lement
.
classList
.
add
(
'
active
'
);
// scroll into view
var
y
=
UIE
lement
.
offsetTop
-
this
.
dom
.
offsetTop
;
var
bottomY
=
y
+
UIE
lement
.
offsetHeight
;
var
y
=
e
lement
.
offsetTop
-
this
.
dom
.
offsetTop
;
var
bottomY
=
y
+
e
lement
.
offsetHeight
;
var
minScroll
=
bottomY
-
this
.
dom
.
offsetHeight
;
if
(
this
.
dom
.
scrollTop
>
y
)
{
...
...
@@ -449,7 +445,7 @@ UIOutliner.prototype.setValue = function ( value ) {
}
else
{
UIE
lement
.
classList
.
remove
(
'
active
'
);
e
lement
.
classList
.
remove
(
'
active
'
);
}
...
...
@@ -507,7 +503,7 @@ UIPoints.prototype.onChange = function ( callback ) {
UIPoints
.
prototype
.
clear
=
function
()
{
for
(
var
i
=
0
;
i
<
this
.
pointslength
;
++
i
)
{
for
(
var
i
=
0
;
i
<
this
.
points
UI
.
length
;
++
i
)
{
if
(
this
.
pointsUI
[
i
]
)
{
...
...
@@ -549,13 +545,13 @@ UIPoints2.prototype.constructor = UIPoints2;
UIPoints2
.
addRow
=
function
()
{
if
(
this
.
pointslength
===
0
)
{
if
(
this
.
points
UI
.
length
===
0
)
{
this
.
pointsList
.
add
(
this
.
createPointRow
(
0
,
0
)
);
}
else
{
var
point
=
this
.
pointsUI
[
this
.
pointslength
-
1
];
var
point
=
this
.
pointsUI
[
this
.
points
UI
.
length
-
1
];
this
.
pointsList
.
add
(
this
.
createPointRow
(
point
.
x
.
getValue
(),
point
.
y
.
getValue
()
)
);
...
...
@@ -568,14 +564,17 @@ UIPoints2.addRow = function () {
UIPoints2
.
prototype
.
getValue
=
function
()
{
var
points
=
[];
var
count
=
0
;
for
(
var
i
=
0
;
i
<
this
.
pointslength
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
points
UI
.
length
;
i
++
)
{
var
pointUI
=
this
.
pointsUI
[
i
];
if
(
!
pointUI
)
continue
;
points
.
push
(
new
THREE
.
Vector2
(
pointUI
.
x
.
getValue
(),
pointUI
.
y
.
getValue
()
)
);
++
count
;
pointUI
.
lbl
.
setValue
(
count
);
}
...
...
@@ -615,7 +614,7 @@ UIPoints2.prototype.createPointRow = function ( x, y ) {
}
);
this
.
pointspush
(
{
row
:
pointRow
,
lbl
:
lbl
,
x
:
txtX
,
y
:
txtY
}
);
this
.
points
UI
.
push
(
{
row
:
pointRow
,
lbl
:
lbl
,
x
:
txtX
,
y
:
txtY
}
);
++
this
.
lastPointIdx
;
pointRow
.
add
(
lbl
,
txtX
,
txtY
,
btn
);
...
...
@@ -636,13 +635,13 @@ UIPoints3.prototype.constructor = UIPoints3;
UIPoints3
.
addRow
=
function
()
{
if
(
this
.
pointslength
===
0
)
{
if
(
this
.
points
UI
.
length
===
0
)
{
this
.
pointsList
.
add
(
this
.
createPointRow
(
0
,
0
,
0
)
);
}
else
{
var
point
=
this
.
pointsUI
[
this
.
pointslength
-
1
];
var
point
=
this
.
pointsUI
[
this
.
points
UI
.
length
-
1
];
this
.
pointsList
.
add
(
this
.
createPointRow
(
point
.
x
.
getValue
(),
point
.
y
.
getValue
(),
point
.
z
.
getValue
()
)
);
...
...
@@ -655,14 +654,17 @@ UIPoints3.addRow = function () {
UIPoints3
.
prototype
.
getValue
=
function
()
{
var
points
=
[];
var
count
=
0
;
for
(
var
i
=
0
;
i
<
this
.
pointslength
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
points
UI
.
length
;
i
++
)
{
var
pointUI
=
this
.
pointsUI
[
i
];
if
(
!
pointUI
)
continue
;
points
.
push
(
new
THREE
.
Vector3
(
pointUI
.
x
.
getValue
(),
pointUI
.
y
.
getValue
(),
pointUI
.
z
.
getValue
()
)
);
++
count
;
pointUI
.
lbl
.
setValue
(
count
);
}
...
...
@@ -703,7 +705,7 @@ UIPoints3.prototype.createPointRow = function ( x, y, z ) {
}
);
this
.
pointspush
(
{
row
:
pointRow
,
lbl
:
lbl
,
x
:
txtX
,
y
:
txtY
,
z
:
txtZ
}
);
this
.
points
UI
.
push
(
{
row
:
pointRow
,
lbl
:
lbl
,
x
:
txtX
,
y
:
txtY
,
z
:
txtZ
}
);
++
this
.
lastPointIdx
;
pointRow
.
add
(
lbl
,
txtX
,
txtY
,
txtZ
,
btn
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录