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
a2cfa6d8
Commit
a2cfa6d8
authored
Feb 20, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added queryState
parent
48b31197
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
4 deletions
+42
-4
layout.bottom.js
src/module/layout.bottom.js
+17
-3
layout.js
src/module/layout.js
+25
-1
No files found.
src/module/layout.bottom.js
View file @
a2cfa6d8
...
...
@@ -186,6 +186,7 @@ KityMinder.registerModule( "LayoutBottom", function () {
if
(
nodeType
===
"root"
)
{
Layout
.
x
=
getMinderSize
().
width
/
2
;
Layout
.
y
=
100
;
Layout
.
align
=
"center"
;
effectSet
.
push
(
node
);
var
children
=
node
.
getChildren
();
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
...
...
@@ -194,6 +195,7 @@ KityMinder.registerModule( "LayoutBottom", function () {
}
effectSet
=
effectSet
.
concat
(
children
);
}
else
if
(
nodeType
===
"main"
)
{
Layout
.
align
=
"center"
;
var
mainnodes
=
_root
.
getChildren
();
var
rootLayout
=
_root
.
getLayout
();
var
rootbranchwidth
=
0
;
...
...
@@ -212,15 +214,16 @@ KityMinder.registerModule( "LayoutBottom", function () {
}
effectSet
=
mainnodes
;
}
else
{
Layout
.
align
=
"left"
;
var
parentLayout
=
parent
.
getLayout
();
if
(
parent
.
getType
()
===
"main"
)
{
Layout
.
x
=
10
;
Layout
.
y
=
nodeStyles
.
sub
.
margin
[
0
];
}
else
{
Layout
.
x
=
parentLayout
.
x
+
10
;
}
if
(
action
===
"append"
)
{
Layout
.
y
=
parentLayout
.
y
+
parent
.
getRenderContainer
().
getHeight
()
+
nodeStyles
.
sub
.
margin
[
0
];
}
effectSet
=
[
node
];
}
return
effectSet
;
};
...
...
@@ -230,7 +233,17 @@ KityMinder.registerModule( "LayoutBottom", function () {
var
align
=
Layout
.
align
;
var
_rectHeight
=
nodeShape
.
getHeight
();
var
_rectWidth
=
nodeShape
.
getWidth
();
nodeShape
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
-
node
.
getRenderContainer
().
getWidth
()
/
2
,
Layout
.
y
)
);
switch
(
align
)
{
case
"right"
:
nodeShape
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
-
_rectWidth
,
Layout
.
y
)
);
break
;
case
"center"
:
nodeShape
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
-
_rectWidth
/
2
,
Layout
.
y
)
);
break
;
default
:
nodeShape
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
,
Layout
.
y
)
);
break
;
}
if
(
node
.
getType
()
===
"main"
)
{
Layout
.
subgroup
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
-
node
.
getRenderContainer
().
getWidth
()
/
2
+
10
,
Layout
.
y
+
node
.
getRenderContainer
().
getHeight
()
)
);
}
...
...
@@ -338,6 +351,7 @@ KityMinder.registerModule( "LayoutBottom", function () {
node
.
setType
(
"sub"
);
//将节点加入到main分支的subgroup中
parentLayout
.
subgroup
.
addShape
(
node
.
getRenderContainer
()
);
node
.
getLayout
().
subgroup
=
parentLayout
.
subgroup
;
}
if
(
sibling
)
{
parent
.
insertChild
(
node
,
sibling
.
getIndex
()
+
1
);
...
...
src/module/layout.js
View file @
a2cfa6d8
...
...
@@ -104,6 +104,14 @@ KityMinder.registerModule( "LayoutModule", function () {
km
.
appendChildNode
(
parent
,
node
);
km
.
select
(
node
,
true
);
return
node
;
},
queryState
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
)
{
return
false
;
}
else
{
return
true
;
}
}
};
}
)()
);
...
...
@@ -124,6 +132,14 @@ KityMinder.registerModule( "LayoutModule", function () {
}
km
.
select
(
node
,
true
);
return
node
;
},
queryState
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
||
selectedNode
===
km
.
getRoot
()
)
{
return
false
;
}
else
{
return
true
;
}
}
};
}
)()
);
...
...
@@ -148,6 +164,14 @@ KityMinder.registerModule( "LayoutModule", function () {
}
while
(
_buffer
.
length
>
1
);
km
.
removeNode
(
selectedNodes
);
km
.
select
(
_buffer
[
0
]
);
},
queryState
:
function
(
km
)
{
var
selectedNodes
=
km
.
getSelectedNodes
();
if
(
(
selectedNodes
.
length
===
1
&&
selectedNodes
[
0
]
===
km
.
getRoot
()
)
||
selectedNodes
.
length
===
0
)
{
return
false
;
}
else
{
return
true
;
}
}
};
}
)()
);
...
...
@@ -181,7 +205,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
},
"defaultOptions"
:
{
"defaultlayoutstyle"
:
"
bottom
"
"defaultlayoutstyle"
:
"
default
"
}
};
}
);
\ 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