Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
5c760e72
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,发现更多精彩内容 >>
提交
5c760e72
编写于
1月 22, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OrbitControls: Code clean up and addressed concerns raised in #3989.
上级
f00cddac
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
35 deletion
+25
-35
examples/js/controls/OrbitControls.js
examples/js/controls/OrbitControls.js
+25
-35
未找到文件。
examples/js/controls/OrbitControls.js
浏览文件 @
5c760e72
...
...
@@ -282,25 +282,25 @@ THREE.OrbitControls = function ( object, domElement ) {
function
onMouseDown
(
event
)
{
if
(
scope
.
enabled
===
false
)
{
return
;
}
if
(
scope
.
enabled
===
false
)
return
;
event
.
preventDefault
();
if
(
event
.
button
===
0
)
{
if
(
scope
.
noRotate
===
true
)
{
return
;
}
if
(
scope
.
noRotate
===
true
)
return
;
state
=
STATE
.
ROTATE
;
rotateStart
.
set
(
event
.
clientX
,
event
.
clientY
);
}
else
if
(
event
.
button
===
1
)
{
if
(
scope
.
noZoom
===
true
)
{
return
;
}
if
(
scope
.
noZoom
===
true
)
return
;
state
=
STATE
.
DOLLY
;
dollyStart
.
set
(
event
.
clientX
,
event
.
clientY
);
}
else
if
(
event
.
button
===
2
)
{
if
(
scope
.
noPan
===
true
)
{
return
;
}
if
(
scope
.
noPan
===
true
)
return
;
state
=
STATE
.
PAN
;
...
...
@@ -389,13 +389,15 @@ THREE.OrbitControls = function ( object, domElement ) {
if
(
scope
.
enabled
===
false
||
scope
.
noZoom
===
true
)
return
;
event
.
preventDefault
();
var
delta
=
0
;
if
(
event
.
wheelDelta
)
{
// WebKit / Opera / Explorer 9
if
(
event
.
wheelDelta
!==
undefined
)
{
// WebKit / Opera / Explorer 9
delta
=
event
.
wheelDelta
;
}
else
if
(
event
.
detail
)
{
// Firefox
}
else
if
(
event
.
detail
!==
undefined
)
{
// Firefox
delta
=
-
event
.
detail
;
...
...
@@ -417,38 +419,26 @@ THREE.OrbitControls = function ( object, domElement ) {
function
onKeyDown
(
event
)
{
if
(
scope
.
enabled
===
false
)
{
return
;
}
if
(
scope
.
noKeys
===
true
)
{
return
;
}
if
(
scope
.
noPan
===
true
)
{
return
;
}
// pan a pixel - I guess for precise positioning?
// Greggman fix: https://github.com/greggman/three.js/commit/fde9f9917d6d8381f06bf22cdff766029d1761be
var
needUpdate
=
false
;
if
(
scope
.
enabled
===
false
||
scope
.
noKeys
===
true
||
scope
.
noPan
===
true
)
return
;
switch
(
event
.
keyCode
)
{
case
scope
.
keys
.
UP
:
scope
.
pan
(
new
THREE
.
Vector2
(
0
,
scope
.
keyPanSpeed
)
);
needUpdate
=
true
;
scope
.
update
()
;
break
;
case
scope
.
keys
.
BOTTOM
:
scope
.
pan
(
new
THREE
.
Vector2
(
0
,
-
scope
.
keyPanSpeed
)
);
needUpdate
=
true
;
scope
.
update
()
;
break
;
case
scope
.
keys
.
LEFT
:
scope
.
pan
(
new
THREE
.
Vector2
(
scope
.
keyPanSpeed
,
0
)
);
needUpdate
=
true
;
scope
.
update
()
;
break
;
case
scope
.
keys
.
RIGHT
:
scope
.
pan
(
new
THREE
.
Vector2
(
-
scope
.
keyPanSpeed
,
0
)
);
needUpdate
=
true
;
scope
.
update
()
;
break
;
}
// Greggman fix: https://github.com/greggman/three.js/commit/fde9f9917d6d8381f06bf22cdff766029d1761be
if
(
needUpdate
)
{
scope
.
update
();
}
...
...
@@ -456,12 +446,12 @@ THREE.OrbitControls = function ( object, domElement ) {
function
touchstart
(
event
)
{
if
(
scope
.
enabled
===
false
)
{
return
;
}
if
(
scope
.
enabled
===
false
)
return
;
switch
(
event
.
touches
.
length
)
{
case
1
:
// one-fingered touch: rotate
if
(
scope
.
noRotate
===
true
)
{
return
;
}
if
(
scope
.
noRotate
===
true
)
return
;
state
=
STATE
.
TOUCH_ROTATE
;
...
...
@@ -469,7 +459,7 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
2
:
// two-fingered touch: dolly
if
(
scope
.
noZoom
===
true
)
{
return
;
}
if
(
scope
.
noZoom
===
true
)
return
;
state
=
STATE
.
TOUCH_DOLLY
;
...
...
@@ -480,7 +470,7 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
3
:
// three-fingered touch: pan
if
(
scope
.
noPan
===
true
)
{
return
;
}
if
(
scope
.
noPan
===
true
)
return
;
state
=
STATE
.
TOUCH_PAN
;
...
...
@@ -495,7 +485,7 @@ THREE.OrbitControls = function ( object, domElement ) {
function
touchmove
(
event
)
{
if
(
scope
.
enabled
===
false
)
{
return
;
}
if
(
scope
.
enabled
===
false
)
return
;
event
.
preventDefault
();
event
.
stopPropagation
();
...
...
@@ -507,8 +497,8 @@ THREE.OrbitControls = function ( object, domElement ) {
switch
(
event
.
touches
.
length
)
{
case
1
:
// one-fingered touch: rotate
if
(
scope
.
noRotate
===
true
)
{
return
;
}
if
(
state
!==
STATE
.
TOUCH_ROTATE
)
{
return
;
}
if
(
scope
.
noRotate
===
true
)
return
;
if
(
state
!==
STATE
.
TOUCH_ROTATE
)
return
;
rotateEnd
.
set
(
event
.
touches
[
0
].
pageX
,
event
.
touches
[
0
].
pageY
);
rotateDelta
.
subVectors
(
rotateEnd
,
rotateStart
);
...
...
@@ -524,8 +514,8 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
2
:
// two-fingered touch: dolly
if
(
scope
.
noZoom
===
true
)
{
return
;
}
if
(
state
!==
STATE
.
TOUCH_DOLLY
)
{
return
;
}
if
(
scope
.
noZoom
===
true
)
return
;
if
(
state
!==
STATE
.
TOUCH_DOLLY
)
return
;
var
dx
=
event
.
touches
[
0
].
pageX
-
event
.
touches
[
1
].
pageX
;
var
dy
=
event
.
touches
[
0
].
pageY
-
event
.
touches
[
1
].
pageY
;
...
...
@@ -550,8 +540,8 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
3
:
// three-fingered touch: pan
if
(
scope
.
noPan
===
true
)
{
return
;
}
if
(
state
!==
STATE
.
TOUCH_PAN
)
{
return
;
}
if
(
scope
.
noPan
===
true
)
return
;
if
(
state
!==
STATE
.
TOUCH_PAN
)
return
;
panEnd
.
set
(
event
.
touches
[
0
].
pageX
,
event
.
touches
[
0
].
pageY
);
panDelta
.
subVectors
(
panEnd
,
panStart
);
...
...
@@ -578,7 +568,7 @@ THREE.OrbitControls = function ( object, domElement ) {
function
touchend
(
/* event */
)
{
if
(
scope
.
enabled
===
false
)
{
return
;
}
if
(
scope
.
enabled
===
false
)
return
;
state
=
STATE
.
NONE
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录