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
ea78ac1d
Commit
ea78ac1d
authored
Feb 07, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added event
parent
7ee02295
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
37 deletions
+39
-37
node.js
src/core/node.js
+26
-24
layout.default.js
src/module/layout.default.js
+11
-11
layout.js
src/module/layout.js
+2
-2
No files found.
src/core/node.js
View file @
ea78ac1d
...
@@ -11,47 +11,49 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -11,47 +11,49 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this
.
_createShapeDom
()
this
.
_createShapeDom
()
},
},
_createShapeDom
:
function
()
{
_createShapeDom
:
function
()
{
this
.
rc
=
new
kity
.
Group
();
this
.
rc
=
new
kity
.
Group
();
this
.
rc
.
addClass
(
'km-minderNode'
);
this
.
rc
.
addClass
(
'km-minderNode'
);
this
.
rc
.
minderNode
=
this
;
this
.
rc
.
minderNode
=
this
;
this
.
_createBgGroup
();
this
.
_createBgGroup
();
this
.
_createContGroup
();
this
.
_createContGroup
();
this
.
_createTextShape
();
this
.
_createTextShape
();
},
},
_createGroup
:
function
(
type
)
{
_createGroup
:
function
(
type
)
{
var
g
=
new
kity
.
Group
();
var
g
=
new
kity
.
Group
();
g
.
setData
(
'rctype'
,
type
);
g
.
setData
(
'rctype'
,
type
);
this
.
rc
.
appendShape
(
g
);
this
.
rc
.
appendShape
(
g
);
},
},
_createBgGroup
:
function
()
{
_createBgGroup
:
function
()
{
this
.
_createGroup
(
'bgrc'
)
this
.
_createGroup
(
'bgrc'
)
},
},
_createContGroup
:
function
()
{
_createContGroup
:
function
()
{
this
.
_createGroup
(
'contrc'
)
this
.
_createGroup
(
'contrc'
)
},
},
_createTextShape
:
function
()
{
_createTextShape
:
function
()
{
this
.
getContRc
().
appendShape
(
new
kity
.
Text
(
this
.
getData
(
'text'
)
||
''
)
);
this
.
getContRc
().
appendShape
(
new
kity
.
Text
(
this
.
getData
(
'text'
)
||
''
)
);
},
},
getContRc
:
function
(){
getContRc
:
function
()
{
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
result
;
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
utils
.
each
(
groups
,
function
(
i
,
p
){
result
;
if
(
p
.
getData
(
'rctype'
)
==
'contrc'
){
utils
.
each
(
groups
,
function
(
i
,
p
)
{
if
(
p
.
getData
(
'rctype'
)
==
'contrc'
)
{
result
=
p
;
result
=
p
;
return
false
;
return
false
;
}
}
});
}
);
return
result
return
result
},
},
getBgRc
:
function
(){
getBgRc
:
function
()
{
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
result
;
var
groups
=
this
.
rc
.
getShapesByType
(
'group'
),
utils
.
each
(
groups
,
function
(
i
,
p
){
result
;
if
(
p
.
getData
(
'rctype'
)
==
'bgrc'
){
utils
.
each
(
groups
,
function
(
i
,
p
)
{
if
(
p
.
getData
(
'rctype'
)
==
'bgrc'
)
{
result
=
p
;
result
=
p
;
return
false
;
return
false
;
}
}
});
}
);
return
result
return
result
},
},
setPoint
:
function
(
x
,
y
)
{
setPoint
:
function
(
x
,
y
)
{
...
@@ -258,10 +260,10 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -258,10 +260,10 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
return
true
;
return
true
;
},
},
getTextShape
:
function
()
{
getTextShape
:
function
()
{
return
this
.
getContRc
().
getShapesByType
(
'text'
)[
0
]
return
this
.
getContRc
().
getShapesByType
(
'text'
)[
0
]
},
},
isSelected
:
function
()
{
isSelected
:
function
()
{
return
this
.
getData
(
'highlight'
)
===
true
return
this
.
getData
(
'highlight'
)
===
true
}
}
}
);
}
);
\ No newline at end of file
src/module/layout.default.js
View file @
ea78ac1d
...
@@ -233,10 +233,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -233,10 +233,10 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
RootShape
=
kity
.
createClass
(
"DefaultRootShape"
,
(
function
()
{
var
RootShape
=
kity
.
createClass
(
"DefaultRootShape"
,
(
function
()
{
return
{
return
{
constructor
:
function
(
node
)
{
constructor
:
function
(
node
)
{
var
container
=
node
.
getRenderContainer
();
var
bgRC
=
node
.
getBgRc
();
var
txt
=
this
.
_txt
=
new
kity
.
Text
();
var
contRC
=
node
.
getContRc
();
var
rect
=
this
.
_rect
=
new
kity
.
Rect
();
var
rect
=
this
.
_rect
=
new
kity
.
Rect
();
container
.
addShapes
(
[
rect
,
txt
]
);
bgRC
.
addShape
(
rect
);
this
.
_node
=
node
;
this
.
_node
=
node
;
var
Layout
=
{
var
Layout
=
{
shape
:
this
,
shape
:
this
,
...
@@ -256,20 +256,21 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -256,20 +256,21 @@ KityMinder.registerModule( "LayoutDefault", function () {
};
};
node
.
setData
(
"layout"
,
Layout
);
node
.
setData
(
"layout"
,
Layout
);
node
.
setData
(
"text"
,
"Minder Root"
);
node
.
setData
(
"text"
,
"Minder Root"
);
txt
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
15
);
contRC
.
translate
(
Layout
.
padding
[
3
],
Layout
.
padding
[
0
]
+
15
);
this
.
update
();
this
.
update
();
},
},
update
:
function
()
{
update
:
function
()
{
var
txt
=
this
.
_txt
;
var
node
=
this
.
_node
;
var
txt
=
node
.
getTextShape
();
var
contRC
=
node
.
getContRc
();
var
rect
=
this
.
_rect
;
var
rect
=
this
.
_rect
;
var
connect
=
this
.
_connect
;
var
connect
=
this
.
_connect
;
var
node
=
this
.
_node
;
var
Layout
=
node
.
getData
(
"layout"
);
var
Layout
=
node
.
getData
(
"layout"
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
);
txt
.
setContent
(
node
.
getData
(
"text"
)
).
fill
(
Layout
.
color
);
var
_
txtWidth
=
txt
.
getWidth
();
var
_
contRCWidth
=
contRC
.
getWidth
();
var
_
txtHeight
=
txt
.
getHeight
();
var
_
contRCHeight
=
contRC
.
getHeight
();
var
_rectWidth
=
_
txt
Width
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
var
_rectWidth
=
_
contRC
Width
+
Layout
.
padding
[
1
]
+
Layout
.
padding
[
3
];
var
_rectHeight
=
_
txt
Height
+
Layout
.
padding
[
0
]
+
Layout
.
padding
[
2
];
var
_rectHeight
=
_
contRC
Height
+
Layout
.
padding
[
0
]
+
Layout
.
padding
[
2
];
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
fill
(
node
.
getData
(
"highlight"
)
?
"chocolate"
:
Layout
.
fill
).
setRadius
(
Layout
.
radius
);
rect
.
setWidth
(
_rectWidth
).
setHeight
(
_rectHeight
).
fill
(
node
.
getData
(
"highlight"
)
?
"chocolate"
:
Layout
.
fill
).
setRadius
(
Layout
.
radius
);
},
},
clear
:
function
()
{
clear
:
function
()
{
...
@@ -548,7 +549,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -548,7 +549,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
getData
(
"layout"
).
shape
.
clear
();
_buffer
[
0
].
handelNodeRemove
();
var
prt
=
_buffer
[
0
].
getParent
();
var
prt
=
_buffer
[
0
].
getParent
();
prt
.
removeChild
(
_buffer
[
0
]
);
prt
.
removeChild
(
_buffer
[
0
]
);
_buffer
.
shift
();
_buffer
.
shift
();
...
...
src/module/layout.js
View file @
ea78ac1d
...
@@ -73,7 +73,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -73,7 +73,7 @@ KityMinder.registerModule( "LayoutModule", function () {
_root
.
preTraverse
(
function
(
n
)
{
_root
.
preTraverse
(
function
(
n
)
{
n
.
clearLayout
();
n
.
clearLayout
();
n
.
setPoint
();
n
.
setPoint
();
n
.
get
RenderContainer
().
clear
();
n
.
get
BgRc
().
clear
();
}
);
}
);
km
.
setCurrentStyle
(
style
);
km
.
setCurrentStyle
(
style
);
km
.
initStyle
();
km
.
initStyle
();
...
@@ -152,7 +152,7 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -152,7 +152,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
}
},
},
"defaultOptions"
:
{
"defaultOptions"
:
{
"layoutstyle"
:
"
green
"
"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