Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
11853e87
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,发现更多精彩内容 >>
提交
11853e87
编写于
11月 22, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI.Number: Keep float intact.
上级
39fb2745
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
15 deletion
+31
-15
editor/js/libs/ui.js
editor/js/libs/ui.js
+31
-15
未找到文件。
editor/js/libs/ui.js
浏览文件 @
11853e87
...
...
@@ -645,6 +645,8 @@ UI.Number = function ( number ) {
},
false
);
this
.
value
=
0
;
this
.
min
=
-
Infinity
;
this
.
max
=
Infinity
;
...
...
@@ -652,6 +654,7 @@ UI.Number = function ( number ) {
this
.
step
=
1
;
this
.
dom
=
dom
;
this
.
setValue
(
number
);
var
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
...
...
@@ -669,7 +672,7 @@ UI.Number = function ( number ) {
distance
=
0
;
onMouseDownValue
=
parseFloat
(
dom
.
value
)
;
onMouseDownValue
=
scope
.
value
;
prevPointer
=
[
event
.
clientX
,
event
.
clientY
];
...
...
@@ -680,17 +683,21 @@ UI.Number = function ( number ) {
function
onMouseMove
(
event
)
{
var
currentValue
=
dom
.
value
;
var
currentValue
=
scope
.
value
;
pointer
=
[
event
.
clientX
,
event
.
clientY
];
distance
+=
(
pointer
[
0
]
-
prevPointer
[
0
]
)
-
(
pointer
[
1
]
-
prevPointer
[
1
]
);
var
number
=
onMouseDownValue
+
(
distance
/
(
event
.
shiftKey
?
5
:
50
)
)
*
scope
.
step
;
var
value
=
onMouseDownValue
+
(
distance
/
(
event
.
shiftKey
?
5
:
50
)
)
*
scope
.
step
;
value
=
Math
.
min
(
scope
.
max
,
Math
.
max
(
scope
.
min
,
value
)
);
dom
.
value
=
Math
.
min
(
scope
.
max
,
Math
.
max
(
scope
.
min
,
number
)
).
toFixed
(
scope
.
precision
);
if
(
currentValue
!==
value
)
{
if
(
currentValue
!==
dom
.
value
)
dom
.
dispatchEvent
(
changeEvent
);
scope
.
setValue
(
value
);
dom
.
dispatchEvent
(
changeEvent
);
}
prevPointer
=
[
event
.
clientX
,
event
.
clientY
];
...
...
@@ -724,7 +731,7 @@ UI.Number = function ( number ) {
}
dom
.
value
=
parseFloat
(
value
);
scope
.
setValue
(
parseFloat
(
value
)
);
}
...
...
@@ -758,7 +765,7 @@ UI.Number.prototype.constructor = UI.Number;
UI
.
Number
.
prototype
.
getValue
=
function
()
{
return
parseFloat
(
this
.
dom
.
value
)
;
return
this
.
value
;
};
...
...
@@ -766,6 +773,7 @@ UI.Number.prototype.setValue = function ( value ) {
if
(
value
!==
undefined
)
{
this
.
value
=
value
;
this
.
dom
.
value
=
value
.
toFixed
(
this
.
precision
);
}
...
...
@@ -802,7 +810,7 @@ UI.Integer = function ( number ) {
var
dom
=
document
.
createElement
(
'
input
'
);
dom
.
className
=
'
Number
'
;
dom
.
value
=
'
0
.00
'
;
dom
.
value
=
'
0
'
;
dom
.
addEventListener
(
'
keydown
'
,
function
(
event
)
{
...
...
@@ -810,12 +818,15 @@ UI.Integer = function ( number ) {
},
false
);
this
.
value
=
0
;
this
.
min
=
-
Infinity
;
this
.
max
=
Infinity
;
this
.
step
=
1
;
this
.
dom
=
dom
;
this
.
setValue
(
number
);
var
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
...
...
@@ -833,7 +844,7 @@ UI.Integer = function ( number ) {
distance
=
0
;
onMouseDownValue
=
parseFloat
(
dom
.
value
)
;
onMouseDownValue
=
scope
.
value
;
prevPointer
=
[
event
.
clientX
,
event
.
clientY
];
...
...
@@ -844,17 +855,21 @@ UI.Integer = function ( number ) {
function
onMouseMove
(
event
)
{
var
currentValue
=
dom
.
value
;
var
currentValue
=
scope
.
value
;
pointer
=
[
event
.
clientX
,
event
.
clientY
];
distance
+=
(
pointer
[
0
]
-
prevPointer
[
0
]
)
-
(
pointer
[
1
]
-
prevPointer
[
1
]
);
var
number
=
onMouseDownValue
+
(
distance
/
(
event
.
shiftKey
?
5
:
50
)
)
*
scope
.
step
;
var
value
=
onMouseDownValue
+
(
distance
/
(
event
.
shiftKey
?
5
:
50
)
)
*
scope
.
step
;
value
=
Math
.
min
(
scope
.
max
,
Math
.
max
(
scope
.
min
,
value
)
)
|
0
;
dom
.
value
=
Math
.
min
(
scope
.
max
,
Math
.
max
(
scope
.
min
,
number
)
)
|
0
;
if
(
currentValue
!==
value
)
{
if
(
currentValue
!==
dom
.
value
)
dom
.
dispatchEvent
(
changeEvent
);
scope
.
setValue
(
value
);
dom
.
dispatchEvent
(
changeEvent
);
}
prevPointer
=
[
event
.
clientX
,
event
.
clientY
];
...
...
@@ -888,7 +903,7 @@ UI.Integer = function ( number ) {
}
dom
.
value
=
parseInt
(
value
);
scope
.
setValue
(
value
);
}
...
...
@@ -922,7 +937,7 @@ UI.Integer.prototype.constructor = UI.Integer;
UI
.
Integer
.
prototype
.
getValue
=
function
()
{
return
parseInt
(
this
.
dom
.
value
)
;
return
this
.
value
;
};
...
...
@@ -930,6 +945,7 @@ UI.Integer.prototype.setValue = function ( value ) {
if
(
value
!==
undefined
)
{
this
.
value
=
value
|
0
;
this
.
dom
.
value
=
value
|
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录