Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
18bc4986
Commit
18bc4986
authored
Feb 22, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
补注释
parent
17d20b9c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
hand.js
src/module/hand.js
+16
-4
No files found.
src/module/hand.js
View file @
18bc4986
...
@@ -25,30 +25,42 @@ var ViewDragger = kity.createClass( "ViewDragger", {
...
@@ -25,30 +25,42 @@ var ViewDragger = kity.createClass( "ViewDragger", {
lastPosition
=
null
;
lastPosition
=
null
;
this
.
_minder
.
on
(
'beforemousedown'
,
function
(
e
)
{
this
.
_minder
.
on
(
'beforemousedown'
,
function
(
e
)
{
// 已经被用户打开拖放模式
if
(
dragger
.
isEnabled
()
)
{
if
(
dragger
.
isEnabled
()
)
{
startPosition
=
e
.
getPosition
();
startPosition
=
e
.
getPosition
();
e
.
stopPropagation
();
e
.
stopPropagation
();
}
else
if
(
!
this
.
getRoot
().
isSelected
()
&&
e
.
getTargetNode
()
==
this
.
getRoot
()
)
{
}
// 点击未选中的根节点临时开启
else
if
(
!
this
.
getRoot
().
isSelected
()
&&
e
.
getTargetNode
()
==
this
.
getRoot
()
)
{
startPosition
=
e
.
getPosition
();
startPosition
=
e
.
getPosition
();
dragger
.
setEnabled
(
true
);
dragger
.
setEnabled
(
true
);
isRootDrag
=
true
;
isRootDrag
=
true
;
}
}
}
).
on
(
'beforemousemove'
,
function
(
e
)
{
}
)
.
on
(
'beforemousemove'
,
function
(
e
)
{
if
(
startPosition
)
{
if
(
startPosition
)
{
lastPosition
=
e
.
getPosition
();
lastPosition
=
e
.
getPosition
();
// 当前偏移加上历史偏移
var
offset
=
kity
.
Vector
.
fromPoints
(
startPosition
,
lastPosition
);
var
offset
=
kity
.
Vector
.
fromPoints
(
startPosition
,
lastPosition
);
offset
=
kity
.
Vector
.
add
(
dragger
.
_offset
,
offset
);
offset
=
kity
.
Vector
.
add
(
dragger
.
_offset
,
offset
);
this
.
getRenderContainer
().
setTransform
(
new
kity
.
Matrix
().
translate
(
offset
.
x
,
offset
.
y
)
);
this
.
getRenderContainer
().
setTransform
(
new
kity
.
Matrix
().
translate
(
offset
.
x
,
offset
.
y
)
);
e
.
stopPropagation
();
e
.
stopPropagation
();
}
}
}
).
on
(
'mouseup'
,
function
(
e
)
{
}
)
.
on
(
'mouseup'
,
function
(
e
)
{
if
(
startPosition
&&
lastPosition
)
{
if
(
startPosition
&&
lastPosition
)
{
// 合并更改的偏移到历史偏移
dragger
.
_offset
.
x
+=
lastPosition
.
x
-
startPosition
.
x
;
dragger
.
_offset
.
x
+=
lastPosition
.
x
-
startPosition
.
x
;
dragger
.
_offset
.
y
+=
lastPosition
.
y
-
startPosition
.
y
;
dragger
.
_offset
.
y
+=
lastPosition
.
y
-
startPosition
.
y
;
}
}
startPosition
=
null
;
startPosition
=
null
;
// 临时拖动需要还原状态
if
(
isRootDrag
)
{
if
(
isRootDrag
)
{
dragger
.
setEnabled
(
false
);
dragger
.
setEnabled
(
false
);
isRootDrag
=
false
;
isRootDrag
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment