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
bf1ae615
Commit
bf1ae615
authored
Feb 22, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into gh-pages
parents
de0293e2
e02893e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
5 deletions
+24
-5
.jshintrc
.jshintrc
+2
-1
saveto.js
src/adapter/saveto.js
+2
-1
dragtree.js
src/module/dragtree.js
+20
-3
No files found.
.jshintrc
View file @
bf1ae615
...
...
@@ -23,6 +23,7 @@
"utils",
"$",
"KM",
"keymap"
"keymap",
"baidu"
]
}
\ No newline at end of file
src/adapter/saveto.js
View file @
bf1ae615
...
...
@@ -9,7 +9,8 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
items
:
[],
itemStyles
:
[],
value
:
[],
autowidthitem
:
[]
autowidthitem
:
[],
enabledRecord
:
false
},
$combox
=
null
,
comboboxWidget
=
null
;
...
...
src/module/dragtree.js
View file @
bf1ae615
...
...
@@ -79,6 +79,12 @@ var DragBox = kity.createClass( "DragBox", {
ancestors
=
[],
judge
;
// 根节点不参与计算
var
rootIndex
=
nodes
.
indexOf
(
this
.
_minder
.
getRoot
()
);
if
(
~
rootIndex
)
{
nodes
.
splice
(
rootIndex
,
1
);
}
// 判断 nodes 列表中是否存在 judge 的祖先
function
hasAncestor
(
nodes
,
judge
)
{
for
(
var
i
=
nodes
.
length
-
1
;
i
>=
0
;
--
i
)
{
...
...
@@ -137,10 +143,15 @@ var DragBox = kity.createClass( "DragBox", {
// 4. 标记已启动
_enterDragMode
:
function
()
{
this
.
_calcDragSources
();
if
(
!
this
.
_dragSources
.
length
)
{
this
.
_startPosition
=
null
;
return
false
;
}
this
.
_calcDropTargets
();
this
.
_drawForDragMode
();
this
.
_shrink
();
this
.
_dragMode
=
true
;
return
true
;
},
_leaveDragMode
:
function
()
{
this
.
remove
();
...
...
@@ -227,16 +238,21 @@ var DragBox = kity.createClass( "DragBox", {
},
dragMove
:
function
(
position
)
{
// 启动拖放模式需要最小的移动距离
var
DRAG_MOVE_THRESHOLD
=
10
;
if
(
!
this
.
_startPosition
)
return
;
this
.
_dragPosition
=
position
;
if
(
!
this
.
_dragMode
)
{
// 判断拖放模式是否该启动
if
(
GM
.
getDistance
(
this
.
_dragPosition
,
this
.
_startPosition
)
<
10
)
{
if
(
GM
.
getDistance
(
this
.
_dragPosition
,
this
.
_startPosition
)
<
DRAG_MOVE_THRESHOLD
)
{
return
;
}
if
(
!
this
.
_enterDragMode
()
)
{
return
;
}
this
.
_enterDragMode
();
}
var
movement
=
kity
.
Vector
.
fromPoints
(
this
.
_startPosition
,
this
.
_dragPosition
);
...
...
@@ -269,7 +285,8 @@ KityMinder.registerModule( "DragTree", function () {
},
events
:
{
mousedown
:
function
(
e
)
{
if
(
e
.
getTargetNode
()
)
{
// 单选中根节点也不触发拖拽
if
(
e
.
getTargetNode
()
&&
e
.
getTargetNode
()
!=
this
.
getRoot
()
)
{
this
.
_dragBox
.
dragStart
(
e
.
getPosition
()
);
}
},
...
...
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