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
df4b9823
Commit
df4b9823
authored
Jun 05, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stash
parent
d652a8fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
7 deletions
+29
-7
layout.js
src/core/layout.js
+10
-0
default.js
src/layout/default.js
+10
-1
outline.js
src/module/outline.js
+9
-6
No files found.
src/core/layout.js
View file @
df4b9823
...
...
@@ -24,6 +24,15 @@ kity.extendClass(MinderNode, {
return
layout
;
},
applyLayoutResult
:
function
(
parentX
,
parentY
)
{
var
myX
=
parentX
+
this
.
layoutX
,
myY
=
parentY
+
this
.
layoutY
;
this
.
getRenderContainer
().
fxTranslate
(
myX
,
myY
);
this
.
getChildren
().
forEach
(
function
(
node
)
{
node
.
applyLayoutResult
(
myX
,
myY
);
});
},
layout
:
function
(
name
)
{
if
(
name
)
{
this
.
setData
(
'layout'
,
name
);
...
...
@@ -31,6 +40,7 @@ kity.extendClass(MinderNode, {
var
LayoutClass
=
KityMinder
.
_layout
[
this
.
getLayout
()];
var
layout
=
new
LayoutClass
();
layout
.
doLayout
(
this
);
this
.
applyLayoutResult
(
0
,
0
);
return
this
;
},
...
...
src/layout/default.js
View file @
df4b9823
...
...
@@ -2,10 +2,19 @@
KityMinder
.
registerLayout
(
'default'
,
kity
.
createClass
({
base
:
Layout
,
doLayout
:
function
(
node
)
{
node
.
getChildren
().
forEach
(
function
(
childNode
)
{
childNode
.
layout
();
});
var
y
=
0
;
node
.
getChildren
().
forEach
(
function
(
childNode
)
{
childNode
.
layoutX
=
node
.
getContentBox
().
right
-
childNode
.
getContentBox
().
x
+
node
.
getStyle
(
'margin-right'
);
childNode
.
layoutY
=
y
;
y
+=
50
;
console
.
log
(
childNode
.
layoutX
,
childNode
.
layoutY
);
});
node
.
layoutX
=
0
;
node
.
layoutY
=
0
;
}
}));
\ No newline at end of file
src/module/outline.js
View file @
df4b9823
...
...
@@ -17,17 +17,20 @@ KityMinder.registerModule('OutlineModule', function() {
paddingRight
=
node
.
getStyle
(
'padding-right'
),
paddingTop
=
node
.
getStyle
(
'padding-top'
),
paddingBottom
=
node
.
getStyle
(
'padding-bottom'
);
var
outlineBox
=
{
x
:
contentBox
.
x
-
paddingLeft
,
y
:
contentBox
.
y
-
paddingTop
,
width
:
contentBox
.
width
+
paddingLeft
+
paddingRight
,
height
:
contentBox
.
height
+
paddingTop
+
paddingBottom
};
this
.
outline
.
setPosition
(
contentBox
.
x
-
paddingLeft
,
contentBox
.
y
-
paddingTop
)
.
setSize
(
contentBox
.
width
+
paddingLeft
+
paddingRight
,
contentBox
.
height
+
paddingTop
+
paddingBottom
)
.
setPosition
(
outlineBox
.
x
,
outlineBox
.
y
)
.
setSize
(
outlineBox
.
width
,
outlineBox
.
height
)
.
setRadius
(
node
.
getStyle
(
'radius'
))
.
fill
(
node
.
isSelected
()
?
node
.
getStyle
(
'selected-background'
)
:
node
.
getStyle
(
'background'
));
return
outlineBox
;
}
})
}
...
...
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