Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
ab7c7251
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
ab7c7251
编写于
2月 21, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TrackballControls: Caching event.
上级
2856874d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
8 deletion
+12
-8
src/extras/controls/TrackballControls.js
src/extras/controls/TrackballControls.js
+12
-8
未找到文件。
src/extras/controls/TrackballControls.js
浏览文件 @
ab7c7251
...
@@ -55,6 +55,10 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -55,6 +55,10 @@ THREE.TrackballControls = function ( object, domElement ) {
_panStart
=
new
THREE
.
Vector2
(),
_panStart
=
new
THREE
.
Vector2
(),
_panEnd
=
new
THREE
.
Vector2
();
_panEnd
=
new
THREE
.
Vector2
();
// events
var
changeEvent
=
{
type
:
'
change
'
};
// methods
// methods
...
@@ -68,7 +72,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -68,7 +72,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
};
this
.
getMouseOnScreen
=
function
(
clientX
,
clientY
)
{
this
.
getMouseOnScreen
=
function
(
clientX
,
clientY
)
{
return
new
THREE
.
Vector2
(
return
new
THREE
.
Vector2
(
(
clientX
-
_this
.
screen
.
offsetLeft
)
/
_this
.
radius
*
0.5
,
(
clientX
-
_this
.
screen
.
offsetLeft
)
/
_this
.
radius
*
0.5
,
...
@@ -77,7 +81,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -77,7 +81,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
};
this
.
getMouseProjectionOnBall
=
function
(
clientX
,
clientY
)
{
this
.
getMouseProjectionOnBall
=
function
(
clientX
,
clientY
)
{
var
mouseOnBall
=
new
THREE
.
Vector3
(
var
mouseOnBall
=
new
THREE
.
Vector3
(
(
clientX
-
_this
.
screen
.
width
*
0.5
-
_this
.
screen
.
offsetLeft
)
/
_this
.
radius
,
(
clientX
-
_this
.
screen
.
width
*
0.5
-
_this
.
screen
.
offsetLeft
)
/
_this
.
radius
,
...
@@ -107,7 +111,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -107,7 +111,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
};
this
.
rotateCamera
=
function
()
{
this
.
rotateCamera
=
function
()
{
var
angle
=
Math
.
acos
(
_rotateStart
.
dot
(
_rotateEnd
)
/
_rotateStart
.
length
()
/
_rotateEnd
.
length
()
);
var
angle
=
Math
.
acos
(
_rotateStart
.
dot
(
_rotateEnd
)
/
_rotateStart
.
length
()
/
_rotateEnd
.
length
()
);
...
@@ -140,7 +144,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -140,7 +144,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
};
this
.
zoomCamera
=
function
()
{
this
.
zoomCamera
=
function
()
{
var
factor
=
1.0
+
(
_zoomEnd
.
y
-
_zoomStart
.
y
)
*
_this
.
zoomSpeed
;
var
factor
=
1.0
+
(
_zoomEnd
.
y
-
_zoomStart
.
y
)
*
_this
.
zoomSpeed
;
...
@@ -162,7 +166,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -162,7 +166,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
};
this
.
panCamera
=
function
()
{
this
.
panCamera
=
function
()
{
var
mouseChange
=
_panEnd
.
clone
().
subSelf
(
_panStart
);
var
mouseChange
=
_panEnd
.
clone
().
subSelf
(
_panStart
);
...
@@ -190,7 +194,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -190,7 +194,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
};
this
.
checkDistances
=
function
()
{
this
.
checkDistances
=
function
()
{
if
(
!
_this
.
noZoom
||
!
_this
.
noPan
)
{
if
(
!
_this
.
noZoom
||
!
_this
.
noPan
)
{
...
@@ -210,7 +214,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -210,7 +214,7 @@ THREE.TrackballControls = function ( object, domElement ) {
};
};
this
.
update
=
function
()
{
this
.
update
=
function
()
{
_eye
.
copy
(
_this
.
object
.
position
).
subSelf
(
_this
.
target
);
_eye
.
copy
(
_this
.
object
.
position
).
subSelf
(
_this
.
target
);
...
@@ -240,7 +244,7 @@ THREE.TrackballControls = function ( object, domElement ) {
...
@@ -240,7 +244,7 @@ THREE.TrackballControls = function ( object, domElement ) {
if
(
lastPosition
.
distanceTo
(
_this
.
object
.
position
)
>
0
)
{
if
(
lastPosition
.
distanceTo
(
_this
.
object
.
position
)
>
0
)
{
_this
.
dispatchEvent
(
{
type
:
'
change
'
}
);
_this
.
dispatchEvent
(
changeEvent
);
lastPosition
.
copy
(
_this
.
object
.
position
);
lastPosition
.
copy
(
_this
.
object
.
position
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录