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
1926eda1
Commit
1926eda1
authored
Jan 21, 2015
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
animate switcher
parent
32ddd2cd
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
72 additions
and
21 deletions
+72
-21
Gruntfile.js
Gruntfile.js
+2
-2
animate.js
src/core/animate.js
+39
-0
keyreceiver.js
src/core/keyreceiver.js
+1
-1
layout.js
src/core/layout.js
+7
-7
module.js
src/core/module.js
+1
-1
option.js
src/core/option.js
+4
-1
expose-kityminder.js
src/expose-kityminder.js
+3
-0
kityminder.js
src/kityminder.js
+1
-0
clipboard.js
src/module/clipboard.js
+3
-1
text.js
src/module/text.js
+1
-1
view.js
src/module/view.js
+6
-4
zoom.js
src/module/zoom.js
+4
-3
No files found.
Gruntfile.js
View file @
1926eda1
...
...
@@ -26,7 +26,7 @@ module.exports = function(grunt) {
' * ====================================================
\
n'
+
' */
\
n
\
n'
;
var
expose
=
'
\
nuse(
\'
expose
\'
);
\
n'
;
var
expose
=
'
\
nuse(
\'
expose
-kityminder
\'
);
\
n'
;
// Project configuration.
grunt
.
initConfig
({
...
...
@@ -42,7 +42,7 @@ module.exports = function(grunt) {
dependence
:
{
options
:
{
base
:
'src'
,
entrance
:
'expose'
entrance
:
'expose
-kityminder
'
},
merge
:
{
files
:
[{
...
...
src/core/animate.js
0 → 100644
View file @
1926eda1
/**
* @fileOverview
*
* 动画控制
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
define
(
function
(
require
,
exports
,
module
)
{
var
Minder
=
require
(
'./minder'
);
var
animateDefaultOptions
=
{
layoutAnimationDuration
:
300
,
viewAnimationDuration
:
100
,
zoomAnimationDuration
:
300
};
var
resoredAnimationOptions
=
{};
Minder
.
registerInitHook
(
function
()
{
this
.
setDefaultOptions
(
animateDefaultOptions
);
});
Minder
.
prototype
.
enableAnimation
=
function
()
{
for
(
var
name
in
animateDefaultOptions
)
{
if
(
animateDefaultOptions
.
hasOwnProperty
(
name
))
{
this
.
setOption
(
resoredAnimationOptions
[
name
]);
}
}
};
Minder
.
prototype
.
disableAnimation
=
function
()
{
for
(
var
name
in
animateDefaultOptions
)
{
if
(
animateDefaultOptions
.
hasOwnProperty
(
name
))
{
resoredAnimationOptions
[
name
]
=
this
.
getOption
(
name
);
this
.
setOption
(
name
,
0
);
}
}
};
});
\ No newline at end of file
src/core/keyreceiver.js
View file @
1926eda1
...
...
@@ -10,7 +10,7 @@ define(function(require, exports, module) {
}
Minder
.
registerInitHook
(
function
(
option
)
{
this
.
addDefaultOption
({
this
.
setDefaultOptions
({
enableKeyReceiver
:
true
});
if
(
this
.
getOption
(
'enableKeyReceiver'
))
{
...
...
src/core/layout.js
View file @
1926eda1
...
...
@@ -219,9 +219,9 @@ define(function(require, exports, module) {
return
this
;
},
layout
:
function
(
name
,
duration
)
{
layout
:
function
(
name
)
{
this
.
setLayout
(
name
).
getMinder
().
layout
(
duration
);
this
.
setLayout
(
name
).
getMinder
().
layout
();
return
this
;
},
...
...
@@ -398,7 +398,9 @@ define(function(require, exports, module) {
*/
kity
.
extendClass
(
Minder
,
{
layout
:
function
(
duration
)
{
layout
:
function
()
{
var
duration
=
this
.
getOption
(
'layoutAnimationDuration'
);
this
.
getRoot
().
traverse
(
function
(
node
)
{
// clear last results
...
...
@@ -428,8 +430,6 @@ define(function(require, exports, module) {
// 第二轮布局
layoutNode
(
this
.
getRoot
(),
2
);
duration
=
duration
?
300
:
0
;
var
minder
=
this
;
this
.
applyLayoutResult
(
this
.
getRoot
(),
duration
,
function
()
{
minder
.
fire
(
'layoutallfinish'
);
...
...
@@ -438,9 +438,9 @@ define(function(require, exports, module) {
return
this
.
fire
(
'layout'
);
},
refresh
:
function
(
duration
)
{
refresh
:
function
()
{
this
.
getRoot
().
renderTree
();
this
.
layout
(
duration
).
fire
(
'contentchange'
).
_interactChange
();
this
.
layout
().
fire
(
'contentchange'
).
_interactChange
();
return
this
;
},
...
...
src/core/module.js
View file @
1926eda1
...
...
@@ -47,7 +47,7 @@ define(function(require, exports, module) {
if
(
!
moduleDeals
)
continue
;
if
(
moduleDeals
.
defaultOptions
)
{
me
.
addDefaultOption
(
moduleDeals
.
defaultOptions
);
me
.
setDefaultOptions
(
moduleDeals
.
defaultOptions
);
}
if
(
moduleDeals
.
init
)
{
...
...
src/core/option.js
View file @
1926eda1
...
...
@@ -16,7 +16,7 @@ define(function(require, exports, module) {
});
kity
.
extendClass
(
Minder
,
{
addDefaultOption
:
function
(
options
)
{
setDefaultOptions
:
function
(
options
)
{
utils
.
extend
(
this
.
_defaultOptions
,
options
);
return
this
;
},
...
...
@@ -26,6 +26,9 @@ define(function(require, exports, module) {
}
else
{
return
utils
.
extend
({},
this
.
_defaultOptions
,
this
.
_options
);
}
},
setOption
:
function
(
key
,
value
)
{
this
.
_options
[
key
]
=
value
;
}
});
});
\ No newline at end of file
src/expose.js
→
src/expose
-kityminder
.js
View file @
1926eda1
define
(
'expose'
,
function
(
require
,
exports
,
module
)
{
define
(
'expose
-kityminder
'
,
function
(
require
,
exports
,
module
)
{
module
.
exports
=
window
.
kityminder
=
require
(
'./kityminder'
);
});
\ No newline at end of file
src/kityminder.js
View file @
1926eda1
...
...
@@ -20,6 +20,7 @@ define(function(require, exports, module) {
kityminder
.
Command
=
require
(
'./core/command'
);
kityminder
.
Node
=
require
(
'./core/node'
);
require
(
'./core/option'
);
require
(
'./core/animate'
);
kityminder
.
Event
=
require
(
'./core/event'
);
kityminder
.
data
=
require
(
'./core/data'
);
require
(
'./core/compatibility'
);
...
...
src/module/clipboard.js
View file @
1926eda1
...
...
@@ -17,7 +17,9 @@ define(function(require, exports, module) {
km
.
appendNode
(
child
,
parent
);
child
.
render
();
child
.
setLayoutOffset
(
null
);
var
children
=
utils
.
cloneArr
(
child
.
children
);
var
children
=
child
.
children
.
map
(
function
(
node
)
{
return
node
.
clone
();
});
for
(
var
i
=
0
,
ci
;
(
ci
=
children
[
i
]);
i
++
)
{
appendChildNode
(
child
,
ci
);
...
...
src/module/text.js
View file @
1926eda1
...
...
@@ -73,7 +73,7 @@ define(function(require, exports, module) {
for
(
i
=
0
,
text
,
textShape
;
(
text
=
textArr
[
i
],
textShape
=
textGroup
.
getItem
(
i
));
i
++
)
{
textShape
.
node
.
innerHTML
=
text
.
replace
(
'<'
,
'<'
).
replace
(
'>'
,
'>'
);
textShape
.
setContent
(
text
);
}
this
.
setTextStyle
(
node
,
textGroup
);
...
...
src/module/view.js
View file @
1926eda1
...
...
@@ -72,7 +72,7 @@ define(function(require, exports, module) {
getView
:
function
()
{
var
minder
=
this
.
_minder
;
var
c
=
{
var
c
=
minder
.
_lastClientSize
||
{
width
:
minder
.
getRenderTarget
().
clientWidth
,
height
:
minder
.
getRenderTarget
().
clientHeight
};
...
...
@@ -208,7 +208,7 @@ define(function(require, exports, module) {
*/
var
CameraCommand
=
kity
.
createClass
(
'CameraCommand'
,
{
base
:
Command
,
execute
:
function
(
km
,
focusNode
,
duration
)
{
execute
:
function
(
km
,
focusNode
)
{
focusNode
=
focusNode
||
km
.
getRoot
();
var
viewport
=
km
.
getPaper
().
getViewPort
();
...
...
@@ -217,6 +217,7 @@ define(function(require, exports, module) {
dy
=
viewport
.
center
.
y
-
offset
.
y
;
var
dragger
=
km
.
_viewDragger
;
var
duration
=
km
.
getOption
(
'viewAnimationDuration'
);
dragger
.
move
(
new
kity
.
Point
(
dx
,
dy
),
duration
);
this
.
setContentChanged
(
false
);
},
...
...
@@ -238,9 +239,10 @@ define(function(require, exports, module) {
var
MoveCommand
=
kity
.
createClass
(
'MoveCommand'
,
{
base
:
Command
,
execute
:
function
(
km
,
dir
,
duration
)
{
execute
:
function
(
km
,
dir
)
{
var
dragger
=
km
.
_viewDragger
;
var
size
=
km
.
_lastClientSize
;
var
duration
=
km
.
getOption
(
'viewAnimationDuration'
);
switch
(
dir
)
{
case
'up'
:
dragger
.
move
(
new
kity
.
Point
(
0
,
size
.
height
/
2
),
duration
);
...
...
@@ -345,7 +347,7 @@ define(function(require, exports, module) {
}
if
(
dx
||
dy
)
{
dragger
.
move
(
new
kity
.
Point
(
dx
,
dy
)
,
100
);
dragger
.
move
(
new
kity
.
Point
(
dx
,
dy
));
}
}
}
...
...
src/module/zoom.js
View file @
1926eda1
...
...
@@ -50,7 +50,8 @@ define(function(require, exports, module) {
setTextRendering
();
if
(
minder
.
getRoot
().
getComplex
()
>
200
)
{
var
duration
=
minder
.
getOption
(
'zoomAnimationDuration'
);
if
(
minder
.
getRoot
().
getComplex
()
>
200
||
!
duration
)
{
minder
.
_zoomValue
=
value
;
minder
.
zoom
(
value
);
minder
.
fire
(
'viewchange'
);
...
...
@@ -66,7 +67,7 @@ define(function(require, exports, module) {
if
(
timeline
)
{
timeline
.
pause
();
}
timeline
=
animator
.
start
(
minder
,
300
,
'easeInOutSine'
);
timeline
=
animator
.
start
(
minder
,
duration
,
'easeInOutSine'
);
timeline
.
on
(
'finish'
,
function
()
{
minder
.
fire
(
'viewchange'
);
});
...
...
@@ -148,7 +149,7 @@ define(function(require, exports, module) {
return
{
init
:
function
()
{
this
.
_zoomValue
=
100
;
this
.
addDefaultOption
({
this
.
setDefaultOptions
({
zoom
:
[
10
,
20
,
50
,
100
,
200
]
});
setTextRendering
();
...
...
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