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
f4fde756
Commit
f4fde756
authored
Jan 06, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed x and y
parent
77cb3397
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
18 deletions
+19
-18
dev.html
demo/dev.html
+3
-3
layout.js
src/module/layout.js
+10
-5
render.js
src/module/render.js
+6
-10
No files found.
demo/dev.html
View file @
f4fde756
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
var
_root
=
minder
.
getRoot
();
var
_root
=
minder
.
getRoot
();
_root
.
setData
(
"data"
,{
_root
.
setData
(
"data"
,{
x
:
minderWidth
/
2
,
y
:
minderHeight
/
2
,
style
:{
style
:{
radius
:
10
,
radius
:
10
,
fill
:
"orange"
,
fill
:
"orange"
,
...
@@ -25,10 +23,12 @@
...
@@ -25,10 +23,12 @@
color
:
"black"
,
color
:
"black"
,
padding
:[
10
,
10
,
10
,
10
],
padding
:[
10
,
10
,
10
,
10
],
fontSize
:
20
,
fontSize
:
20
,
align
:
"center"
},
},
text
:
"I am the root"
,
text
:
"I am the root"
,
});
});
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"align"
,
"center"
);
minder
.
select
(
_root
);
minder
.
select
(
_root
);
minder
.
execCommand
(
"rendernode"
,
_root
);
minder
.
execCommand
(
"rendernode"
,
_root
);
...
...
src/module/layout.js
View file @
f4fde756
...
@@ -4,10 +4,11 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -4,10 +4,11 @@ KityMinder.registerModule( "LayoutModule", function () {
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
,
parent
)
{
execute
:
function
(
km
,
parent
)
{
var
_node
=
new
MinderNode
();
var
_node
=
new
MinderNode
();
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"y"
,
Math
.
random
()
*
300
+
100
);
_node
.
setData
(
"align"
,
"left"
);
var
_nodeD
=
{
var
_nodeD
=
{
text
:
"New Node"
,
text
:
"New Node"
,
x
:
parent
.
getData
(
"data"
).
x
+
200
,
y
:
Math
.
random
()
*
300
+
100
,
align
:
"left"
align
:
"left"
};
};
switch
(
parent
.
branchside
)
{
switch
(
parent
.
branchside
)
{
...
@@ -16,17 +17,20 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -16,17 +17,20 @@ KityMinder.registerModule( "LayoutModule", function () {
case
"right"
:
case
"right"
:
break
;
break
;
default
:
default
:
(
function
()
{
}
)();
break
;
break
;
}
;
}
_node
.
setData
(
"data"
,
_nodeD
);
_node
.
setData
(
"data"
,
_nodeD
);
parent
.
insertChild
(
_node
);
parent
.
insertChild
(
_node
);
km
.
execCommand
(
'rendernode'
,
_node
);
km
.
execCommand
(
'rendernode'
,
_node
);
return
_node
;
return
_node
;
}
}
}
}
;
}
)()
);
}
)()
);
var
CreateSiblingNodeCommand
=
kity
.
createClass
(
"CreateSiblingNodeCommand"
,
(
function
()
{
var
CreateSiblingNodeCommand
=
kity
.
createClass
(
"CreateSiblingNodeCommand"
,
(
function
()
{
return
{
return
{
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
,
sibling
,
node
)
{
execute
:
function
(
km
,
sibling
,
node
)
{
...
@@ -35,6 +39,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -35,6 +39,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
}
}
}
}
)()
);
}
)()
);
var
RemoveNodeCommand
=
kity
.
createClass
(
"RemoveNodeCommand"
,
(
function
()
{
var
RemoveNodeCommand
=
kity
.
createClass
(
"RemoveNodeCommand"
,
(
function
()
{
return
{
return
{
...
...
src/module/render.js
View file @
f4fde756
...
@@ -15,13 +15,11 @@ KityMinder.registerModule( "RenderModule", function () {
...
@@ -15,13 +15,11 @@ KityMinder.registerModule( "RenderModule", function () {
unhighlight
:
function
()
{
unhighlight
:
function
()
{
this
.
rect
.
stroke
(
this
.
NormalInfo
);
this
.
rect
.
stroke
(
this
.
NormalInfo
);
}
}
}
}
;
}
)()
);
}
)()
);
var
renderNode
=
function
(
km
,
node
)
{
var
renderNode
=
function
(
km
,
node
)
{
var
node_default
=
{
var
node_default
=
{
x
:
0
,
y
:
0
,
text
:
"Root"
,
text
:
"Root"
,
style
:
{
style
:
{
radius
:
10
,
radius
:
10
,
...
@@ -29,8 +27,7 @@ KityMinder.registerModule( "RenderModule", function () {
...
@@ -29,8 +27,7 @@ KityMinder.registerModule( "RenderModule", function () {
stroke
:
"orange"
,
stroke
:
"orange"
,
color
:
"black"
,
color
:
"black"
,
padding
:
[
5
,
5
,
5
,
5
],
padding
:
[
5
,
5
,
5
,
5
],
fontSize
:
12
,
fontSize
:
12
align
:
"left"
}
}
};
};
var
kR
=
node
.
getRenderContainer
();
var
kR
=
node
.
getRenderContainer
();
...
@@ -54,16 +51,15 @@ KityMinder.registerModule( "RenderModule", function () {
...
@@ -54,16 +51,15 @@ KityMinder.registerModule( "RenderModule", function () {
nodeShape
.
NormalInfo
=
new
kity
.
Pen
(
_style
.
stroke
,
_style
.
strokeWidth
);
nodeShape
.
NormalInfo
=
new
kity
.
Pen
(
_style
.
stroke
,
_style
.
strokeWidth
);
nodeShape
.
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
stroke
(
nodeShape
.
NormalInfo
).
fill
(
_style
.
fill
).
setRadius
(
_style
.
radius
);
nodeShape
.
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
stroke
(
nodeShape
.
NormalInfo
).
fill
(
_style
.
fill
).
setRadius
(
_style
.
radius
);
switch
(
node
.
align
)
{
switch
(
nodeD
.
align
)
{
case
"center"
:
case
"center"
:
nodeShape
.
shape
.
translate
(
node
D
.
x
-
_rectWidth
/
2
,
nodeD
.
y
-
_rectHeight
/
2
);
nodeShape
.
shape
.
translate
(
node
.
getData
(
"x"
)
-
_rectWidth
/
2
,
node
.
getData
(
"y"
)
-
_rectHeight
/
2
);
break
;
break
;
case
"right"
:
case
"right"
:
nodeShape
.
shape
.
translate
(
node
D
.
x
-
_rectWidth
,
nodeD
.
y
-
_rectHeight
/
2
);
nodeShape
.
shape
.
translate
(
node
.
getData
(
"x"
)
-
_rectWidth
,
node
.
getData
(
"y"
)
-
_rectHeight
/
2
);
break
;
break
;
default
:
default
:
nodeShape
.
shape
.
translate
(
node
D
.
x
,
nodeD
.
y
-
_rectHeight
/
2
);
nodeShape
.
shape
.
translate
(
node
.
getData
(
"x"
),
node
.
getData
(
"y"
)
-
_rectHeight
/
2
);
break
;
break
;
}
}
...
...
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