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
ae46c37d
Commit
ae46c37d
authored
Jan 22, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed the undo and redo
parent
5e59c39c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
layout.default.js
src/module/layout.default.js
+8
-6
layout.green.js
src/module/layout.green.js
+5
-3
No files found.
src/module/layout.default.js
View file @
ae46c37d
...
@@ -182,7 +182,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -182,7 +182,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
}
};
};
}
)()
);
}
)()
);
var
root
=
this
.
getRoot
();
//更新连线
//更新连线
var
updateConnect
=
function
(
minder
,
node
,
action
)
{
var
updateConnect
=
function
(
minder
,
node
,
action
)
{
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getData
(
"layout"
);
...
@@ -288,7 +287,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -288,7 +287,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
prt
=
prt
.
getParent
();
prt
=
prt
.
getParent
();
}
while
(
prt
);
}
while
(
prt
);
//遍历
//遍历
var
_buffer
=
[
root
];
var
_buffer
=
[
minder
.
getRoot
()
];
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
countY
(
_buffer
[
0
],
appendside
)
);
_buffer
=
_buffer
.
concat
(
countY
(
_buffer
[
0
],
appendside
)
);
effectSet
.
push
(
_buffer
[
0
]
);
effectSet
.
push
(
_buffer
[
0
]
);
...
@@ -369,10 +368,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -369,10 +368,12 @@ KityMinder.registerModule( "LayoutDefault", function () {
drawNode
(
node
);
drawNode
(
node
);
},
},
initStyle
:
function
()
{
initStyle
:
function
()
{
//清空节点上附加的数据;
//绘制root并且调整到正确位置
var
_root
=
this
.
getRoot
();
this
.
getRenderContainer
().
clear
().
addShape
(
_root
.
getRenderContainer
().
clear
()
);
var
minder
=
this
;
var
minder
=
this
;
var
_root
=
minder
.
getRoot
(
);
_root
.
setData
(
"text"
,
_root
.
getData
(
"text"
)
||
"I am the root"
);
_root
.
setData
(
'layout'
,
{}
);
_root
.
setData
(
"layout"
,{}
);
var
Layout
=
_root
.
getData
(
"layout"
);
var
Layout
=
_root
.
getData
(
"layout"
);
Layout
.
style
=
{
Layout
.
style
=
{
radius
:
10
,
radius
:
10
,
...
@@ -409,6 +410,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -409,6 +410,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
}
},
},
appendChildNode
:
function
(
parent
,
node
,
index
)
{
appendChildNode
:
function
(
parent
,
node
,
index
)
{
var
_root
=
this
.
getRoot
();
if
(
!
node
.
getData
(
"layout"
)
)
node
.
setData
(
"layout"
,
{}
);
if
(
!
node
.
getData
(
"layout"
)
)
node
.
setData
(
"layout"
,
{}
);
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getData
(
"layout"
);
var
parentLayout
=
parent
.
getData
(
"layout"
);
var
parentLayout
=
parent
.
getData
(
"layout"
);
...
@@ -418,7 +420,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -418,7 +420,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
else
parent
.
insertChild
(
node
,
index
);
else
parent
.
insertChild
(
node
,
index
);
}
}
minder
.
handelNodeInsert
(
node
);
minder
.
handelNodeInsert
(
node
);
if
(
parent
===
root
)
{
if
(
parent
===
_
root
)
{
var
leftList
=
parentLayout
.
leftList
;
var
leftList
=
parentLayout
.
leftList
;
var
rightList
=
parentLayout
.
rightList
;
var
rightList
=
parentLayout
.
rightList
;
var
sibling
=
parent
.
getChildren
();
var
sibling
=
parent
.
getChildren
();
...
...
src/module/layout.green.js
View file @
ae46c37d
...
@@ -182,7 +182,6 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -182,7 +182,6 @@ KityMinder.registerModule( "LayoutGreen", function () {
}
}
};
};
}
)()
);
}
)()
);
var
root
=
this
.
getRoot
();
//更新连线
//更新连线
var
updateConnect
=
function
(
minder
,
node
,
action
)
{
var
updateConnect
=
function
(
minder
,
node
,
action
)
{
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getData
(
"layout"
);
...
@@ -262,7 +261,7 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -262,7 +261,7 @@ KityMinder.registerModule( "LayoutGreen", function () {
prt
=
prt
.
getParent
();
prt
=
prt
.
getParent
();
}
}
var
_buffer
=
[
root
];
var
_buffer
=
[
minder
.
getRoot
()
];
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
var
childrenC
=
_buffer
[
0
].
getChildren
();
var
childrenC
=
_buffer
[
0
].
getChildren
();
var
parentLayout
=
_buffer
[
0
].
getData
(
"layout"
);
var
parentLayout
=
_buffer
[
0
].
getData
(
"layout"
);
...
@@ -306,8 +305,10 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -306,8 +305,10 @@ KityMinder.registerModule( "LayoutGreen", function () {
initStyle
:
function
()
{
initStyle
:
function
()
{
//绘制root并且调整到正确位置
//绘制root并且调整到正确位置
var
_root
=
this
.
getRoot
();
var
_root
=
this
.
getRoot
();
this
.
getRenderContainer
().
clear
().
addShape
(
_root
.
getRenderContainer
().
clear
()
);
var
minder
=
this
;
var
minder
=
this
;
_root
.
setData
(
"text"
,
_root
.
getData
(
"text"
)
||
"I am the root"
);
_root
.
setData
(
"text"
,
_root
.
getData
(
"text"
)
||
"I am the root"
);
_root
.
setData
(
"layout"
,{});
var
Layout
=
_root
.
getData
(
"layout"
);
var
Layout
=
_root
.
getData
(
"layout"
);
Layout
.
style
=
{
Layout
.
style
=
{
radius
:
20
,
radius
:
20
,
...
@@ -330,12 +331,13 @@ KityMinder.registerModule( "LayoutGreen", function () {
...
@@ -330,12 +331,13 @@ KityMinder.registerModule( "LayoutGreen", function () {
var
parent
=
_buffer
[
0
].
getParent
();
var
parent
=
_buffer
[
0
].
getParent
();
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
[
0
].
children
=
[];
_buffer
[
0
].
children
=
[];
_buffer
[
0
].
setData
(
"layout"
,{});
this
.
appendChildNode
(
parent
,
_buffer
[
0
]
);
this
.
appendChildNode
(
parent
,
_buffer
[
0
]
);
_buffer
.
shift
();
_buffer
.
shift
();
}
}
},
},
appendChildNode
:
function
(
parent
,
node
,
index
)
{
appendChildNode
:
function
(
parent
,
node
,
index
)
{
if
(
!
node
.
getData
(
"layout"
)
)
node
.
setData
(
"layout"
,
{}
);
node
.
setData
(
"layout"
,{}
);
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getData
(
"layout"
);
var
parentLayout
=
parent
.
getData
(
"layout"
);
var
parentLayout
=
parent
.
getData
(
"layout"
);
var
minder
=
this
;
var
minder
=
this
;
...
...
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