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
Hide 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 @@
var
_root
=
minder
.
getRoot
();
_root
.
setData
(
"data"
,{
x
:
minderWidth
/
2
,
y
:
minderHeight
/
2
,
style
:{
radius
:
10
,
fill
:
"orange"
,
...
...
@@ -25,10 +23,12 @@
color
:
"black"
,
padding
:[
10
,
10
,
10
,
10
],
fontSize
:
20
,
align
:
"center"
},
text
:
"I am the root"
,
});
_root
.
setData
(
"x"
,
minderWidth
/
2
);
_root
.
setData
(
"y"
,
minderHeight
/
2
);
_root
.
setData
(
"align"
,
"center"
);
minder
.
select
(
_root
);
minder
.
execCommand
(
"rendernode"
,
_root
);
...
...
src/module/layout.js
View file @
f4fde756
...
...
@@ -4,10 +4,11 @@ KityMinder.registerModule( "LayoutModule", function () {
base
:
Command
,
execute
:
function
(
km
,
parent
)
{
var
_node
=
new
MinderNode
();
_node
.
setData
(
"x"
,
parent
.
getData
(
"x"
)
+
200
);
_node
.
setData
(
"y"
,
Math
.
random
()
*
300
+
100
);
_node
.
setData
(
"align"
,
"left"
);
var
_nodeD
=
{
text
:
"New Node"
,
x
:
parent
.
getData
(
"data"
).
x
+
200
,
y
:
Math
.
random
()
*
300
+
100
,
align
:
"left"
};
switch
(
parent
.
branchside
)
{
...
...
@@ -16,17 +17,20 @@ KityMinder.registerModule( "LayoutModule", function () {
case
"right"
:
break
;
default
:
(
function
()
{
}
)();
break
;
}
;
}
_node
.
setData
(
"data"
,
_nodeD
);
parent
.
insertChild
(
_node
);
km
.
execCommand
(
'rendernode'
,
_node
);
return
_node
;
}
}
}
;
}
)()
);
var
CreateSiblingNodeCommand
=
kity
.
createClass
(
"CreateSiblingNodeCommand"
,
(
function
()
{
var
CreateSiblingNodeCommand
=
kity
.
createClass
(
"CreateSiblingNodeCommand"
,
(
function
()
{
return
{
base
:
Command
,
execute
:
function
(
km
,
sibling
,
node
)
{
...
...
@@ -35,6 +39,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
}
}
)()
);
var
RemoveNodeCommand
=
kity
.
createClass
(
"RemoveNodeCommand"
,
(
function
()
{
return
{
...
...
src/module/render.js
View file @
f4fde756
...
...
@@ -15,13 +15,11 @@ KityMinder.registerModule( "RenderModule", function () {
unhighlight
:
function
()
{
this
.
rect
.
stroke
(
this
.
NormalInfo
);
}
}
}
;
}
)()
);
var
renderNode
=
function
(
km
,
node
)
{
var
node_default
=
{
x
:
0
,
y
:
0
,
text
:
"Root"
,
style
:
{
radius
:
10
,
...
...
@@ -29,8 +27,7 @@ KityMinder.registerModule( "RenderModule", function () {
stroke
:
"orange"
,
color
:
"black"
,
padding
:
[
5
,
5
,
5
,
5
],
fontSize
:
12
,
align
:
"left"
fontSize
:
12
}
};
var
kR
=
node
.
getRenderContainer
();
...
...
@@ -54,16 +51,15 @@ KityMinder.registerModule( "RenderModule", function () {
nodeShape
.
NormalInfo
=
new
kity
.
Pen
(
_style
.
stroke
,
_style
.
strokeWidth
);
nodeShape
.
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
stroke
(
nodeShape
.
NormalInfo
).
fill
(
_style
.
fill
).
setRadius
(
_style
.
radius
);
switch
(
nodeD
.
align
)
{
switch
(
node
.
align
)
{
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
;
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
;
default
:
nodeShape
.
shape
.
translate
(
node
D
.
x
,
nodeD
.
y
-
_rectHeight
/
2
);
nodeShape
.
shape
.
translate
(
node
.
getData
(
"x"
),
node
.
getData
(
"y"
)
-
_rectHeight
/
2
);
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