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
873f9122
Commit
873f9122
authored
Feb 12, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug
parent
d3b81471
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
62 deletions
+46
-62
font.js
src/module/font.js
+42
-19
layout.default.js
src/module/layout.default.js
+4
-43
No files found.
src/module/font.js
View file @
873f9122
KityMinder
.
registerModule
(
"fontmodule"
,
function
()
{
KityMinder
.
registerModule
(
"fontmodule"
,
function
()
{
return
{
return
{
defaultOptions
:{
defaultOptions
:
{
'fontfamily'
:
[
'fontfamily'
:
[
{
{
name
:
'songti'
,
val
:
'宋体,SimSun'
},
name
:
'songti'
,
{
name
:
'yahei'
,
val
:
'微软雅黑,Microsoft YaHei'
},
val
:
'宋体,SimSun'
{
name
:
'kaiti'
,
val
:
'楷体,楷体_GB2312, SimKai'
},
},
{
{
name
:
'heiti'
,
val
:
'黑体, SimHei'
},
name
:
'yahei'
,
{
name
:
'lishu'
,
val
:
'隶书, SimLi'
},
val
:
'微软雅黑,Microsoft YaHei'
{
name
:
'andaleMono'
,
val
:
'andale mono'
},
},
{
{
name
:
'arial'
,
val
:
'arial, helvetica,sans-serif'
},
name
:
'kaiti'
,
{
name
:
'arialBlack'
,
val
:
'arial black,avant garde'
},
val
:
'楷体,楷体_GB2312, SimKai'
{
name
:
'comicSansMs'
,
val
:
'comic sans ms'
},
},
{
{
name
:
'impact'
,
val
:
'impact,chicago'
},
name
:
'heiti'
,
{
name
:
'timesNewRoman'
,
val
:
'times new roman'
},
val
:
'黑体, SimHei'
{
name
:
'sans-serif'
,
val
:
'sans-serif'
}
},
{
],
name
:
'lishu'
,
'fontsize'
:
[
10
,
12
,
16
,
18
,
24
,
32
,
48
]
val
:
'隶书, SimLi'
},
{
name
:
'andaleMono'
,
val
:
'andale mono'
},
{
name
:
'arial'
,
val
:
'arial, helvetica,sans-serif'
},
{
name
:
'arialBlack'
,
val
:
'arial black,avant garde'
},
{
name
:
'comicSansMs'
,
val
:
'comic sans ms'
},
{
name
:
'impact'
,
val
:
'impact,chicago'
},
{
name
:
'timesNewRoman'
,
val
:
'times new roman'
},
{
name
:
'sans-serif'
,
val
:
'sans-serif'
}
],
'fontsize'
:
[
10
,
12
,
16
,
18
,
24
,
32
,
48
]
},
},
"commands"
:
{
"commands"
:
{
"forecolor"
:
kity
.
createClass
(
"fontcolorCommand"
,
{
"forecolor"
:
kity
.
createClass
(
"fontcolorCommand"
,
{
...
@@ -39,7 +62,7 @@ KityMinder.registerModule( "fontmodule", function () {
...
@@ -39,7 +62,7 @@ KityMinder.registerModule( "fontmodule", function () {
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontfamily'
,
family
);
n
.
setData
(
'fontfamily'
,
family
);
n
.
getTextShape
().
setAttr
(
'font-family'
,
family
);
n
.
getTextShape
().
setAttr
(
'font-family'
,
family
);
km
.
updateLayout
(
n
)
km
.
updateLayout
(
n
)
}
)
}
)
}
}
}
),
}
),
...
@@ -50,8 +73,8 @@ KityMinder.registerModule( "fontmodule", function () {
...
@@ -50,8 +73,8 @@ KityMinder.registerModule( "fontmodule", function () {
var
nodes
=
km
.
getSelectedNodes
();
var
nodes
=
km
.
getSelectedNodes
();
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontsize'
,
size
);
n
.
setData
(
'fontsize'
,
size
);
n
.
getTextShape
().
setSize
(
size
);
n
.
getTextShape
().
setSize
(
size
);
km
.
updateLayout
(
n
)
km
.
updateLayout
(
n
)
}
)
}
)
}
}
}
)
}
)
...
...
src/module/layout.default.js
View file @
873f9122
...
@@ -107,15 +107,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -107,15 +107,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
switch
(
node
.
getType
()
)
{
switch
(
node
.
getType
()
)
{
case
"root"
:
case
"root"
:
case
"main"
:
case
"main"
:
if
(
!
Layout
.
bgRect
)
{
node
.
getBgRc
().
clear
().
addShape
(
Layout
.
bgRect
=
new
kity
.
Rect
()
);
node
.
getBgRc
().
addShape
(
Layout
.
bgRect
=
new
kity
.
Rect
()
);
}
Layout
.
bgRect
.
fill
(
nodeStyle
.
fill
).
setRadius
(
nodeStyle
.
radius
);
Layout
.
bgRect
.
fill
(
nodeStyle
.
fill
).
setRadius
(
nodeStyle
.
radius
);
break
;
break
;
case
"sub"
:
case
"sub"
:
var
underline
=
Layout
.
underline
=
new
kity
.
Path
();
var
underline
=
Layout
.
underline
=
new
kity
.
Path
();
var
highlightshape
=
Layout
.
highlightshape
=
new
kity
.
Rect
();
var
highlightshape
=
Layout
.
highlightshape
=
new
kity
.
Rect
();
node
.
getBgRc
().
addShapes
(
[
highlightshape
,
underline
]
);
node
.
getBgRc
().
clear
().
addShapes
(
[
highlightshape
,
underline
]
);
break
;
break
;
default
:
default
:
break
;
break
;
...
@@ -419,6 +417,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -419,6 +417,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
//设置root的align
//设置root的align
_root
.
getData
(
"layout"
).
align
=
"center"
;
_root
.
getData
(
"layout"
).
align
=
"center"
;
updateBg
(
_root
);
updateBg
(
_root
);
console
.
log
(
_root
.
getData
(
"layout"
),
_root
.
getRenderContainer
()
);
initLayout
(
_root
);
initLayout
(
_root
);
this
.
_fire
(
new
MinderEvent
(
"beforeRenderNode"
,
{
this
.
_fire
(
new
MinderEvent
(
"beforeRenderNode"
,
{
node
:
_root
node
:
_root
...
@@ -562,46 +561,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -562,46 +561,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
translateNode
(
set
[
i
]
);
translateNode
(
set
[
i
]
);
updateConnectAndshIcon
(
set
[
i
]
);
updateConnectAndshIcon
(
set
[
i
]
);
}
}
}
}
};
};
this
.
addLayoutStyle
(
"default"
,
_style
);
this
.
addLayoutStyle
(
"default"
,
_style
);
return
{
return
{};
// "events": {
// "click": function ( e ) {
// var ico = e.kityEvent.targetShape.container;
// if ( ico.class === "shicon" ) {
// var isShow = ico.icon.switchState();
// var node = ico.icon._node;
// var _buffer;
// if ( isShow ) {
// _buffer = node.getChildren();
// while ( _buffer.length !== 0 ) {
// minder.appendChildNode( _buffer[ 0 ].getParent(), _buffer[ 0 ] );
// _buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
// _buffer.shift();
// }
// } else {
// var Layout = node.getData( "layout" );
// var marginTop = Layout.margin[ 0 ];
// var marginBottom = Layout.margin[ 2 ];
// Layout.branchheight = node.getRenderContainer().getHeight() + marginTop + marginBottom;
// _buffer = node.getChildren();
// while ( _buffer.length !== 0 ) {
// try {
// _buffer[ 0 ].getData( "layout" ).shape.clear();
// _buffer[ 0 ].getRenderContainer().remove();
// } catch ( error ) {}
// _buffer = _buffer.concat( _buffer[ 0 ].getChildren() );
// _buffer.shift();
// }
// var set = updateLayoutVertical( node, node.getParent(), "append" );
// for ( var i = 0; i < set.length; i++ ) {
// translateNode( set[ i ] );
// }
// }
// }
// }
// }
};
}
);
}
);
\ 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