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
f48b3d54
Commit
f48b3d54
authored
Feb 17, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
230e65df
e7bca98e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
9 deletions
+43
-9
minder.data.js
src/core/minder.data.js
+4
-2
dragtree.js
src/module/dragtree.js
+17
-3
geometry.js
src/module/geometry.js
+12
-0
select.js
src/module/select.js
+6
-2
json.js
src/protocal/json.js
+2
-1
plain.js
src/protocal/plain.js
+2
-1
No files found.
src/core/minder.data.js
View file @
f48b3d54
...
...
@@ -7,7 +7,9 @@ Utils.extend( KityMinder, {
return
KityMinder
.
_protocals
[
name
]
||
null
;
},
getSupportedProtocals
:
function
()
{
return
Utils
.
keys
(
KityMinder
.
_protocals
);
return
Utils
.
keys
(
KityMinder
.
_protocals
).
sort
(
function
(
a
,
b
)
{
return
KityMinder
.
_protocals
[
b
].
recognizePriority
-
KityMinder
.
_protocals
[
a
].
recognizePriority
;
});
},
getAllRegisteredProtocals
:
function
()
{
return
KityMinder
.
_protocals
;
...
...
@@ -70,7 +72,7 @@ kity.extendClass( Minder, {
if
(
test
.
recognize
&&
test
.
recognize
(
local
)
)
{
protocal
=
test
;
}
return
!
test
;
return
!
protocal
;
}
);
}
...
...
src/module/dragtree.js
View file @
f48b3d54
...
...
@@ -105,6 +105,14 @@ function findAvailableParents( nodes, root ) {
return
availables
;
}
var
lastActivedDropTarget
=
null
;
function
activeDropTarget
(
node
)
{
if
(
lastActivedDropTarget
!=
node
)
{
node
.
getRenderContainer
().
fxScale
(
1.6
,
1.6
,
200
,
'ease'
).
fxScale
(
1
/
1.6
,
1
/
1.6
,
300
,
'ease'
);
lastActivedDropTarget
=
node
;
}
}
KityMinder
.
registerModule
(
"DragTree"
,
function
()
{
var
dragStartPosition
,
dragBox
,
dragTargets
,
dropTargets
,
dragTargetBoxes
,
dropTarget
;
...
...
@@ -147,13 +155,18 @@ KityMinder.registerModule( "DragTree", function () {
dragBox
.
blue
();
dropTarget
=
null
;
}
dropTargets
.
forEach
(
function
(
test
)
{
if
(
GM
.
isBoxIntersect
(
dragBox
.
getRenderBox
(),
test
.
getRenderContainer
().
getRenderBox
()
)
)
{
if
(
!
dropTarget
&&
GM
.
isBoxIntersect
(
dragBox
.
getRenderBox
(),
test
.
getRenderContainer
().
getRenderBox
()
)
)
{
activeDropTarget
(
test
);
//test.getRenderContainer().scale( 1.25 );
dropTarget
=
test
;
dragBox
.
green
();
}
}
);
if
(
!
dropTarget
)
{
lastActivedDropTarget
=
null
;
}
},
mouseup
:
function
(
e
)
{
dragStartPosition
=
null
;
...
...
@@ -161,12 +174,13 @@ KityMinder.registerModule( "DragTree", function () {
dragBox
.
remove
();
dragBox
=
null
;
if
(
dropTarget
)
{
dragTargets
.
forEach
(
function
(
target
)
{
for
(
var
i
=
dragTargets
.
length
-
1
,
target
;
i
>=
0
;
i
--
)
{
target
=
dragTargets
[
i
];
if
(
target
.
parent
)
{
target
.
parent
.
removeChild
(
target
);
dropTarget
.
appendChild
(
target
);
}
}
);
}
this
.
removeAllSelectedNodes
();
this
.
initStyle
(
this
.
getRoot
()
);
}
...
...
src/module/geometry.js
View file @
f48b3d54
...
...
@@ -95,5 +95,17 @@ KityMinder.Geometry = ( function () {
return
unknown
;
};
g
.
expandBox
=
function
(
box
,
sizeX
,
sizeY
)
{
if
(
sizeY
===
undefined
)
{
sizeY
=
sizeX
;
}
return
wrapBox
(
{
left
:
box
.
left
-
sizeX
,
top
:
box
.
top
-
sizeY
,
right
:
box
.
right
+
sizeX
,
bottom
:
box
.
bottom
+
sizeY
}
);
};
return
g
;
}
)();
\ No newline at end of file
src/module/select.js
View file @
f48b3d54
...
...
@@ -73,6 +73,7 @@ KityMinder.registerModule( "Select", function () {
};
}
)();
var
singleSelectOnUp
=
null
;
return
{
"events"
:
{
mousedown
:
function
(
e
)
{
...
...
@@ -84,13 +85,16 @@ KityMinder.registerModule( "Select", function () {
this
.
toggleSelect
(
clickNode
);
}
else
if
(
!
clickNode
.
isSelected
()
)
{
this
.
select
(
clickNode
,
true
);
}
else
if
(
!
this
.
isSingleSelect
()
)
{
singleSelectOnUp
=
clickNode
;
}
},
mousemove
:
marqueeActivator
.
selectMove
,
mouseup
:
function
(
e
)
{
var
clickNode
=
e
.
getTargetNode
();
if
(
clickNode
&&
clickNode
.
isSelected
()
&&
!
this
.
isSingleSelect
()
)
{
this
.
select
(
clickNode
,
true
);
if
(
clickNode
&&
singleSelectOnUp
==
clickNode
)
{
this
.
select
(
singleSelectOnUp
,
true
);
singleSelectOnUp
=
null
;
}
marqueeActivator
.
selectEnd
(
e
);
}
...
...
src/protocal/json.js
View file @
f48b3d54
...
...
@@ -16,6 +16,7 @@ KityMinder.registerProtocal( 'json', function () {
},
recognize
:
function
(
local
)
{
return
Utils
.
isString
(
local
)
&&
local
.
charAt
(
0
)
==
'{'
&&
local
.
charAt
(
local
.
length
-
1
)
==
'}'
;
}
},
recognizePriority
:
0
};
}
);
\ No newline at end of file
src/protocal/plain.js
View file @
f48b3d54
...
...
@@ -96,6 +96,7 @@ KityMinder.registerProtocal( "plain", function () {
}
return
decode
(
local
);
},
recognize
:
recognize
recognize
:
recognize
,
recognizePriority
:
-
1
};
}
);
\ No newline at end of file
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