Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
f27cb02d
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,发现更多精彩内容 >>
未验证
提交
f27cb02d
编写于
7月 02, 2019
作者:
G
Guilherme Avila
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OrbitControls: constants
上级
08306365
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
61 addition
and
56 deletion
+61
-56
docs/examples/en/controls/OrbitControls.html
docs/examples/en/controls/OrbitControls.html
+5
-5
examples/js/controls/OrbitControls.js
examples/js/controls/OrbitControls.js
+18
-15
examples/jsm/controls/OrbitControls.d.ts
examples/jsm/controls/OrbitControls.d.ts
+18
-5
examples/jsm/controls/OrbitControls.js
examples/jsm/controls/OrbitControls.js
+18
-17
src/constants.d.ts
src/constants.d.ts
+0
-10
src/constants.js
src/constants.js
+1
-2
test/unit/src/constants.tests.js
test/unit/src/constants.tests.js
+1
-2
未找到文件。
docs/examples/en/controls/OrbitControls.html
浏览文件 @
f27cb02d
...
...
@@ -190,9 +190,9 @@ controls.keys = {
This object contains references to the mouse actions used by the controls.
<code>
controls.mouseButtons = {
LEFT: THREE.
MOUSE
.ROTATE,
MIDDLE: THREE.
MOUSE
.DOLLY,
RIGHT: THREE.
MOUSE
.PAN
LEFT: THREE.
OrbitControls.CLICK
.ROTATE,
MIDDLE: THREE.
OrbitControls.CLICK
.DOLLY,
RIGHT: THREE.
OrbitControls.CLICK
.PAN
}
</code>
</p>
...
...
@@ -239,8 +239,8 @@ controls.mouseButtons = {
This object contains references to the touch actions used by the controls.
<code>
controls.touches = {
ONE: THREE.TOUCH.ROTATE,
TWO: THREE.TOUCH.DOLLY_PAN
ONE: THREE.
OrbitControls.
TOUCH.ROTATE,
TWO: THREE.
OrbitControls.
TOUCH.DOLLY_PAN
}
</code>
</p>
...
...
examples/js/controls/OrbitControls.js
浏览文件 @
f27cb02d
...
...
@@ -76,10 +76,10 @@ THREE.OrbitControls = function ( object, domElement ) {
this
.
keys
=
{
LEFT
:
37
,
UP
:
38
,
RIGHT
:
39
,
BOTTOM
:
40
};
// Mouse buttons
this
.
mouseButtons
=
{
LEFT
:
THREE
.
MOUSE
.
ROTATE
,
MIDDLE
:
THREE
.
MOUSE
.
DOLLY
,
RIGHT
:
THREE
.
MOUSE
.
PAN
};
this
.
mouseButtons
=
{
LEFT
:
THREE
.
OrbitControls
.
CLICK
.
ROTATE
,
MIDDLE
:
THREE
.
OrbitControls
.
CLICK
.
DOLLY
,
RIGHT
:
THREE
.
OrbitControls
.
CLICK
.
PAN
};
// Touch fingers
this
.
touches
=
{
ONE
:
THREE
.
TOUCH
.
ROTATE
,
TWO
:
THREE
.
TOUCH
.
DOLLY_PAN
};
this
.
touches
=
{
ONE
:
THREE
.
OrbitControls
.
TOUCH
.
ROTATE
,
TWO
:
THREE
.
OrbitControls
.
TOUCH
.
DOLLY_PAN
};
// for reset
this
.
target0
=
this
.
target
.
clone
();
...
...
@@ -791,7 +791,7 @@ THREE.OrbitControls = function ( object, domElement ) {
switch
(
scope
.
mouseButtons
.
LEFT
)
{
case
THREE
.
MOUSE
.
ROTATE
:
case
THREE
.
OrbitControls
.
CLICK
.
ROTATE
:
if
(
event
.
ctrlKey
||
event
.
metaKey
||
event
.
shiftKey
)
{
...
...
@@ -813,7 +813,7 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
THREE
.
MOUSE
.
PAN
:
case
THREE
.
OrbitControls
.
CLICK
.
PAN
:
if
(
event
.
ctrlKey
||
event
.
metaKey
||
event
.
shiftKey
)
{
...
...
@@ -848,7 +848,7 @@ THREE.OrbitControls = function ( object, domElement ) {
switch
(
scope
.
mouseButtons
.
MIDDLE
)
{
case
THREE
.
MOUSE
.
DOLLY
:
case
THREE
.
OrbitControls
.
CLICK
.
DOLLY
:
if
(
scope
.
enableZoom
===
false
)
return
;
...
...
@@ -871,7 +871,7 @@ THREE.OrbitControls = function ( object, domElement ) {
switch
(
scope
.
mouseButtons
.
RIGHT
)
{
case
THREE
.
MOUSE
.
ROTATE
:
case
THREE
.
OrbitControls
.
CLICK
.
ROTATE
:
if
(
scope
.
enableRotate
===
false
)
return
;
...
...
@@ -881,7 +881,7 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
THREE
.
MOUSE
.
PAN
:
case
THREE
.
OrbitControls
.
CLICK
.
PAN
:
if
(
scope
.
enablePan
===
false
)
return
;
...
...
@@ -998,7 +998,7 @@ THREE.OrbitControls = function ( object, domElement ) {
switch
(
scope
.
touches
.
ONE
)
{
case
TOUCH
.
ROTATE
:
case
T
HREE
.
OrbitControls
.
T
OUCH
.
ROTATE
:
if
(
scope
.
enableRotate
===
false
)
return
;
...
...
@@ -1008,7 +1008,7 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
TOUCH
.
PAN
:
case
T
HREE
.
OrbitControls
.
T
OUCH
.
PAN
:
if
(
scope
.
enablePan
===
false
)
return
;
...
...
@@ -1030,7 +1030,7 @@ THREE.OrbitControls = function ( object, domElement ) {
switch
(
scope
.
touches
.
TWO
)
{
case
TOUCH
.
DOLLY_PAN
:
case
T
HREE
.
OrbitControls
.
T
OUCH
.
DOLLY_PAN
:
if
(
scope
.
enableZoom
===
false
&&
scope
.
enablePan
===
false
)
return
;
...
...
@@ -1040,7 +1040,7 @@ THREE.OrbitControls = function ( object, domElement ) {
break
;
case
TOUCH
.
DOLLY_ROTATE
:
case
T
HREE
.
OrbitControls
.
T
OUCH
.
DOLLY_ROTATE
:
if
(
scope
.
enableZoom
===
false
&&
scope
.
enableRotate
===
false
)
return
;
...
...
@@ -1168,6 +1168,9 @@ THREE.OrbitControls = function ( object, domElement ) {
};
THREE
.
OrbitControls
.
CLICK
=
{
ROTATE
:
0
,
DOLLY
:
1
,
PAN
:
2
};
THREE
.
OrbitControls
.
TOUCH
=
{
ROTATE
:
0
,
PAN
:
1
,
DOLLY_PAN
:
2
,
DOLLY_ROTATE
:
3
};
THREE
.
OrbitControls
.
prototype
=
Object
.
create
(
THREE
.
EventDispatcher
.
prototype
);
THREE
.
OrbitControls
.
prototype
.
constructor
=
THREE
.
OrbitControls
;
...
...
@@ -1308,11 +1311,11 @@ THREE.MapControls = function ( object, domElement ) {
THREE
.
OrbitControls
.
call
(
this
,
object
,
domElement
);
this
.
mouseButtons
.
LEFT
=
THREE
.
MOUSE
.
PAN
;
this
.
mouseButtons
.
RIGHT
=
THREE
.
MOUSE
.
ROTATE
;
this
.
mouseButtons
.
LEFT
=
THREE
.
OrbitControls
.
CLICK
.
PAN
;
this
.
mouseButtons
.
RIGHT
=
THREE
.
OrbitControls
.
CLICK
.
ROTATE
;
this
.
touches
.
ONE
=
THREE
.
TOUCH
.
PAN
;
this
.
touches
.
TWO
=
THREE
.
TOUCH
.
DOLLY_ROTATE
;
this
.
touches
.
ONE
=
THREE
.
OrbitControls
.
TOUCH
.
PAN
;
this
.
touches
.
TWO
=
THREE
.
OrbitControls
.
TOUCH
.
DOLLY_ROTATE
;
}
...
...
examples/jsm/controls/OrbitControls.d.ts
浏览文件 @
f27cb02d
import
{
Camera
,
MOUSE
,
Object3D
,
TOUCH
,
Vector3
}
from
'
../../../src/Three
'
;
import
{
Camera
,
Object3D
,
Vector3
}
from
'
../../../src/Three
'
;
export
class
OrbitControls
{
constructor
(
object
:
Camera
,
domElement
?:
HTMLElement
);
...
...
@@ -44,8 +44,21 @@ export class OrbitControls {
enableKeys
:
boolean
;
keys
:
{
LEFT
:
number
;
UP
:
number
;
RIGHT
:
number
;
BOTTOM
:
number
;
};
mouseButtons
:
{
LEFT
:
MOUSE
;
MIDDLE
:
MOUSE
;
RIGHT
:
MOUSE
;
};
touches
:
{
ONE
:
TOUCH
;
TWO
:
TOUCH
};
mouseButtons
:
{
LEFT
:
number
;
MIDDLE
:
number
;
RIGHT
:
number
;
};
touches
:
{
ONE
:
number
;
TWO
:
number
};
static
CLICK
:
{
ROTATE
:
number
;
DOLLY
:
number
;
PAN
:
number
;
};
static
TOUCH
:
{
ROTATE
:
number
;
PAN
:
number
;
DOLLY_PAN
:
number
;
DOLLY_ROTATE
:
number
;
};
rotateLeft
(
angle
?:
number
):
void
;
...
...
@@ -125,8 +138,8 @@ export class MapControls {
enableKeys
:
boolean
;
keys
:
{
LEFT
:
number
;
UP
:
number
;
RIGHT
:
number
;
BOTTOM
:
number
;
};
mouseButtons
:
{
LEFT
:
MOUSE
;
MIDDLE
:
MOUSE
;
RIGHT
:
MOUSE
;
};
touches
:
{
ONE
:
TOUCH
;
TWO
:
TOUCH
};
mouseButtons
:
{
LEFT
:
number
;
MIDDLE
:
number
;
RIGHT
:
number
;
};
touches
:
{
ONE
:
number
;
TWO
:
number
};
rotateLeft
(
angle
?:
number
):
void
;
...
...
examples/jsm/controls/OrbitControls.js
浏览文件 @
f27cb02d
...
...
@@ -9,10 +9,8 @@
import
{
EventDispatcher
,
MOUSE
,
Quaternion
,
Spherical
,
TOUCH
,
Vector2
,
Vector3
}
from
"
../../../build/three.module.js
"
;
...
...
@@ -86,10 +84,10 @@ var OrbitControls = function ( object, domElement ) {
this
.
keys
=
{
LEFT
:
37
,
UP
:
38
,
RIGHT
:
39
,
BOTTOM
:
40
};
// Mouse buttons
this
.
mouseButtons
=
{
LEFT
:
MOUSE
.
ROTATE
,
MIDDLE
:
MOUSE
.
DOLLY
,
RIGHT
:
MOUSE
.
PAN
};
this
.
mouseButtons
=
{
LEFT
:
OrbitControls
.
CLICK
.
ROTATE
,
MIDDLE
:
OrbitControls
.
CLICK
.
DOLLY
,
RIGHT
:
OrbitControls
.
CLICK
.
PAN
};
// Touch fingers
this
.
touches
=
{
ONE
:
TOUCH
.
ROTATE
,
TWO
:
TOUCH
.
DOLLY_PAN
};
this
.
touches
=
{
ONE
:
OrbitControls
.
TOUCH
.
ROTATE
,
TWO
:
OrbitControls
.
TOUCH
.
DOLLY_PAN
};
// for reset
this
.
target0
=
this
.
target
.
clone
();
...
...
@@ -801,7 +799,7 @@ var OrbitControls = function ( object, domElement ) {
switch
(
scope
.
mouseButtons
.
LEFT
)
{
case
MOUSE
.
ROTATE
:
case
OrbitControls
.
CLICK
.
ROTATE
:
if
(
event
.
ctrlKey
||
event
.
metaKey
||
event
.
shiftKey
)
{
...
...
@@ -823,7 +821,7 @@ var OrbitControls = function ( object, domElement ) {
break
;
case
MOUSE
.
PAN
:
case
OrbitControls
.
CLICK
.
PAN
:
if
(
event
.
ctrlKey
||
event
.
metaKey
||
event
.
shiftKey
)
{
...
...
@@ -858,7 +856,7 @@ var OrbitControls = function ( object, domElement ) {
switch
(
scope
.
mouseButtons
.
MIDDLE
)
{
case
MOUSE
.
DOLLY
:
case
OrbitControls
.
CLICK
.
DOLLY
:
if
(
scope
.
enableZoom
===
false
)
return
;
...
...
@@ -881,7 +879,7 @@ var OrbitControls = function ( object, domElement ) {
switch
(
scope
.
mouseButtons
.
RIGHT
)
{
case
MOUSE
.
ROTATE
:
case
OrbitControls
.
CLICK
.
ROTATE
:
if
(
scope
.
enableRotate
===
false
)
return
;
...
...
@@ -891,7 +889,7 @@ var OrbitControls = function ( object, domElement ) {
break
;
case
MOUSE
.
PAN
:
case
OrbitControls
.
CLICK
.
PAN
:
if
(
scope
.
enablePan
===
false
)
return
;
...
...
@@ -1008,7 +1006,7 @@ var OrbitControls = function ( object, domElement ) {
switch
(
scope
.
touches
.
ONE
)
{
case
TOUCH
.
ROTATE
:
case
OrbitControls
.
TOUCH
.
ROTATE
:
if
(
scope
.
enableRotate
===
false
)
return
;
...
...
@@ -1018,7 +1016,7 @@ var OrbitControls = function ( object, domElement ) {
break
;
case
TOUCH
.
PAN
:
case
OrbitControls
.
TOUCH
.
PAN
:
if
(
scope
.
enablePan
===
false
)
return
;
...
...
@@ -1040,7 +1038,7 @@ var OrbitControls = function ( object, domElement ) {
switch
(
scope
.
touches
.
TWO
)
{
case
TOUCH
.
DOLLY_PAN
:
case
OrbitControls
.
TOUCH
.
DOLLY_PAN
:
if
(
scope
.
enableZoom
===
false
&&
scope
.
enablePan
===
false
)
return
;
...
...
@@ -1050,7 +1048,7 @@ var OrbitControls = function ( object, domElement ) {
break
;
case
TOUCH
.
DOLLY_ROTATE
:
case
OrbitControls
.
TOUCH
.
DOLLY_ROTATE
:
if
(
scope
.
enableZoom
===
false
&&
scope
.
enableRotate
===
false
)
return
;
...
...
@@ -1178,6 +1176,9 @@ var OrbitControls = function ( object, domElement ) {
};
OrbitControls
.
CLICK
=
{
ROTATE
:
0
,
DOLLY
:
1
,
PAN
:
2
};
OrbitControls
.
TOUCH
=
{
ROTATE
:
0
,
PAN
:
1
,
DOLLY_PAN
:
2
,
DOLLY_ROTATE
:
3
};
OrbitControls
.
prototype
=
Object
.
create
(
EventDispatcher
.
prototype
);
OrbitControls
.
prototype
.
constructor
=
OrbitControls
;
...
...
@@ -1318,11 +1319,11 @@ var MapControls = function ( object, domElement ) {
OrbitControls
.
call
(
this
,
object
,
domElement
);
this
.
mouseButtons
.
LEFT
=
MOUSE
.
PAN
;
this
.
mouseButtons
.
RIGHT
=
MOUSE
.
ROTATE
;
this
.
mouseButtons
.
LEFT
=
OrbitControls
.
CLICK
.
PAN
;
this
.
mouseButtons
.
RIGHT
=
OrbitControls
.
CLICK
.
ROTATE
;
this
.
touches
.
ONE
=
TOUCH
.
PAN
;
this
.
touches
.
TWO
=
TOUCH
.
DOLLY_ROTATE
;
this
.
touches
.
ONE
=
OrbitControls
.
TOUCH
.
PAN
;
this
.
touches
.
TWO
=
OrbitControls
.
TOUCH
.
DOLLY_ROTATE
;
}
...
...
src/constants.d.ts
浏览文件 @
f27cb02d
...
...
@@ -5,16 +5,6 @@ export enum MOUSE {
LEFT
,
MIDDLE
,
RIGHT
,
ROTATE
,
DOLLY
,
PAN
,
}
export
enum
TOUCH
{
ROTATE
,
PAN
,
DOLLY_PAN
,
DOLLY_ROTATE
,
}
// GL STATE CONSTANTS
...
...
src/constants.js
浏览文件 @
f27cb02d
export
var
REVISION
=
'
106
'
;
export
var
MOUSE
=
{
LEFT
:
0
,
MIDDLE
:
1
,
RIGHT
:
2
,
ROTATE
:
0
,
DOLLY
:
1
,
PAN
:
2
};
export
var
TOUCH
=
{
ROTATE
:
0
,
PAN
:
1
,
DOLLY_PAN
:
2
,
DOLLY_ROTATE
:
3
};
export
var
MOUSE
=
{
LEFT
:
0
,
MIDDLE
:
1
,
RIGHT
:
2
};
export
var
CullFaceNone
=
0
;
export
var
CullFaceBack
=
1
;
export
var
CullFaceFront
=
2
;
...
...
test/unit/src/constants.tests.js
浏览文件 @
f27cb02d
...
...
@@ -9,8 +9,7 @@ export default QUnit.module( 'Constants', () => {
QUnit
.
test
(
"
default values
"
,
(
assert
)
=>
{
assert
.
propEqual
(
Constants
.
MOUSE
,
{
LEFT
:
0
,
MIDDLE
:
1
,
RIGHT
:
2
,
ROTATE
:
0
,
DOLLY
:
1
,
PAN
:
2
},
'
MOUSE equal { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }
'
);
assert
.
propEqual
(
Constants
.
TOUCH
,
{
ROTATE
:
0
,
PAN
:
1
,
DOLLY_PAN
:
2
,
DOLLY_ROTATE
:
3
},
'
TOUCH equal { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }
'
);
assert
.
propEqual
(
Constants
.
MOUSE
,
{
LEFT
:
0
,
MIDDLE
:
1
,
RIGHT
:
2
},
'
MOUSE equal { LEFT: 0, MIDDLE: 1, RIGHT: 2 }
'
);
assert
.
equal
(
Constants
.
CullFaceNone
,
0
,
'
CullFaceNone equal 0
'
);
assert
.
equal
(
Constants
.
CullFaceBack
,
1
,
'
CullFaceBack equal 1
'
);
assert
.
equal
(
Constants
.
CullFaceFront
,
2
,
'
CullFaceFront is equal to 2
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录