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
6b68f6ec
Commit
6b68f6ec
authored
Feb 10, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed the bug of beforeRenderNode
parent
6438da2d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
35 deletions
+57
-35
dev.html
demo/dev.html
+3
-3
minder.event.js
src/core/minder.event.js
+1
-1
minder.js
src/core/minder.js
+1
-1
font.js
src/module/font.js
+14
-14
layout.bottom.js
src/module/layout.bottom.js
+28
-1
layout.default.js
src/module/layout.default.js
+9
-14
layout.js
src/module/layout.js
+1
-1
No files found.
demo/dev.html
View file @
6b68f6ec
...
...
@@ -30,9 +30,9 @@
minder
.
execCommand
(
"switchlayout"
,
val
);
},
false
);
minder
.
select
(
minder
.
getRoot
());
//
var node = new KM.MinderNode('test');
//
node.setData('fontcolor','red');
//
minder.execCommand('appendChildNode',node);
var
node
=
new
KM
.
MinderNode
(
'test'
);
node
.
setData
(
'fontcolor'
,
'red'
);
minder
.
execCommand
(
'appendChildNode'
,
node
);
// var b = new kity.Bezier([new kity.BezierPoint(0,0).setVertex(100,100),new kity.BezierPoint(100,0).setVertex(100,100)]);
// minder.getRenderContainer().addShape(b.stroke("white"));
</script>
...
...
src/core/minder.event.js
View file @
6b68f6ec
...
...
@@ -32,7 +32,7 @@ kity.extendClass( Minder, {
this
.
_fire
(
preEvent
);
this
.
_fire
(
executeEvent
);
this
.
_fire
(
new
MinderEvent
(
'after'
+
e
.
type
,
e
,
false
)
);
this
.
_fire
(
new
MinderEvent
(
'after'
+
e
.
type
,
e
,
false
)
);
if
(
~
'mousedown mouseup keydown keyup'
.
indexOf
(
e
.
type
)
)
{
this
.
_interactChange
(
e
);
...
...
src/core/minder.js
View file @
6b68f6ec
...
...
@@ -37,7 +37,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
.
addShape
(
this
.
_rc
);
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_root
=
new
MinderNode
();
this
.
_root
=
new
MinderNode
(
"Main Topic"
);
this
.
_root
.
setType
(
"root"
);
if
(
this
.
_options
.
renderTo
)
{
this
.
renderTo
(
this
.
_options
.
renderTo
);
...
...
src/module/font.js
View file @
6b68f6ec
...
...
@@ -6,24 +6,24 @@ KityMinder.registerModule( "fontmodule", function () {
"fontcolor"
:
kity
.
createClass
(
"fontcolorCommand"
,
{
base
:
Command
,
execute
:
function
(
km
,
color
)
{
execute
:
function
(
km
,
color
)
{
var
nodes
=
km
.
getSelectedNodes
();
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontcolor'
,
color
);
n
.
getTextShape
().
fill
(
color
)
})
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontcolor'
,
color
);
n
.
getTextShape
().
fill
(
color
)
}
)
}
}
),
"fontfamily"
:
kity
.
createClass
(
"fontfamilyCommand"
,
{
base
:
Command
,
execute
:
function
(
km
,
family
)
{
execute
:
function
(
km
,
family
)
{
var
nodes
=
km
.
getSelectedNodes
();
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontfamily'
,
family
);
n
.
getTextShape
().
setAttr
(
'font-family'
,
family
);
})
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontfamily'
,
family
);
n
.
getTextShape
().
setAttr
(
'font-family'
,
family
);
}
)
}
}
)
},
...
...
@@ -31,11 +31,11 @@ KityMinder.registerModule( "fontmodule", function () {
"events"
:
{
"beforeRenderNode"
:
function
(
e
)
{
var
val
;
if
(
val
=
e
.
node
.
getData
(
'fontfamily'
))
{
e
.
node
.
getTextShape
().
setAttr
(
'font-family'
,
val
);
if
(
val
=
e
.
node
.
getData
(
'fontfamily'
)
)
{
e
.
node
.
getTextShape
().
setAttr
(
'font-family'
,
val
);
}
if
(
val
=
e
.
node
.
getData
(
'fontcolor'
))
{
e
.
node
.
getTextShape
().
fill
(
val
);
if
(
val
=
e
.
node
.
getData
(
'fontcolor'
)
)
{
e
.
node
.
getTextShape
().
fill
(
val
);
}
}
}
...
...
src/module/layout.bottom.js
View file @
6b68f6ec
...
...
@@ -380,7 +380,34 @@ KityMinder.registerModule( "LayoutBottom", function () {
},
removeNode
:
function
(
nodes
)
{
var
root
=
this
.
getRoot
();
for
(
var
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
var
parent
=
nodes
[
i
].
getParent
();
if
(
parent
)
{
var
_buffer
=
[
nodes
[
i
]
];
var
parentLayout
=
parent
.
getData
(
"layout"
);
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
getRenderContainer
().
remove
();
var
prt
=
_buffer
[
0
].
getParent
();
prt
.
removeChild
(
_buffer
[
0
]
);
_buffer
.
shift
();
}
if
(
parent
===
root
)
{
var
Layout
=
nodes
[
i
].
getData
(
"layout"
);
var
appendside
=
Layout
.
appendside
;
var
sideList
=
parentLayout
[
appendside
+
"List"
];
var
idx
=
sideList
.
indexOf
(
nodes
[
i
]
);
sideList
.
splice
(
idx
,
1
);
}
parent
.
removeChild
(
nodes
[
i
]
);
var
set
=
updateLayoutHorizon
(
nodes
[
i
],
parent
,
"remove"
);
for
(
var
j
=
0
;
j
<
set
.
length
;
j
++
)
{
translateNode
(
set
[
j
]
);
}
}
}
}
};
this
.
addLayoutStyle
(
"bottom"
,
_style
);
...
...
src/module/layout.default.js
View file @
6b68f6ec
...
...
@@ -92,10 +92,8 @@ KityMinder.registerModule( "LayoutDefault", function () {
update
:
function
()
{
var
rect
=
this
.
_rect
;
var
node
=
this
.
_node
;
var
txt
=
node
.
getTextShape
();
var
contRC
=
node
.
getContRc
();
var
Layout
=
node
.
getData
(
"layout"
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
);
var
_contRCWidth
=
contRC
.
getWidth
();
var
_contRCHeight
=
contRC
.
getHeight
();
var
_rectWidth
=
_contRCWidth
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
...
...
@@ -168,22 +166,21 @@ KityMinder.registerModule( "LayoutDefault", function () {
},
update
:
function
()
{
var
node
=
this
.
_node
;
var
contRc
=
node
.
getContRc
();
var
Layout
=
node
.
getData
(
"layout"
);
var
underline
=
this
.
_underline
;
var
highlightshape
=
this
.
_highlightshape
;
var
txt
=
node
.
getTextShape
();
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
).
setSize
(
Layout
.
fontSize
);
var
_txtWidth
=
txt
.
getWidth
();
var
_txtHeight
=
txt
.
getHeight
();
var
sY
=
Layout
.
padding
[
0
]
+
_txtHeight
/
2
;
var
_contWidth
=
contRc
.
getWidth
();
var
_contHeight
=
contRc
.
getHeight
();
var
sY
=
Layout
.
padding
[
0
]
+
_contHeight
/
2
;
underline
.
getDrawer
()
.
clear
()
.
moveTo
(
0
,
_
tx
tHeight
+
Layout
.
padding
[
2
]
+
Layout
.
padding
[
0
]
)
.
lineTo
(
_
txtWidth
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
],
_tx
tHeight
+
Layout
.
padding
[
2
]
+
Layout
.
padding
[
0
]
);
.
moveTo
(
0
,
_
con
tHeight
+
Layout
.
padding
[
2
]
+
Layout
.
padding
[
0
]
)
.
lineTo
(
_
contWidth
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
],
_con
tHeight
+
Layout
.
padding
[
2
]
+
Layout
.
padding
[
0
]
);
underline
.
stroke
(
Layout
.
stroke
);
highlightshape
.
setWidth
(
_
tx
tWidth
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
]
)
.
setHeight
(
_
tx
tHeight
+
Layout
.
padding
[
0
]
+
Layout
.
padding
[
2
]
)
.
setWidth
(
_
con
tWidth
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
]
)
.
setHeight
(
_
con
tHeight
+
Layout
.
padding
[
0
]
+
Layout
.
padding
[
2
]
)
.
setOpacity
(
node
.
getData
(
"highlight"
)
?
1
:
0
);
this
.
updateConnect
();
this
.
updateShIcon
();
...
...
@@ -262,12 +259,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
},
update
:
function
()
{
var
node
=
this
.
_node
;
var
txt
=
node
.
getTextShape
();
var
contRC
=
node
.
getContRc
();
var
rect
=
this
.
_rect
;
var
connect
=
this
.
_connect
;
var
Layout
=
node
.
getData
(
"layout"
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
);
var
_contRCWidth
=
contRC
.
getWidth
();
var
_contRCHeight
=
contRC
.
getHeight
();
var
_rectWidth
=
_contRCWidth
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
...
...
@@ -515,7 +510,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout
.
appendside
=
parentLayout
.
appendside
;
childbranch
=
new
SubBranch
(
node
);
}
this
.
_fire
(
new
MinderEvent
(
"
after
RenderNode"
,
{
this
.
_fire
(
new
MinderEvent
(
"RenderNode"
,
{
node
:
node
},
false
)
);
var
set1
=
updateLayoutVertical
(
node
,
parent
,
"append"
);
...
...
src/module/layout.js
View file @
6b68f6ec
...
...
@@ -152,7 +152,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
},
"defaultOptions"
:
{
"layoutstyle"
:
"
bottom
"
"layoutstyle"
:
"
default
"
}
};
}
);
\ 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