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
2616b6fe
Commit
2616b6fe
authored
Jun 26, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change layout vector's set position
parent
527b43e9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
layout.js
src/core/layout.js
+11
-4
default.connect.js
src/layout/default.connect.js
+1
-1
default.js
src/layout/default.js
+6
-6
No files found.
src/core/layout.js
View file @
2616b6fe
...
...
@@ -42,6 +42,10 @@ kity.extendClass(MinderNode, {
return
this
.
getLayoutInstance
().
getOrderHint
(
this
);
},
getExpandPosition
:
function
()
{
return
this
.
getLayoutInstance
().
getExpandPosition
();
},
getLayoutInstance
:
function
()
{
var
LayoutClass
=
KityMinder
.
_layout
[
this
.
getLayout
()];
var
layout
=
new
LayoutClass
();
...
...
@@ -131,10 +135,6 @@ kity.extendClass(MinderNode, {
this
.
getMinder
().
layout
(
duration
);
return
this
;
},
getLayoutContextPoints
:
function
()
{
return
this
.
getLayoutInstance
().
getLayoutContextPoints
(
this
);
}
});
...
...
@@ -167,10 +167,17 @@ kity.extendClass(Minder, {
return
this
.
fire
(
'layout'
);
},
refresh
:
function
(
duration
)
{
this
.
getRoot
().
preTraverse
(
function
(
node
)
{
node
.
render
();
});
return
this
.
layout
(
duration
);
},
applyLayoutResult
:
function
(
root
,
duration
)
{
root
=
root
||
this
.
getRoot
();
var
me
=
this
;
if
(
root
.
getComplex
()
>
100
)
duration
=
0
;
function
apply
(
node
,
pMatrix
)
{
var
matrix
=
node
.
getLayoutTransform
().
merge
(
pMatrix
);
var
lastMatrix
=
node
.
_lastLayoutTransform
||
new
kity
.
Matrix
();
...
...
src/layout/default.connect.js
View file @
2616b6fe
...
...
@@ -14,7 +14,7 @@ KityMinder.registerConnectProvider('default', function(node, parent, connection,
var
start
,
end
,
vector
;
var
abs
=
Math
.
abs
;
var
pathData
=
[];
var
side
=
node
.
getLayoutVector
().
x
>
0
?
'right'
:
'left'
;
var
side
=
box
.
x
>
pBox
.
x
?
'right'
:
'left'
;
node
.
getMinder
().
getPaper
().
addResource
(
connectMarker
);
...
...
src/layout/default.js
View file @
2616b6fe
...
...
@@ -66,6 +66,12 @@ KityMinder.registerLayout('default', kity.createClass({
y
=
-
totalTreeHeight
/
2
;
if
(
side
!=
'left'
)
{
parent
.
setLayoutVector
(
new
kity
.
Vector
(
nodeContentBox
.
right
,
nodeContentBox
.
cy
));
}
else
{
parent
.
setLayoutVector
(
new
kity
.
Vector
(
nodeContentBox
.
left
,
nodeContentBox
.
cy
));
}
for
(
i
=
0
;
i
<
children
.
length
;
i
++
)
{
child
=
children
[
i
];
childTreeBox
=
childTreeBoxes
[
i
];
...
...
@@ -77,15 +83,9 @@ KityMinder.registerLayout('default', kity.createClass({
if
(
side
==
'right'
)
{
x
=
nodeContentBox
.
right
-
childContentBox
.
left
;
x
+=
parent
.
getStyle
(
'margin-right'
)
+
child
.
getStyle
(
'margin-left'
);
// 设置布局矢量
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
right
,
childContentBox
.
cy
));
}
else
{
x
=
nodeContentBox
.
left
-
childContentBox
.
right
;
x
-=
parent
.
getStyle
(
'margin-left'
)
+
child
.
getStyle
(
'margin-right'
);
// 设置布局矢量
child
.
setLayoutVector
(
new
kity
.
Vector
(
childContentBox
.
left
,
childContentBox
.
cy
));
}
// 竖直方向上的布局
...
...
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