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
4cf00f52
Commit
4cf00f52
authored
Jan 17, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added layoutstyle init
parent
7bb40a8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
27 deletions
+48
-27
dev.html
demo/dev.html
+9
-7
minder.js
src/core/minder.js
+7
-2
layout.default.js
src/module/layout.default.js
+7
-1
layout.js
src/module/layout.js
+25
-17
No files found.
demo/dev.html
View file @
4cf00f52
...
...
@@ -11,15 +11,17 @@
</style>
</head>
<body
style=
"background:#262626; margin:0; padding:0"
>
<div
id=
"kityminder"
style=
"height:1000px;width:100%"
></div>
<div
id=
"kityminder"
style=
"height:1000px;width:100%"
>
</div>
</body>
<script>
minder
=
KM
.
createMinder
(
kityminder
);
minder
.
execCommand
(
"switchlayout"
,
"default"
);
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendchildnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
());
minder
.
execCommand
(
"appendsiblingnode"
,
new
MinderNode
());
// minder.execCommand("appendchildnode",new MinderNode('dsf'));
// minder.execCommand("appendsiblingnode",new MinderNode('sdf'));
// minder.execCommand("appendchildnode",new MinderNode('sdf'));
// minder.execCommand("appendsiblingnode",new MinderNode('df'));
// minder.execCommand("appendsiblingnode",new MinderNode('sdfsdf'));
</script>
</html>
\ No newline at end of file
src/core/minder.js
View file @
4cf00f52
...
...
@@ -9,7 +9,9 @@
* @description KityMinder 使用类
*/
var
MinderDefaultOptions
=
{};
var
MinderDefaultOptions
=
{
"layoutstyle"
:
"default"
};
var
Minder
=
KityMinder
.
Minder
=
kity
.
createClass
(
"KityMinder"
,
{
constructor
:
function
(
options
)
{
...
...
@@ -20,8 +22,11 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_initMinder
();
this
.
_initSelection
();
this
.
_initModules
();
this
.
fire
(
'ready'
);
},
getOptions
:
function
(
key
)
{
return
this
.
_options
[
key
];
},
_initMinder
:
function
()
{
this
.
_rc
=
new
kity
.
Group
();
...
...
src/module/layout.default.js
View file @
4cf00f52
...
...
@@ -391,12 +391,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
leftList
.
push
(
children
[
i
]
);
children
[
i
].
setData
(
"appendside"
,
"left"
);
}
children
[
i
].
getRenderContainer
().
clear
();
children
.
setData
(
"shape"
,
null
);
drawNode
(
children
[
i
]
);
updateArrangement
(
children
[
i
]
);
}
}
},
appendChildNode
:
function
(
parent
,
node
,
index
)
{
var
minder
=
this
;
var
appendside
=
parent
.
getData
(
"appendside"
);
if
(
parent
===
root
)
{
var
leftList
=
parent
.
getData
(
"leftList"
);
...
...
@@ -417,7 +420,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
else
{
node
.
setData
(
"align"
,
"left"
);
}
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
parent
.
appendChild
(
node
,
index
);
if
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
)
{
parent
.
appendChild
(
node
,
index
);
minder
.
handelNodeInsert
(
node
);
}
drawNode
(
node
);
updateArrangement
(
node
,
"append"
);
},
...
...
src/module/layout.js
View file @
4cf00f52
KityMinder
.
registerModule
(
"LayoutModule"
,
function
()
{
var
switchLayout
=
function
(
km
,
style
)
{
var
_style
=
km
.
getLayoutStyle
(
style
);
if
(
!
_style
)
return
false
;
km
.
renderNode
=
_style
.
renderNode
;
km
.
initStyle
=
_style
.
initStyle
;
km
.
appendChildNode
=
_style
.
appendChildNode
;
km
.
appendSiblingNode
=
_style
.
appendSiblingNode
;
km
.
removeNode
=
_style
.
removeNode
;
//清空节点上附加的数据
var
_root
=
km
.
getRoot
();
_root
.
preTraverse
(
function
(
node
)
{
node
.
clearData
();
node
.
getRenderContainer
().
clear
();
}
);
km
.
initStyle
();
return
style
;
};
var
SwitchLayoutCommand
=
kity
.
createClass
(
"SwitchLayoutCommand"
,
(
function
()
{
return
{
base
:
Command
,
execute
:
function
(
km
,
style
)
{
var
_style
=
km
.
getLayoutStyle
(
style
);
if
(
!
_style
)
return
false
;
km
.
renderNode
=
_style
.
renderNode
;
km
.
initStyle
=
_style
.
initStyle
;
km
.
appendChildNode
=
_style
.
appendChildNode
;
km
.
appendSiblingNode
=
_style
.
appendSiblingNode
;
km
.
removeNode
=
_style
.
removeNode
;
//清空节点上附加的数据
var
_root
=
km
.
getRoot
();
_root
.
preTraverse
(
function
(
node
)
{
node
.
clearData
();
node
.
getRenderContainer
().
clear
();
}
);
km
.
initStyle
();
return
style
;
}
execute
:
switchLayout
};
}
)()
);
var
AppendChildNodeCommand
=
kity
.
createClass
(
"AppendChildNodeCommand"
,
(
function
()
{
...
...
@@ -59,6 +61,12 @@ KityMinder.registerModule( "LayoutModule", function () {
"appendsiblingnode"
:
AppendSiblingNodeCommand
,
"removenode"
:
RemoveNodeCommand
,
"switchlayout"
:
SwitchLayoutCommand
},
"events"
:
{
"ready"
:
function
()
{
alert
(
"ready"
);
switchLayout
(
this
,
this
.
getOptions
(
'layoutstyle'
)
);
}
}
};
}
);
\ 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