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
5584facc
Commit
5584facc
authored
May 25, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
undo
parent
60272950
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
217 additions
and
216 deletions
+217
-216
minder.command.js
src/core/minder.command.js
+36
-36
history.js
src/module/history.js
+106
-105
layout.default.js
src/module/layout.default.js
+60
-60
layout.js
src/module/layout.js
+15
-15
No files found.
src/core/minder.command.js
View file @
5584facc
kity
.
extendClass
(
Minder
,
{
_getCommand
:
function
(
name
)
{
return
this
.
_commands
[
name
.
toLowerCase
()
];
kity
.
extendClass
(
Minder
,
{
_getCommand
:
function
(
name
)
{
return
this
.
_commands
[
name
.
toLowerCase
()
];
},
_queryCommand
:
function
(
name
,
type
,
args
)
{
var
cmd
=
this
.
_getCommand
(
name
);
if
(
cmd
)
{
var
queryCmd
=
cmd
[
'query'
+
type
];
if
(
queryCmd
)
return
queryCmd
.
apply
(
cmd
,
[
this
].
concat
(
args
)
);
_queryCommand
:
function
(
name
,
type
,
args
)
{
var
cmd
=
this
.
_getCommand
(
name
);
if
(
cmd
)
{
var
queryCmd
=
cmd
[
'query'
+
type
];
if
(
queryCmd
)
return
queryCmd
.
apply
(
cmd
,
[
this
].
concat
(
args
)
);
}
return
0
;
},
queryCommandState
:
function
(
name
)
{
return
this
.
_queryCommand
(
name
,
"State"
,
Utils
.
argsToArray
(
1
)
);
queryCommandState
:
function
(
name
)
{
return
this
.
_queryCommand
(
name
,
"State"
,
Utils
.
argsToArray
(
1
)
);
},
queryCommandValue
:
function
(
name
)
{
return
this
.
_queryCommand
(
name
,
"Value"
,
Utils
.
argsToArray
(
1
)
);
queryCommandValue
:
function
(
name
)
{
return
this
.
_queryCommand
(
name
,
"Value"
,
Utils
.
argsToArray
(
1
)
);
},
execCommand
:
function
(
name
)
{
execCommand
:
function
(
name
)
{
name
=
name
.
toLowerCase
();
var
cmdArgs
=
Utils
.
argsToArray
(
arguments
,
1
),
var
cmdArgs
=
Utils
.
argsToArray
(
arguments
,
1
),
cmd
,
stoped
,
result
,
eventParams
;
var
me
=
this
;
cmd
=
this
.
_getCommand
(
name
);
cmd
=
this
.
_getCommand
(
name
);
eventParams
=
{
command
:
cmd
,
commandName
:
name
.
toLowerCase
(),
commandArgs
:
cmdArgs
};
if
(
!
cmd
)
{
if
(
!
cmd
)
{
return
false
;
}
if
(
!
this
.
_hasEnterExecCommand
&&
cmd
.
isNeedUndo
()
)
{
if
(
!
this
.
_hasEnterExecCommand
&&
cmd
.
isNeedUndo
()
)
{
this
.
_hasEnterExecCommand
=
true
;
stoped
=
this
.
_fire
(
new
MinderEvent
(
'beforeExecCommand'
,
eventParams
,
true
)
);
stoped
=
this
.
_fire
(
new
MinderEvent
(
'beforeExecCommand'
,
eventParams
,
true
)
);
if
(
!
stoped
)
{
if
(
!
stoped
)
{
//保存场景
this
.
_fire
(
new
MinderEvent
(
'saveScene'
)
);
this
.
_fire
(
new
MinderEvent
(
'saveScene'
)
);
this
.
_fire
(
new
MinderEvent
(
"preExecCommand"
,
eventParams
,
false
)
);
this
.
_fire
(
new
MinderEvent
(
"preExecCommand"
,
eventParams
,
false
)
);
result
=
cmd
.
execute
.
apply
(
cmd
,
[
me
].
concat
(
cmdArgs
)
);
result
=
cmd
.
execute
.
apply
(
cmd
,
[
me
].
concat
(
cmdArgs
)
);
this
.
_fire
(
new
MinderEvent
(
'execCommand'
,
eventParams
,
false
)
);
this
.
_fire
(
new
MinderEvent
(
'execCommand'
,
eventParams
,
false
)
);
//保存场景
this
.
_fire
(
new
MinderEvent
(
'saveScene'
)
);
this
.
_fire
(
new
MinderEvent
(
'saveScene'
)
);
if
(
cmd
.
isContentChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'contentchange'
)
);
if
(
cmd
.
isContentChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'contentchange'
)
);
}
if
(
cmd
.
isSelectionChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'selectionchange'
)
);
if
(
cmd
.
isSelectionChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'selectionchange'
)
);
}
this
.
_firePharse
(
new
MinderEvent
(
'interactchange'
)
);
this
.
_firePharse
(
new
MinderEvent
(
'interactchange'
)
);
}
this
.
_hasEnterExecCommand
=
false
;
}
else
{
result
=
cmd
.
execute
.
apply
(
cmd
,
[
me
].
concat
(
cmdArgs
)
);
result
=
cmd
.
execute
.
apply
(
cmd
,
[
me
].
concat
(
cmdArgs
)
);
if
(
!
this
.
_hasEnterExecCommand
)
{
if
(
cmd
.
isSelectionChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'selectionchange'
)
);
if
(
!
this
.
_hasEnterExecCommand
)
{
if
(
cmd
.
isSelectionChanged
()
)
{
this
.
_firePharse
(
new
MinderEvent
(
'selectionchange'
)
);
}
this
.
_firePharse
(
new
MinderEvent
(
'interactchange'
)
);
this
.
_firePharse
(
new
MinderEvent
(
'interactchange'
)
);
}
}
return
result
===
undefined
?
null
:
result
;
}
}
);
\ No newline at end of file
});
\ No newline at end of file
src/module/history.js
View file @
5584facc
This diff is collapsed.
Click to expand it.
src/module/layout.default.js
View file @
5584facc
...
...
@@ -266,7 +266,7 @@ KityMinder.registerModule("LayoutDefault", function () {
var
result
=
[];
for
(
var
len
=
0
;
len
<
children
.
length
;
len
++
)
{
var
l
=
children
[
len
].
getLayout
();
if
(
l
.
added
)
{
if
(
l
&&
l
.
added
)
{
result
.
push
(
children
[
len
]);
}
}
...
...
@@ -442,65 +442,6 @@ KityMinder.registerModule("LayoutDefault", function () {
getCurrentLayoutStyle
:
function
()
{
return
nodeStyles
;
},
highlightNode
:
function
(
node
)
{
var
highlight
=
node
.
isHighlight
();
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
Layout
=
node
.
getLayout
();
switch
(
nodeType
)
{
case
"root"
:
case
"main"
:
if
(
highlight
)
{
Layout
.
bgRect
.
fill
(
nodeStyle
.
highlight
);
}
else
{
Layout
.
bgRect
.
fill
(
nodeStyle
.
fill
);
}
break
;
case
"sub"
:
if
(
highlight
)
{
Layout
.
highlightshape
.
fill
(
nodeStyle
.
highlight
).
setOpacity
(
1
);
node
.
getTextShape
().
fill
(
node
.
getData
(
'fontcolor'
)
||
'black'
);
}
else
{
Layout
.
highlightshape
.
setOpacity
(
0
);
node
.
getTextShape
().
fill
(
node
.
getData
(
'fontcolor'
)
||
'white'
);
}
break
;
default
:
break
;
}
},
updateLayout
:
function
(
node
)
{
node
.
getContRc
().
clear
();
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeLeft"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeCenter"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeRight"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeBottom"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeTop"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNode"
,
{
node
:
node
},
false
));
updateShapeByCont
(
node
);
var
set1
=
updateLayoutHorizon
(
node
);
var
set2
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"change"
);
var
set
=
uSet
(
set1
,
set2
);
for
(
var
i
=
0
;
i
<
set
.
length
;
i
++
)
{
translateNode
(
set
[
i
]);
updateConnectAndshIcon
(
set
[
i
]);
}
if
(
this
.
isNodeSelected
(
node
))
{
this
.
highlightNode
(
node
)
}
},
initStyle
:
function
()
{
//渲染根节点
var
_root
=
minder
.
getRoot
();
...
...
@@ -545,6 +486,38 @@ KityMinder.registerModule("LayoutDefault", function () {
}
_root
.
setPoint
(
_root
.
getLayout
().
x
,
_root
.
getLayout
().
y
);
},
updateLayout
:
function
(
node
)
{
node
.
getContRc
().
clear
();
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeLeft"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeCenter"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeRight"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeBottom"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNodeTop"
,
{
node
:
node
},
false
));
this
.
_firePharse
(
new
MinderEvent
(
"RenderNode"
,
{
node
:
node
},
false
));
updateShapeByCont
(
node
);
var
set1
=
updateLayoutHorizon
(
node
);
var
set2
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"change"
);
var
set
=
uSet
(
set1
,
set2
);
for
(
var
i
=
0
;
i
<
set
.
length
;
i
++
)
{
translateNode
(
set
[
i
]);
updateConnectAndshIcon
(
set
[
i
]);
}
if
(
this
.
isNodeSelected
(
node
))
{
this
.
highlightNode
(
node
)
}
},
expandNode
:
function
(
ico
)
{
var
isExpand
,
node
;
if
(
ico
instanceof
MinderNode
)
{
...
...
@@ -746,6 +719,33 @@ KityMinder.registerModule("LayoutDefault", function () {
_buffer
.
shift
();
}
}
},
highlightNode
:
function
(
node
)
{
var
highlight
=
node
.
isHighlight
();
var
nodeType
=
node
.
getType
();
var
nodeStyle
=
nodeStyles
[
nodeType
];
var
Layout
=
node
.
getLayout
();
switch
(
nodeType
)
{
case
"root"
:
case
"main"
:
if
(
highlight
)
{
Layout
.
bgRect
.
fill
(
nodeStyle
.
highlight
);
}
else
{
Layout
.
bgRect
.
fill
(
nodeStyle
.
fill
);
}
break
;
case
"sub"
:
if
(
highlight
)
{
Layout
.
highlightshape
.
fill
(
nodeStyle
.
highlight
).
setOpacity
(
1
);
node
.
getTextShape
().
fill
(
node
.
getData
(
'fontcolor'
)
||
'black'
);
}
else
{
Layout
.
highlightshape
.
setOpacity
(
0
);
node
.
getTextShape
().
fill
(
node
.
getData
(
'fontcolor'
)
||
'white'
);
}
break
;
default
:
break
;
}
}
};
this
.
addLayoutStyle
(
"default"
,
_style
);
...
...
src/module/layout.js
View file @
5584facc
...
...
@@ -283,21 +283,21 @@ KityMinder.registerModule("LayoutModule", function () {
cmdName
:
'removenode'
},
{
divider
:
1
},{
label
:
this
.
getLang
(
'layout.default'
),
exec
:
function
()
{
this
.
execCommand
(
'switchlayout'
,
'default'
);
this
.
initStyle
();
},
cmdName
:
'switchlayout'
},
{
label
:
this
.
getLang
(
'layout.bottom'
),
exec
:
function
()
{
this
.
execCommand
(
'switchlayout'
,
'bottom'
);
this
.
initStyle
();
},
cmdName
:
'switchlayout'
}
},
{
label
:
this
.
getLang
(
'layout.default'
),
exec
:
function
()
{
this
.
execCommand
(
'switchlayout'
,
'default'
);
this
.
initStyle
();
},
cmdName
:
'switchlayout'
},
{
label
:
this
.
getLang
(
'layout.bottom'
),
exec
:
function
()
{
this
.
execCommand
(
'switchlayout'
,
'bottom'
);
this
.
initStyle
();
},
cmdName
:
'switchlayout'
}
],
"defaultOptions"
:
{
...
...
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