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
016b3222
Commit
016b3222
authored
Feb 12, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
14502fba
d0f3ce2b
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
4551 additions
and
4357 deletions
+4551
-4357
dev.html
demo/dev.html
+1
-1
kity.all.js
demo/kity.all.js
+4159
-4167
dev.php
dist/dev.php
+2
-1
adapter.js
src/adapter/adapter.js
+72
-72
minder.data.js
src/core/minder.data.js
+80
-28
minder.node.js
src/core/minder.node.js
+1
-1
node.js
src/core/node.js
+4
-1
font.js
src/module/font.js
+42
-19
history.js
src/module/history.js
+2
-0
layout.default.js
src/module/layout.default.js
+60
-65
layout.js
src/module/layout.js
+10
-2
json.js
src/protocal/json.js
+19
-0
plain.js
src/protocal/plain.js
+99
-0
No files found.
demo/dev.html
View file @
016b3222
...
...
@@ -22,6 +22,6 @@
</div>
</body>
<script>
var
km
=
KM
.
getKityMinder
(
'kityminder'
);
window
.
km
=
KM
.
getKityMinder
(
'kityminder'
);
</script>
</html>
\ No newline at end of file
demo/kity.all.js
View file @
016b3222
/*!
* ====================================================
* kitygraph - v1.0.0 - 2014-0
1-24
* kitygraph - v1.0.0 - 2014-0
2-12
* https://github.com/kitygraph/kity
* GitHub: https://github.com/kitygraph/kity.git
* Copyright (c) 2014 Baidu UEditor Group; Licensed MIT
...
...
@@ -8,14 +8,14 @@
*/
(
function
()
{
/**
/**
* cmd 内部定义
*/
// 模块存储
var
_modules
=
{};
var
_modules
=
{};
function
define
(
id
,
deps
,
factory
)
{
function
define
(
id
,
deps
,
factory
)
{
_modules
[
id
]
=
{
...
...
@@ -45,9 +45,9 @@
}
}
}
function
require
(
id
)
{
function
require
(
id
)
{
var
module
=
_modules
[
id
],
exports
=
null
;
...
...
@@ -78,14 +78,14 @@
return
module
.
value
;
}
}
function
use
(
id
)
{
function
use
(
id
)
{
return
require
(
id
);
}
define
(
"animate/animator"
,
[
"animate/timeline"
,
"graphic/color"
,
"graphic/matrix"
,
"graphic/eventhandler"
,
"core/class"
,
"animate/easing"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
}
define
(
"animate/animator"
,
[
"animate/timeline"
,
"graphic/color"
,
"graphic/matrix"
,
"graphic/eventhandler"
,
"core/class"
,
"animate/easing"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
function
parseTime
(
str
)
{
var
value
=
parseFloat
(
str
,
10
);
if
(
/ms/
.
test
(
str
))
{
...
...
@@ -180,15 +180,15 @@
}
});
return
Animator
;
});
/**
});
/**
* Kity Animate Easing modified from jQuery Easing
* Author: techird
* Changes:
* 1. make easing functions standalone
* 2. remove the 'x' parameter
*/
/* ============================================================
/* ============================================================
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Open source under the BSD License.
...
...
@@ -197,7 +197,7 @@
* All rights reserved.
* https://raw.github.com/danro/jquery-easing/master/LICENSE
* ======================================================== */
define
(
"animate/easing"
,
[],
function
(
require
,
exports
,
module
)
{
define
(
"animate/easing"
,
[],
function
(
require
,
exports
,
module
)
{
var
easings
=
{
// t: current_time, b: begin_value, c: change_value, d: duration
linear
:
function
(
t
,
b
,
c
,
d
)
{
...
...
@@ -353,8 +353,8 @@
}
};
return
easings
;
});
define
(
"animate/opacityanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"animate/opacityanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Animator
=
require
(
"animate/animator"
);
var
Matrix
=
require
(
"graphic/matrix"
);
var
OpacityAnimator
=
require
(
"core/class"
).
createClass
(
"OpacityAnimator"
,
{
...
...
@@ -387,8 +387,8 @@
}
});
return
OpacityAnimator
;
});
define
(
"animate/rotateanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"animate/rotateanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Animator
=
require
(
"animate/animator"
);
var
Matrix
=
require
(
"graphic/matrix"
);
var
RotateAnimator
=
require
(
"core/class"
).
createClass
(
"RotateAnimator"
,
{
...
...
@@ -414,8 +414,8 @@
}
});
return
RotateAnimator
;
});
define
(
"animate/scaleanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"animate/scaleanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Animator
=
require
(
"animate/animator"
);
var
Matrix
=
require
(
"graphic/matrix"
);
var
ScaleAnimator
=
require
(
"core/class"
).
createClass
(
"ScaleAnimator"
,
{
...
...
@@ -440,8 +440,8 @@
}
});
return
ScaleAnimator
;
});
define
(
"animate/timeline"
,
[
"graphic/color"
,
"core/utils"
,
"graphic/standardcolor"
,
"core/class"
,
"graphic/matrix"
,
"graphic/vector"
,
"graphic/eventhandler"
,
"graphic/shapeevent"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"animate/timeline"
,
[
"graphic/color"
,
"core/utils"
,
"graphic/standardcolor"
,
"core/class"
,
"graphic/matrix"
,
"graphic/vector"
,
"graphic/eventhandler"
,
"graphic/shapeevent"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Color
=
require
(
"graphic/color"
);
var
Matrix
=
require
(
"graphic/matrix"
);
var
EventHandler
=
require
(
"graphic/eventhandler"
);
...
...
@@ -692,8 +692,8 @@
}
});
return
Timeline
;
});
define
(
"animate/translateanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"animate/translateanimator"
,
[
"animate/animator"
,
"animate/timeline"
,
"animate/easing"
,
"core/class"
,
"graphic/shape"
,
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Animator
=
require
(
"animate/animator"
);
var
Matrix
=
require
(
"graphic/matrix"
);
var
TranslateAnimator
=
require
(
"core/class"
).
createClass
(
"TranslateAnimator"
,
{
...
...
@@ -718,8 +718,8 @@
}
});
return
TranslateAnimator
;
});
/**
});
/**
* @description 创建一个类
* @param {String} fullClassName 类全名,包括命名空间。
* @param {Plain} defines 要创建的类的特性
...
...
@@ -731,7 +731,7 @@
* TODO:
* Mixin 构造函数调用支持
*/
define
(
"core/class"
,
[
"core/config"
],
function
(
require
,
exports
)
{
define
(
"core/class"
,
[
"core/config"
],
function
(
require
,
exports
)
{
// just to bind context
Function
.
prototype
.
bind
=
Function
.
prototype
.
bind
||
function
(
thisObj
)
{
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
,
1
);
...
...
@@ -894,14 +894,14 @@
return
NewClass
;
};
exports
.
extendClass
=
extend
;
});
define
(
"core/config"
,
[],
function
(
require
,
exports
,
module
)
{
});
define
(
"core/config"
,
[],
function
(
require
,
exports
,
module
)
{
return
{
debug
:
true
,
version
:
"1.0.0"
};
});
define
(
"core/utils"
,
[],
function
(
require
,
exports
,
module
)
{
});
define
(
"core/utils"
,
[],
function
(
require
,
exports
,
module
)
{
var
utils
=
{
each
:
function
(
obj
,
iterator
,
context
)
{
if
(
obj
===
null
)
{
...
...
@@ -954,11 +954,11 @@
};
});
return
utils
;
});
/**
});
/**
* 颜色矩阵运算效果封装
*/
define
(
"filter/effect/colormatrixeffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/effect/colormatrixeffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Effect
=
require
(
"filter/effect/effect"
),
Utils
=
require
(
"core/utils"
);
var
ColorMatrixEffect
=
require
(
"core/class"
).
createClass
(
"ColorMatrixEffect"
,
{
base
:
Effect
,
...
...
@@ -979,11 +979,11 @@
MATRIX_EMPTY
:
"00000000000000000000"
.
split
(
""
).
join
(
" "
)
});
return
ColorMatrixEffect
;
});
/**
});
/**
* 高斯模糊效果封装
*/
define
(
"filter/effect/compositeeffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/effect/compositeeffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Effect
=
require
(
"filter/effect/effect"
),
Utils
=
require
(
"core/utils"
);
var
CompositeEffect
=
require
(
"core/class"
).
createClass
(
"CompositeEffect"
,
{
base
:
Effect
,
...
...
@@ -1008,11 +1008,11 @@
OPERATOR_ARITHMETIC
:
"arithmetic"
});
return
CompositeEffect
;
});
/**
});
/**
* 像素级别的矩阵卷积运算效果封装
*/
define
(
"filter/effect/convolvematrixeffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/effect/convolvematrixeffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Effect
=
require
(
"filter/effect/effect"
),
Utils
=
require
(
"core/utils"
);
var
ConvolveMatrixEffect
=
require
(
"core/class"
).
createClass
(
"ConvolveMatrixEffect"
,
{
base
:
Effect
,
...
...
@@ -1028,12 +1028,12 @@
MODE_NONE
:
"none"
});
return
ConvolveMatrixEffect
;
});
/*
});
/*
* 效果类
* 该类型的对象不存储任何内部属性, 所有操作都是针对该类对象所维护的节点进行的
*/
define
(
"filter/effect/effect"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
,
"core/utils"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/effect/effect"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
,
"core/utils"
],
function
(
require
,
exports
,
module
)
{
var
svg
=
require
(
"graphic/svg"
),
Effect
=
require
(
"core/class"
).
createClass
(
"Effect"
,
{
constructor
:
function
(
type
)
{
this
.
node
=
svg
.
createNode
(
type
);
...
...
@@ -1076,11 +1076,11 @@
INPUT_STROKE_PAINT
:
"StrokePaint"
});
return
Effect
;
});
/**
});
/**
* 高斯模糊效果封装
*/
define
(
"filter/effect/gaussianblureffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/effect/gaussianblureffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Effect
=
require
(
"filter/effect/effect"
),
Utils
=
require
(
"core/utils"
);
return
require
(
"core/class"
).
createClass
(
"GaussianblurEffect"
,
{
base
:
Effect
,
...
...
@@ -1090,11 +1090,11 @@
this
.
set
(
"in"
,
Utils
.
getValue
(
input
,
Effect
.
INPUT_SOURCE_GRAPHIC
));
}
});
});
/**
});
/**
* 偏移效果封装
*/
define
(
"filter/effect/offseteffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/effect/offseteffect"
,
[
"filter/effect/effect"
,
"graphic/svg"
,
"core/class"
,
"core/utils"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Effect
=
require
(
"filter/effect/effect"
),
Utils
=
require
(
"core/utils"
);
return
require
(
"core/class"
).
createClass
(
"OffsetEffect"
,
{
base
:
Effect
,
...
...
@@ -1105,11 +1105,11 @@
this
.
set
(
"in"
,
Utils
.
getValue
(
input
,
Effect
.
INPUT_SOURCE_GRAPHIC
));
}
});
});
/*
});
/*
* Effect所用的container
*/
define
(
"filter/effectcontainer"
,
[
"core/class"
,
"core/config"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/effectcontainer"
,
[
"core/class"
,
"core/config"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"EffectContainer"
,
{
base
:
require
(
"graphic/container"
),
addEffect
:
function
(
point
,
pos
)
{
...
...
@@ -1152,11 +1152,11 @@
this
.
node
.
insertBefore
(
effectItem
.
getNode
(),
nextEffectItem
.
getNode
());
}
});
});
/**
});
/**
* Filter 基类
*/
define
(
"filter/filter"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
,
"filter/effectcontainer"
,
"graphic/container"
,
"graphic/shape"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/filter"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
,
"filter/effectcontainer"
,
"graphic/container"
,
"graphic/shape"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
svg
=
require
(
"graphic/svg"
);
var
Class
=
require
(
"core/class"
);
var
Filter
=
Class
.
createClass
(
"Filter"
,
{
...
...
@@ -1205,11 +1205,11 @@
}
});
return
Filter
;
});
/*
});
/*
* 高斯模糊滤镜
*/
define
(
"filter/gaussianblurfilter"
,
[
"filter/effect/gaussianblureffect"
,
"filter/effect/effect"
,
"core/utils"
,
"core/class"
,
"core/config"
,
"filter/filter"
,
"graphic/svg"
,
"filter/effectcontainer"
,
"graphic/shape"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/gaussianblurfilter"
,
[
"filter/effect/gaussianblureffect"
,
"filter/effect/effect"
,
"core/utils"
,
"core/class"
,
"core/config"
,
"filter/filter"
,
"graphic/svg"
,
"filter/effectcontainer"
,
"graphic/shape"
],
function
(
require
,
exports
,
module
)
{
var
GaussianblurEffect
=
require
(
"filter/effect/gaussianblureffect"
);
return
require
(
"core/class"
).
createClass
(
"GaussianblurFilter"
,
{
base
:
require
(
"filter/filter"
),
...
...
@@ -1218,11 +1218,11 @@
this
.
addEffect
(
new
GaussianblurEffect
(
stdDeviation
));
}
});
});
/*
});
/*
* 投影滤镜
*/
define
(
"filter/projectionfilter"
,
[
"filter/effect/gaussianblureffect"
,
"filter/effect/effect"
,
"core/utils"
,
"core/class"
,
"graphic/svg"
,
"filter/effect/colormatrixeffect"
,
"graphic/color"
,
"graphic/standardcolor"
,
"filter/effect/compositeeffect"
,
"filter/effect/offseteffect"
,
"core/config"
,
"filter/filter"
,
"filter/effectcontainer"
,
"graphic/shape"
],
function
(
require
,
exports
,
module
)
{
define
(
"filter/projectionfilter"
,
[
"filter/effect/gaussianblureffect"
,
"filter/effect/effect"
,
"core/utils"
,
"core/class"
,
"graphic/svg"
,
"filter/effect/colormatrixeffect"
,
"graphic/color"
,
"graphic/standardcolor"
,
"filter/effect/compositeeffect"
,
"filter/effect/offseteffect"
,
"core/config"
,
"filter/filter"
,
"filter/effectcontainer"
,
"graphic/shape"
],
function
(
require
,
exports
,
module
)
{
var
GaussianblurEffect
=
require
(
"filter/effect/gaussianblureffect"
),
Effect
=
require
(
"filter/effect/effect"
),
ColorMatrixEffect
=
require
(
"filter/effect/colormatrixeffect"
),
Color
=
require
(
"graphic/color"
),
Utils
=
require
(
"core/utils"
),
CompositeEffect
=
require
(
"filter/effect/compositeeffect"
),
OffsetEffect
=
require
(
"filter/effect/offseteffect"
);
return
require
(
"core/class"
).
createClass
(
"ProjectionFilter"
,
{
base
:
require
(
"filter/filter"
),
...
...
@@ -1285,11 +1285,11 @@
this
.
gaussianblurEffect
.
set
(
"stdDeviation"
,
deviation
);
}
});
});
/**
});
/**
* 贝塞尔曲线
*/
define
(
"graphic/bezier"
,
[
"core/class"
,
"core/config"
,
"graphic/pointcontainer"
,
"graphic/container"
,
"graphic/path"
,
"core/utils"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/bezier"
,
[
"core/class"
,
"core/config"
,
"graphic/pointcontainer"
,
"graphic/container"
,
"graphic/path"
,
"core/utils"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Bezier"
,
{
mixins
:
[
require
(
"graphic/pointcontainer"
)
],
base
:
require
(
"graphic/path"
),
...
...
@@ -1330,11 +1330,11 @@
return
this
;
}
});
});
/**
});
/**
* 贝塞尔点
*/
define
(
"graphic/bezierpoint"
,
[
"graphic/shapepoint"
,
"core/class"
,
"graphic/point"
,
"graphic/vector"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/bezierpoint"
,
[
"graphic/shapepoint"
,
"core/class"
,
"graphic/point"
,
"graphic/vector"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
ShapePoint
=
require
(
"graphic/shapepoint"
);
var
Vector
=
require
(
"graphic/vector"
);
var
BezierPoint
=
require
(
"core/class"
).
createClass
(
"BezierPoint"
,
{
...
...
@@ -1430,8 +1430,8 @@
}
});
return
BezierPoint
;
});
define
(
"graphic/circle"
,
[
"core/class"
,
"core/config"
,
"graphic/ellipse"
,
"core/utils"
,
"graphic/path"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/circle"
,
[
"core/class"
,
"core/config"
,
"graphic/ellipse"
,
"core/utils"
,
"graphic/path"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Circle"
,
{
base
:
require
(
"graphic/ellipse"
),
constructor
:
function
(
radius
,
cx
,
cy
)
{
...
...
@@ -1444,8 +1444,8 @@
return
this
.
callBase
(
radius
,
radius
);
}
});
});
define
(
"graphic/clip"
,
[
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
,
"graphic/shapecontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/clip"
,
[
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
,
"graphic/shapecontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
var
Class
=
require
(
"core/class"
);
var
Shape
=
require
(
"graphic/shape"
);
var
Clip
=
Class
.
createClass
(
"Clip"
,
{
...
...
@@ -1466,8 +1466,8 @@
}
});
return
Clip
;
});
define
(
"graphic/color"
,
[
"core/utils"
,
"graphic/standardcolor"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/color"
,
[
"core/utils"
,
"graphic/standardcolor"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Utils
=
require
(
"core/utils"
),
StandardColor
=
require
(
"graphic/standardcolor"
),
ColorUtils
=
{},
Color
=
require
(
"core/class"
).
createClass
(
"Color"
,
{
constructor
:
function
()
{
var
colorValue
=
null
;
...
...
@@ -1816,8 +1816,8 @@
}
});
return
Color
;
});
define
(
"graphic/container"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/container"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
function
itemRemove
()
{
this
.
container
.
removeItem
(
this
);
return
this
;
...
...
@@ -1881,19 +1881,11 @@
if
(
typeof
pos
!==
"number"
)
{
return
this
.
removeItem
(
this
.
indexOf
(
pos
));
}
var
items
=
this
.
getItems
(),
length
=
items
.
length
,
item
=
items
[
pos
],
before
,
after
;
var
items
=
this
.
getItems
(),
length
=
items
.
length
,
item
=
items
[
pos
]
;
if
(
item
===
undefined
)
{
return
this
;
}
if
(
pos
===
0
)
{
items
.
shift
();
}
else
if
(
pos
==
length
-
1
)
{
items
.
pop
();
}
else
{
before
=
items
.
slice
(
0
,
pos
);
after
=
items
.
slice
(
pos
+
1
);
this
.
items
=
before
.
concat
(
after
);
}
this
.
items
.
splice
(
pos
,
1
);
if
(
item
.
container
)
{
delete
item
.
container
;
}
...
...
@@ -1920,11 +1912,11 @@
handleAdd
:
function
(
item
,
index
)
{},
handleRemove
:
function
(
item
,
index
)
{}
});
});
/*
});
/*
* 曲线
* */
define
(
"graphic/curve"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/pointcontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/curve"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/pointcontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
var
Utils
=
require
(
"core/utils"
),
CurveUtil
=
{
/*
* 获取由两个以上的点组成的曲线的平移线
...
...
@@ -2113,8 +2105,8 @@
return
!!
this
.
closeState
;
}
});
});
define
(
"graphic/data"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/data"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Data"
,
{
constructor
:
function
()
{
this
.
_data
=
{};
...
...
@@ -2131,8 +2123,8 @@
return
this
;
}
});
});
define
(
"graphic/defbrush"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/defbrush"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
svg
=
require
(
"graphic/svg"
);
return
require
(
"core/class"
).
createClass
(
"GradientBrush"
,
{
constructor
:
function
(
nodeType
)
{
...
...
@@ -2145,8 +2137,8 @@
return
this
;
}
});
});
define
(
"graphic/ellipse"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/ellipse"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
var
Utils
=
require
(
"core/utils"
);
return
require
(
"core/class"
).
createClass
(
"Ellipse"
,
{
base
:
require
(
"graphic/path"
),
...
...
@@ -2219,11 +2211,11 @@
return
this
.
update
();
}
});
});
/*
});
/*
* kity event 实现
*/
define
(
"graphic/eventhandler"
,
[
"core/utils"
,
"graphic/shapeevent"
,
"graphic/matrix"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/eventhandler"
,
[
"core/utils"
,
"graphic/shapeevent"
,
"graphic/matrix"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
// polyfill
(
function
()
{
function
CustomEvent
(
event
,
params
)
{
...
...
@@ -2398,8 +2390,8 @@
return
this
;
}
});
});
define
(
"graphic/gradientbrush"
,
[
"graphic/svg"
,
"graphic/defbrush"
,
"core/class"
,
"graphic/color"
,
"core/utils"
,
"graphic/standardcolor"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/gradientbrush"
,
[
"graphic/svg"
,
"graphic/defbrush"
,
"core/class"
,
"graphic/color"
,
"core/utils"
,
"graphic/standardcolor"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
svg
=
require
(
"graphic/svg"
);
var
DefBrush
=
require
(
"graphic/defbrush"
);
var
Color
=
require
(
"graphic/color"
);
...
...
@@ -2426,8 +2418,8 @@
return
this
;
}
});
});
define
(
"graphic/group"
,
[
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"core/class"
,
"graphic/shape"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/group"
,
[
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"core/class"
,
"graphic/shape"
,
"core/config"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
ShapeContainer
=
require
(
"graphic/shapecontainer"
);
return
require
(
"core/class"
).
createClass
(
"Group"
,
{
mixins
:
[
ShapeContainer
],
...
...
@@ -2436,8 +2428,8 @@
this
.
callBase
(
"g"
);
}
});
});
define
(
"graphic/image"
,
[
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/image"
,
[
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Image"
,
{
base
:
require
(
"graphic/shape"
),
constructor
:
function
(
url
,
width
,
height
,
x
,
y
)
{
...
...
@@ -2493,8 +2485,8 @@
return
this
.
y
;
}
});
});
define
(
"graphic/line"
,
[
"core/class"
,
"core/config"
,
"graphic/path"
,
"core/utils"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/line"
,
[
"core/class"
,
"core/config"
,
"graphic/path"
,
"core/utils"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Line"
,
{
base
:
require
(
"graphic/path"
),
constructor
:
function
(
x1
,
y1
,
x2
,
y2
)
{
...
...
@@ -2539,8 +2531,8 @@
return
this
;
}
});
});
define
(
"graphic/lineargradientbrush"
,
[
"graphic/svg"
,
"graphic/gradientbrush"
,
"graphic/defbrush"
,
"graphic/color"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/lineargradientbrush"
,
[
"graphic/svg"
,
"graphic/gradientbrush"
,
"graphic/defbrush"
,
"graphic/color"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
className
=
"LinearGradientBrush"
;
var
svg
=
require
(
"graphic/svg"
);
var
GradientBrush
=
require
(
"graphic/gradientbrush"
);
...
...
@@ -2577,11 +2569,11 @@
};
}
});
});
/**
});
/**
* 蒙板
*/
define
(
"graphic/mask"
,
[
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
,
"graphic/shapecontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/mask"
,
[
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
,
"graphic/shapecontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
var
Class
=
require
(
"core/class"
);
var
Shape
=
require
(
"graphic/shape"
);
var
Mask
=
Class
.
createClass
(
"Mask"
,
{
...
...
@@ -2602,8 +2594,8 @@
}
});
return
Mask
;
});
define
(
"graphic/matrix"
,
[
"core/utils"
,
"graphic/vector"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/matrix"
,
[
"core/utils"
,
"graphic/vector"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
utils
=
require
(
"core/utils"
);
var
mPattern
=
/matrix
\((
.+
)\)
/i
;
var
Vector
=
require
(
"graphic/vector"
);
...
...
@@ -2731,11 +2723,11 @@
return
new
Vector
(
m
.
a
*
x
+
m
.
c
*
y
+
m
.
e
,
m
.
b
*
x
+
m
.
d
*
y
+
m
.
f
);
};
return
Matrix
;
});
/**
});
/**
* 调色板
*/
define
(
"graphic/palette"
,
[
"graphic/standardcolor"
,
"graphic/color"
,
"core/utils"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/palette"
,
[
"graphic/standardcolor"
,
"graphic/color"
,
"core/utils"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
//标准color
var
StandardColor
=
require
(
"graphic/standardcolor"
),
Color
=
require
(
"graphic/color"
),
Utils
=
require
(
"core/utils"
);
var
Palette
=
require
(
"core/class"
).
createClass
(
"Palette"
,
{
...
...
@@ -2834,8 +2826,8 @@
}
});
return
Palette
;
});
define
(
"graphic/paper"
,
[
"core/class"
,
"core/config"
,
"core/utils"
,
"graphic/svg"
,
"graphic/container"
,
"graphic/shapecontainer"
,
"graphic/shape"
,
"graphic/viewbox"
,
"graphic/eventhandler"
,
"graphic/shapeevent"
,
"graphic/styled"
,
"graphic/matrix"
,
"graphic/vector"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/paper"
,
[
"core/class"
,
"core/config"
,
"core/utils"
,
"graphic/svg"
,
"graphic/container"
,
"graphic/shapecontainer"
,
"graphic/shape"
,
"graphic/viewbox"
,
"graphic/eventhandler"
,
"graphic/shapeevent"
,
"graphic/styled"
,
"graphic/matrix"
,
"graphic/vector"
,
"graphic/data"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Class
=
require
(
"core/class"
);
var
utils
=
require
(
"core/utils"
);
var
svg
=
require
(
"graphic/svg"
);
...
...
@@ -2963,8 +2955,8 @@
}
});
return
Paper
;
});
define
(
"graphic/path"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/path"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Utils
=
require
(
"core/utils"
);
var
createClass
=
require
(
"core/class"
).
createClass
;
var
Shape
=
require
(
"graphic/shape"
);
...
...
@@ -3071,8 +3063,8 @@
return
!!~
data
.
indexOf
(
"z"
)
||
!!~
data
.
indexOf
(
"Z"
);
}
});
});
define
(
"graphic/patternbrush"
,
[
"graphic/defbrush"
,
"graphic/svg"
,
"core/class"
,
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"graphic/shape"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/patternbrush"
,
[
"graphic/defbrush"
,
"graphic/svg"
,
"core/class"
,
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"graphic/shape"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
DefBrush
=
require
(
"graphic/defbrush"
);
var
ShapeContainer
=
require
(
"graphic/shapecontainer"
);
var
svg
=
require
(
"graphic/svg"
);
...
...
@@ -3110,8 +3102,8 @@
return
this
.
height
;
}
});
});
define
(
"graphic/pen"
,
[
"graphic/color"
,
"core/utils"
,
"graphic/standardcolor"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/pen"
,
[
"graphic/color"
,
"core/utils"
,
"graphic/standardcolor"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Color
=
require
(
"graphic/color"
);
return
require
(
"core/class"
).
createClass
(
"Pen"
,
{
constructor
:
function
(
color
,
width
)
{
...
...
@@ -3185,11 +3177,11 @@
}
}
});
});
/*
});
/*
* 点对象抽象
*/
define
(
"graphic/point"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/point"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Point"
,
{
constructor
:
function
(
x
,
y
)
{
this
.
px
=
x
||
0
;
...
...
@@ -3221,11 +3213,11 @@
return
this
.
py
;
}
});
});
/**
});
/**
* 点集合容器
*/
define
(
"graphic/pointcontainer"
,
[
"core/class"
,
"core/config"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/pointcontainer"
,
[
"core/class"
,
"core/config"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"PointContainer"
,
{
base
:
require
(
"graphic/container"
),
constructor
:
function
()
{
...
...
@@ -3262,11 +3254,11 @@
return
this
.
getLastItem
.
apply
(
this
,
arguments
);
}
});
});
/*
});
/*
* 通过点来决定图形的公共父类
*/
define
(
"graphic/poly"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/pointcontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/poly"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/pointcontainer"
,
"graphic/container"
],
function
(
require
,
exports
,
module
)
{
var
Utils
=
require
(
"core/utils"
);
return
require
(
"core/class"
).
createClass
(
"Poly"
,
{
base
:
require
(
"graphic/path"
),
...
...
@@ -3302,24 +3294,24 @@
return
this
;
}
});
});
define
(
"graphic/polygon"
,
[
"core/class"
,
"core/config"
,
"graphic/poly"
,
"core/utils"
,
"graphic/path"
,
"graphic/pointcontainer"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/polygon"
,
[
"core/class"
,
"core/config"
,
"graphic/poly"
,
"core/utils"
,
"graphic/path"
,
"graphic/pointcontainer"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Polygon"
,
{
base
:
require
(
"graphic/poly"
),
constructor
:
function
(
points
)
{
this
.
callBase
(
points
,
true
);
}
});
});
define
(
"graphic/polyline"
,
[
"core/class"
,
"core/config"
,
"graphic/poly"
,
"core/utils"
,
"graphic/path"
,
"graphic/pointcontainer"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/polyline"
,
[
"core/class"
,
"core/config"
,
"graphic/poly"
,
"core/utils"
,
"graphic/path"
,
"graphic/pointcontainer"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Polyline"
,
{
base
:
require
(
"graphic/poly"
),
constructor
:
function
(
points
)
{
this
.
callBase
(
points
);
}
});
});
define
(
"graphic/radialgradientbrush"
,
[
"graphic/gradientbrush"
,
"graphic/svg"
,
"graphic/defbrush"
,
"graphic/color"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/radialgradientbrush"
,
[
"graphic/gradientbrush"
,
"graphic/svg"
,
"graphic/defbrush"
,
"graphic/color"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
GradientBrush
=
require
(
"graphic/gradientbrush"
);
return
require
(
"core/class"
).
createClass
(
"RadialGradientBrush"
,
{
base
:
GradientBrush
,
...
...
@@ -3362,8 +3354,8 @@
return
+
this
.
node
.
getAttribute
(
"r"
);
}
});
});
define
(
"graphic/rect"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/rect"
,
[
"core/utils"
,
"core/class"
,
"core/config"
,
"graphic/path"
,
"graphic/shape"
,
"graphic/svg"
],
function
(
require
,
exports
,
module
)
{
var
RectUtils
=
{},
Utils
=
require
(
"core/utils"
);
Utils
.
extend
(
RectUtils
,
{
//根据传递进来的width、height和radius属性,
...
...
@@ -3453,8 +3445,8 @@
return
this
.
update
();
}
});
});
define
(
"graphic/shape"
,
[
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/shapeevent"
,
"core/class"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/vector"
,
"graphic/pen"
,
"graphic/color"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/shape"
,
[
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/shapeevent"
,
"core/class"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/vector"
,
"graphic/pen"
,
"graphic/color"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
svg
=
require
(
"graphic/svg"
);
var
utils
=
require
(
"core/utils"
);
var
EventHandler
=
require
(
"graphic/eventhandler"
);
...
...
@@ -3638,25 +3630,25 @@
}
return
this
;
},
setAttr
:
function
(
a
,
v
)
{
setAttr
:
function
(
a
,
v
)
{
var
me
=
this
;
if
(
utils
.
isObject
(
a
))
{
utils
.
each
(
a
,
function
(
val
,
key
)
{
me
.
setAttr
(
key
,
val
)
})
if
(
utils
.
isObject
(
a
))
{
utils
.
each
(
a
,
function
(
val
,
key
)
{
me
.
setAttr
(
key
,
val
);
});
}
if
(
v
===
undefined
||
v
===
null
||
v
===
''
)
{
if
(
v
===
undefined
||
v
===
null
||
v
===
""
)
{
this
.
node
.
removeAttribute
(
a
);
}
else
{
this
.
node
.
setAttribute
(
a
,
v
);
}
else
{
this
.
node
.
setAttribute
(
a
,
v
);
}
},
getAttr
:
function
(
a
)
{
return
this
.
node
.
getAttribute
(
a
)
getAttr
:
function
(
a
)
{
return
this
.
node
.
getAttribute
(
a
);
}
});
});
define
(
"graphic/shapecontainer"
,
[
"graphic/container"
,
"core/class"
,
"core/utils"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/shapecontainer"
,
[
"graphic/container"
,
"core/class"
,
"core/utils"
,
"core/config"
,
"graphic/shape"
,
"graphic/svg"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Container
=
require
(
"graphic/container"
);
var
utils
=
require
(
"core/utils"
);
var
ShapeContainer
=
require
(
"core/class"
).
createClass
(
"ShapeContainer"
,
{
...
...
@@ -3739,13 +3731,13 @@
},
getShapesByType
:
function
(
name
)
{
var
shapes
=
[];
function
getShapes
(
shape
)
{
if
(
name
.
toLowerCase
()
==
shape
.
getType
().
toLowerCase
())
{
shapes
.
push
(
shape
)
function
getShapes
(
shape
)
{
if
(
name
.
toLowerCase
()
==
shape
.
getType
().
toLowerCase
())
{
shapes
.
push
(
shape
);
}
if
(
shape
.
isShapeContainer
)
{
utils
.
each
(
shape
.
getShapes
(),
function
(
n
)
{
getShapes
(
n
)
if
(
shape
.
isShapeContainer
)
{
utils
.
each
(
shape
.
getShapes
(),
function
(
n
)
{
getShapes
(
n
);
});
}
}
...
...
@@ -3800,11 +3792,11 @@
}
});
return
ShapeContainer
;
});
/*
});
/*
* 图形事件包装类
* */
define
(
"graphic/shapeevent"
,
[
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/class"
,
"core/config"
],
function
(
require
,
exprots
,
module
)
{
define
(
"graphic/shapeevent"
,
[
"graphic/matrix"
,
"core/utils"
,
"graphic/vector"
,
"core/class"
,
"core/config"
],
function
(
require
,
exprots
,
module
)
{
var
Matrix
=
require
(
"graphic/matrix"
),
Utils
=
require
(
"core/utils"
);
return
require
(
"core/class"
).
createClass
(
"ShapeEvent"
,
{
constructor
:
function
(
event
)
{
...
...
@@ -3865,11 +3857,11 @@
}
}
});
});
/*
});
/*
* 图形上的点抽象
*/
define
(
"graphic/shapepoint"
,
[
"core/class"
,
"core/config"
,
"graphic/point"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/shapepoint"
,
[
"core/class"
,
"core/config"
,
"graphic/point"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"ShapePoint"
,
{
base
:
require
(
"graphic/point"
),
constructor
:
function
(
px
,
py
)
{
...
...
@@ -3897,11 +3889,11 @@
return
this
;
}
});
});
/**
});
/**
* 标准颜色映射
*/
define
(
"graphic/standardcolor"
,
[],
{
define
(
"graphic/standardcolor"
,
[],
{
COLOR_STANDARD
:
{
aliceblue
:
"#f0f8ff"
,
antiquewhite
:
"#faebd7"
,
...
...
@@ -4052,8 +4044,8 @@
},
//标准扩展
EXTEND_STANDARD
:
{}
});
define
(
"graphic/styled"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/styled"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"Styled"
,
{
addClass
:
function
(
name
)
{
this
.
node
.
classList
.
add
(
name
);
...
...
@@ -4079,8 +4071,8 @@
return
this
;
}
});
});
define
(
"graphic/svg"
,
[],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/svg"
,
[],
function
(
require
,
exports
,
module
)
{
var
doc
=
document
;
var
id
=
0
;
var
svg
=
{
...
...
@@ -4097,8 +4089,8 @@
ns
:
"http://www.w3.org/2000/svg"
};
return
svg
;
});
define
(
"graphic/text"
,
[
"graphic/textcontent"
,
"graphic/shape"
,
"core/class"
,
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"graphic/svg"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/text"
,
[
"graphic/textcontent"
,
"graphic/shape"
,
"core/class"
,
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"graphic/svg"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
TextContent
=
require
(
"graphic/textcontent"
);
var
ShapeContainer
=
require
(
"graphic/shapecontainer"
);
var
svg
=
require
(
"graphic/svg"
);
...
...
@@ -4165,8 +4157,8 @@
return
this
;
}
});
});
define
(
"graphic/textcontent"
,
[
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/textcontent"
,
[
"graphic/shape"
,
"graphic/svg"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
,
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Shape
=
require
(
"graphic/shape"
);
return
require
(
"core/class"
).
createClass
(
"TextContent"
,
{
base
:
Shape
,
...
...
@@ -4210,8 +4202,8 @@
return
this
.
node
.
getCharNumAtPosition
(
this
.
node
.
viewportElement
.
createSVGPoint
(
x
,
y
));
}
});
});
define
(
"graphic/textspan"
,
[
"graphic/textcontent"
,
"graphic/shape"
,
"core/class"
,
"graphic/styled"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/textspan"
,
[
"graphic/textcontent"
,
"graphic/shape"
,
"core/class"
,
"graphic/styled"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
TextContent
=
require
(
"graphic/textcontent"
);
var
Styled
=
require
(
"graphic/styled"
);
return
require
(
"core/class"
).
createClass
(
"TextSpan"
,
{
...
...
@@ -4222,11 +4214,11 @@
this
.
setContent
(
content
);
}
});
});
/*
});
/*
* USE 功能
*/
define
(
"graphic/use"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
,
"graphic/shape"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
define
(
"graphic/use"
,
[
"graphic/svg"
,
"core/class"
,
"core/config"
,
"graphic/shape"
,
"core/utils"
,
"graphic/eventhandler"
,
"graphic/styled"
,
"graphic/data"
,
"graphic/matrix"
,
"graphic/pen"
],
function
(
require
,
exports
,
module
)
{
var
Svg
=
require
(
"graphic/svg"
);
var
Class
=
require
(
"core/class"
);
var
Use
=
Class
.
createClass
(
"Use"
,
{
...
...
@@ -4256,8 +4248,8 @@
}
});
return
Use
;
});
define
(
"graphic/vector"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/vector"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
var
Vector
=
require
(
"core/class"
).
createClass
(
"Vector"
,
{
constructor
:
function
(
x
,
y
)
{
this
.
x
=
x
||
0
;
...
...
@@ -4314,8 +4306,8 @@
return
new
Vector
(
d
*
Math
.
cos
(
a
),
d
*
Math
.
sin
(
a
));
};
return
Vector
;
});
define
(
"graphic/view"
,
[
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"core/class"
,
"graphic/shape"
,
"graphic/viewbox"
,
"core/config"
,
"graphic/view"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/view"
,
[
"graphic/shapecontainer"
,
"graphic/container"
,
"core/utils"
,
"core/class"
,
"graphic/shape"
,
"graphic/viewbox"
,
"core/config"
,
"graphic/view"
],
function
(
require
,
exports
,
module
)
{
var
ShapeContainer
=
require
(
"graphic/shapecontainer"
);
var
ViewBox
=
require
(
"graphic/viewbox"
);
return
require
(
"core/class"
).
createClass
(
"View"
,
{
...
...
@@ -4325,8 +4317,8 @@
this
.
callBase
(
"view"
);
}
});
});
define
(
"graphic/viewbox"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
});
define
(
"graphic/viewbox"
,
[
"core/class"
,
"core/config"
],
function
(
require
,
exports
,
module
)
{
return
require
(
"core/class"
).
createClass
(
"ViewBox"
,
{
getViewBox
:
function
()
{
var
attr
=
this
.
node
.
getAttribute
(
"viewBox"
);
...
...
@@ -4352,13 +4344,13 @@
return
this
;
}
});
});
});
/**
/**
* 模块暴露
*/
(
function
(
global
)
{
(
function
(
global
)
{
define
(
'kity.start'
,
function
(
require
)
{
...
...
@@ -4433,5 +4425,5 @@
}
catch
(
e
)
{
}
}
)(
this
);
}
)(
this
);
})();
dist/dev.php
View file @
016b3222
...
...
@@ -51,7 +51,8 @@ $dependency = Array(
,
'src/adapter/adapter.js'
,
'src/adapter/button.js'
,
'src/adapter/combobox.js'
,
'src/protocal/plain.js'
,
'src/protocal/json.js'
);
$content
=
""
;
...
...
src/adapter/adapter.js
View file @
016b3222
utils
.
extend
(
KityMinder
,
function
()
{
utils
.
extend
(
KityMinder
,
function
()
{
var
_kityminderUI
=
{},
_activeWidget
=
null
,
_widgetData
=
{},
_widgetCallBack
=
{};
return
{
registerUI
:
function
(
uiname
,
fn
)
{
utils
.
each
(
uiname
.
split
(
/
\s
+/
),
function
(
i
,
name
)
{
_kityminderUI
[
name
]
=
fn
;
})
registerUI
:
function
(
uiname
,
fn
)
{
utils
.
each
(
uiname
.
split
(
/
\s
+/
),
function
(
i
,
name
)
{
_kityminderUI
[
name
]
=
fn
;
}
)
},
_createUI
:
function
(
id
)
{
var
$cont
=
$
(
'<div class="kmui-container"></div>'
),
_createUI
:
function
(
id
)
{
var
$cont
=
$
(
'<div class="kmui-container"></div>'
),
$toolbar
=
$
.
kmuitoolbar
(),
$kmbody
=
$
(
'<div class="kmui-editor-body"></div>'
),
$statusbar
=
$
(
'<div class="kmui-statusbar"></div>'
);
$kmbody
=
$
(
'<div class="kmui-editor-body"></div>'
),
$statusbar
=
$
(
'<div class="kmui-statusbar"></div>'
);
$cont
.
append
(
$toolbar
).
append
(
$kmbody
).
append
(
$statusbar
);
$
(
utils
.
isString
(
id
)
?
'#'
+
id
:
id
).
append
(
$cont
);
$cont
.
append
(
$toolbar
).
append
(
$kmbody
).
append
(
$statusbar
);
$
(
utils
.
isString
(
id
)
?
'#'
+
id
:
id
).
append
(
$cont
);
return
{
'$container'
:
$cont
,
'$toolbar'
:
$toolbar
,
'$body'
:
$kmbody
,
'$statusbar'
:
$statusbar
'$container'
:
$cont
,
'$toolbar'
:
$toolbar
,
'$body'
:
$kmbody
,
'$statusbar'
:
$statusbar
};
},
_createToolbar
:
function
(
$toolbar
,
km
)
{
var
toolbars
=
km
.
getOptions
(
'toolbars'
);
if
(
toolbars
&&
toolbars
.
length
)
{
_createToolbar
:
function
(
$toolbar
,
km
)
{
var
toolbars
=
km
.
getOptions
(
'toolbars'
);
if
(
toolbars
&&
toolbars
.
length
)
{
var
btns
=
[];
$
.
each
(
toolbars
,
function
(
i
,
uiNames
)
{
$
.
each
(
uiNames
.
split
(
/
\s
+/
),
function
(
index
,
name
)
{
if
(
name
==
'|'
)
{
$
.
kmuiseparator
&&
btns
.
push
(
$
.
kmuiseparator
()
);
}
else
{
if
(
_kityminderUI
[
name
])
{
var
ui
=
_kityminderUI
[
name
].
call
(
km
,
name
);
ui
&&
btns
.
push
(
ui
);
$
.
each
(
toolbars
,
function
(
i
,
uiNames
)
{
$
.
each
(
uiNames
.
split
(
/
\s
+/
),
function
(
index
,
name
)
{
if
(
name
==
'|'
)
{
$
.
kmuiseparator
&&
btns
.
push
(
$
.
kmuiseparator
()
);
}
else
{
if
(
_kityminderUI
[
name
]
)
{
var
ui
=
_kityminderUI
[
name
].
call
(
km
,
name
);
ui
&&
btns
.
push
(
ui
);
}
}
});
btns
.
length
&&
$toolbar
.
kmui
().
appendToBtnmenu
(
btns
);
});
}
);
btns
.
length
&&
$toolbar
.
kmui
().
appendToBtnmenu
(
btns
);
}
);
}
$toolbar
.
append
(
$
(
'<div class="kmui-dialog-container"></div>'
)
);
$toolbar
.
append
(
$
(
'<div class="kmui-dialog-container"></div>'
)
);
},
_createStatusbar
:
function
(
$statusbar
,
km
)
{
_createStatusbar
:
function
(
$statusbar
,
km
)
{
},
getKityMinder
:
function
(
id
,
options
)
{
var
containers
=
this
.
_createUI
(
id
);
var
km
=
this
.
getMinder
(
containers
.
$body
.
get
(
0
),
options
);
this
.
_createToolbar
(
containers
.
$toolbar
,
km
);
this
.
_createStatusbar
(
containers
.
$statusbar
,
km
);
getKityMinder
:
function
(
id
,
options
)
{
var
containers
=
this
.
_createUI
(
id
);
var
km
=
this
.
getMinder
(
containers
.
$body
.
get
(
0
),
options
);
this
.
_createToolbar
(
containers
.
$toolbar
,
km
);
this
.
_createStatusbar
(
containers
.
$statusbar
,
km
);
km
.
$container
=
containers
.
$container
;
return
km
;
},
registerWidget
:
function
(
name
,
pro
,
cb
)
{
_widgetData
[
name
]
=
$
.
extend2
(
pro
,
{
$root
:
''
,
_preventDefault
:
false
,
root
:
function
(
$el
)
{
return
this
.
$root
||
(
this
.
$root
=
$el
);
registerWidget
:
function
(
name
,
pro
,
cb
)
{
_widgetData
[
name
]
=
$
.
extend2
(
pro
,
{
$root
:
''
,
_preventDefault
:
false
,
root
:
function
(
$el
)
{
return
this
.
$root
||
(
this
.
$root
=
$el
);
},
preventDefault
:
function
()
{
preventDefault
:
function
()
{
this
.
_preventDefault
=
true
;
},
clear
:
false
});
if
(
cb
)
{
_widgetCallBack
[
name
]
=
cb
;
clear
:
false
}
);
if
(
cb
)
{
_widgetCallBack
[
name
]
=
cb
;
}
},
getWidgetData
:
function
(
name
)
{
return
_widgetData
[
name
]
getWidgetData
:
function
(
name
)
{
return
_widgetData
[
name
]
},
setWidgetBody
:
function
(
name
,
$widget
,
km
)
{
if
(
!
km
.
_widgetData
)
{
setWidgetBody
:
function
(
name
,
$widget
,
km
)
{
if
(
!
km
.
_widgetData
)
{
utils
.
extend
(
km
,
{
_widgetData
:
{},
getWidgetData
:
function
(
name
)
{
return
this
.
_widgetData
[
name
];
utils
.
extend
(
km
,
{
_widgetData
:
{},
getWidgetData
:
function
(
name
)
{
return
this
.
_widgetData
[
name
];
},
getWidgetCallback
:
function
(
widgetName
)
{
getWidgetCallback
:
function
(
widgetName
)
{
var
me
=
this
;
return
function
()
{
return
_widgetCallBack
[
widgetName
].
apply
(
me
,[
me
,
$widget
].
concat
(
utils
.
argsToArray
(
arguments
,
0
))
)
return
function
()
{
return
_widgetCallBack
[
widgetName
].
apply
(
me
,
[
me
,
$widget
].
concat
(
utils
.
argsToArray
(
arguments
,
0
)
)
)
}
}
})
}
)
}
var
pro
=
_widgetData
[
name
];
if
(
!
pro
)
{
var
pro
=
_widgetData
[
name
];
if
(
!
pro
)
{
return
null
;
}
pro
=
km
.
_widgetData
[
name
];
if
(
!
pro
)
{
pro
=
_widgetData
[
name
];
pro
=
km
.
_widgetData
[
name
]
=
$
.
type
(
pro
)
==
'function'
?
pro
:
utils
.
clone
(
pro
);
pro
=
km
.
_widgetData
[
name
];
if
(
!
pro
)
{
pro
=
_widgetData
[
name
];
pro
=
km
.
_widgetData
[
name
]
=
$
.
type
(
pro
)
==
'function'
?
pro
:
utils
.
clone
(
pro
);
}
pro
.
root
(
$widget
.
kmui
().
getBodyContainer
()
);
pro
.
root
(
$widget
.
kmui
().
getBodyContainer
()
);
pro
.
initContent
(
km
,
$widget
);
if
(
!
pro
.
_preventDefault
)
{
pro
.
initEvent
(
km
,
$widget
);
pro
.
initContent
(
km
,
$widget
);
if
(
!
pro
.
_preventDefault
)
{
pro
.
initEvent
(
km
,
$widget
);
}
pro
.
width
&&
$widget
.
width
(
pro
.
width
);
pro
.
width
&&
$widget
.
width
(
pro
.
width
);
},
setActiveWidget
:
function
(
$widget
)
{
setActiveWidget
:
function
(
$widget
)
{
_activeWidget
=
$widget
;
}
}
}());
}()
);
src/core/minder.data.js
View file @
016b3222
// 导入导出
kity
.
extendClass
(
Minder
,
{
exportData
:
function
(
node
)
{
Utils
.
extend
(
KityMinder
,
{
_protocals
:
{},
registerProtocal
:
function
(
name
,
protocalDeal
)
{
KityMinder
.
_protocals
[
name
]
=
protocalDeal
();
},
findProtocal
:
function
(
name
)
{
return
KityMinder
.
_protocals
[
name
]
||
null
;
},
getSupportedProtocals
:
function
()
{
return
Utils
.
keys
(
KityMinder
.
_protocals
);
}
}
);
// 这里的 Json 是一个对象
function
exportNode
(
node
)
{
var
exported
=
{};
node
=
node
||
this
.
getRoot
();
exported
.
data
=
node
.
getData
();
var
childNodes
=
node
.
getChildren
();
if
(
childNodes
.
length
)
{
exported
.
children
=
[];
for
(
var
i
=
0
;
i
<
childNodes
.
length
;
i
++
)
{
exported
.
children
.
push
(
this
.
exportData
(
childNodes
[
i
]
)
);
exported
.
children
.
push
(
exportNode
(
childNodes
[
i
]
)
);
}
}
return
exported
;
},
}
importData
:
function
(
treeData
)
{
function
importToNode
(
treeData
,
node
)
{
var
data
=
treeData
.
data
;
function
importNode
(
node
,
json
)
{
var
data
=
json
.
data
;
for
(
var
field
in
data
)
{
node
.
setData
(
field
,
data
[
field
]
);
}
var
childrenTreeData
=
treeData
.
children
;
var
childrenTreeData
=
json
.
children
;
if
(
!
childrenTreeData
)
return
;
for
(
var
i
=
0
;
i
<
childrenTreeData
.
length
;
i
++
)
{
var
childNode
=
new
MinderNode
();
importToNode
(
childrenTreeData
[
i
],
childNode
);
importNode
(
childNode
,
childrenTreeData
[
i
]
);
node
.
appendChild
(
childNode
);
}
return
node
;
}
// 导入导出
kity
.
extendClass
(
Minder
,
{
exportData
:
function
(
protocalName
)
{
var
json
,
protocal
;
json
=
exportNode
(
this
.
getRoot
()
);
protocal
=
KityMinder
.
findProtocal
(
protocalName
);
if
(
protocal
)
{
return
protocal
.
encode
(
json
);
}
else
{
return
json
;
}
},
importData
:
function
(
local
,
protocalName
)
{
var
json
,
protocal
;
if
(
protocalName
)
{
protocal
=
KityMinder
.
findProtocal
(
protocalName
);
}
else
{
KityMinder
.
getSupportedProtocals
().
every
(
function
(
name
)
{
var
test
=
KityMinder
.
findProtocal
(
name
);
if
(
test
.
recognize
&&
test
.
recognize
(
local
)
)
{
protocal
=
test
;
}
return
!
test
;
}
);
}
if
(
!
protocal
)
{
throw
new
Error
(
"Unsupported protocal: "
+
protocalName
);
}
var
params
=
{
importData
:
treeData
local
:
local
,
protocalName
:
protocalName
,
protocal
:
protocal
};
// 是否需要阻止导入
var
stoped
=
this
.
_fire
(
new
MinderEvent
(
'beforeimport'
,
params
,
true
)
);
if
(
stoped
)
return
this
;
json
=
params
.
json
||
(
params
.
json
=
protocal
.
decode
(
local
)
);
this
.
_fire
(
new
MinderEvent
(
'preimport'
,
params
,
false
)
);
// 删除当前所有节点
while
(
this
.
_root
.
getChildren
().
length
)
{
this
.
_root
.
removeChild
(
0
);
}
importToNode
(
treeData
,
this
.
_root
);
importNode
(
this
.
_root
,
json
);
this
.
_fire
(
new
MinderEvent
(
'import'
,
params
,
false
)
);
this
.
_firePharse
(
{
...
...
@@ -52,6 +103,7 @@ kity.extendClass( Minder, {
this
.
_firePharse
(
{
type
:
'interactchange'
}
);
return
this
;
}
}
);
\ No newline at end of file
src/core/minder.node.js
View file @
016b3222
...
...
@@ -3,7 +3,7 @@ kity.extendClass( Minder, {
getRoot
:
function
()
{
return
this
.
_root
;
},
setRoot
:
function
(
root
)
{
setRoot
:
function
(
root
)
{
this
.
_root
=
root
;
},
handelNodeInsert
:
function
(
node
)
{
...
...
src/core/node.js
View file @
016b3222
...
...
@@ -227,7 +227,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
},
clone
:
function
()
{
function
cloneNode
(
parent
,
isClonedNode
)
{
var
_tmp
=
new
KM
.
MinderNode
(
isClonedNode
.
getText
()
);
var
_tmp
=
new
KM
.
MinderNode
(
isClonedNode
.
getText
()
);
_tmp
.
data
=
Utils
.
clonePlainObject
(
isClonedNode
.
getData
()
);
_tmp
.
parent
=
parent
;
...
...
@@ -266,5 +266,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
},
isSelected
:
function
()
{
return
this
.
getData
(
'highlight'
)
===
true
;
},
clearChildren
:
function
()
{
this
.
children
=
[];
}
}
);
\ No newline at end of file
src/module/font.js
View file @
016b3222
KityMinder
.
registerModule
(
"fontmodule"
,
function
()
{
return
{
defaultOptions
:{
'fontfamily'
:
[
{
name
:
'songti'
,
val
:
'宋体,SimSun'
},
{
name
:
'yahei'
,
val
:
'微软雅黑,Microsoft YaHei'
},
{
name
:
'kaiti'
,
val
:
'楷体,楷体_GB2312, SimKai'
},
{
name
:
'heiti'
,
val
:
'黑体, SimHei'
},
{
name
:
'lishu'
,
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
]
defaultOptions
:
{
'fontfamily'
:
[
{
name
:
'songti'
,
val
:
'宋体,SimSun'
},
{
name
:
'yahei'
,
val
:
'微软雅黑,Microsoft YaHei'
},
{
name
:
'kaiti'
,
val
:
'楷体,楷体_GB2312, SimKai'
},
{
name
:
'heiti'
,
val
:
'黑体, SimHei'
},
{
name
:
'lishu'
,
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"
:
{
"forecolor"
:
kity
.
createClass
(
"fontcolorCommand"
,
{
...
...
@@ -39,7 +62,7 @@ KityMinder.registerModule( "fontmodule", function () {
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontfamily'
,
family
);
n
.
getTextShape
().
setAttr
(
'font-family'
,
family
);
km
.
updateLayout
(
n
)
km
.
updateLayout
(
n
)
}
)
}
}
),
...
...
@@ -50,8 +73,8 @@ KityMinder.registerModule( "fontmodule", function () {
var
nodes
=
km
.
getSelectedNodes
();
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'fontsize'
,
size
);
n
.
getTextShape
().
setSize
(
size
);
km
.
updateLayout
(
n
)
n
.
getTextShape
().
setSize
(
size
);
km
.
updateLayout
(
n
)
}
)
}
}
)
...
...
src/module/history.js
View file @
016b3222
...
...
@@ -51,6 +51,7 @@ KityMinder.registerModule( "HistoryModule", function () {
},
restore
:
function
()
{
var
scene
=
this
.
list
[
this
.
index
];
debugger
;
this
.
km
.
setRoot
(
scene
.
cloneData
()
);
this
.
km
.
initStyle
();
this
.
update
();
...
...
@@ -59,6 +60,7 @@ KityMinder.registerModule( "HistoryModule", function () {
return
new
Scene
(
this
.
km
.
getRoot
()
)
},
saveScene
:
function
()
{
debugger
;
var
currentScene
=
this
.
getScene
();
var
lastScene
=
this
.
list
[
this
.
index
];
if
(
lastScene
&&
lastScene
.
equals
(
currentScene
)
)
{
...
...
src/module/layout.default.js
View file @
016b3222
...
...
@@ -27,7 +27,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
dec
.
stroke
(
"gray"
);
minder
.
getRenderContainer
().
addShape
(
iconShape
);
iconShape
.
addShapes
(
[
circle
,
plus
,
dec
]
);
node
.
setData
(
"shicon"
,
this
);
this
.
update
();
this
.
switchState
();
},
...
...
@@ -107,15 +106,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
switch
(
node
.
getType
()
)
{
case
"root"
:
case
"main"
:
if
(
!
Layout
.
bgRect
)
{
node
.
getBgRc
().
addShape
(
Layout
.
bgRect
=
new
kity
.
Rect
()
);
}
node
.
getBgRc
().
clear
().
addShape
(
Layout
.
bgRect
=
new
kity
.
Rect
()
);
Layout
.
bgRect
.
fill
(
nodeStyle
.
fill
).
setRadius
(
nodeStyle
.
radius
);
break
;
case
"sub"
:
var
underline
=
Layout
.
underline
=
new
kity
.
Path
();
var
highlightshape
=
Layout
.
highlightshape
=
new
kity
.
Rect
();
node
.
getBgRc
().
addShapes
(
[
highlightshape
,
underline
]
);
node
.
getBgRc
().
clear
().
addShapes
(
[
highlightshape
,
underline
]
);
break
;
default
:
break
;
...
...
@@ -134,6 +131,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout
.
leftHeight
=
0
;
Layout
.
rightHeight
=
0
;
}
minder
.
highlightNode
(
node
);
};
//根据内容调整节点尺寸
var
updateShapeByCont
=
function
(
node
)
{
...
...
@@ -153,7 +151,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
_contWidth
=
contRc
.
getWidth
();
var
_contHeight
=
contRc
.
getHeight
();
Layout
.
underline
.
getDrawer
()
.
clear
()
.
moveTo
(
0
,
_contHeight
+
nodeStyle
.
padding
[
2
]
+
nodeStyle
.
padding
[
0
]
)
.
lineTo
(
_contWidth
+
nodeStyle
.
padding
[
1
]
+
nodeStyle
.
padding
[
3
],
_contHeight
+
nodeStyle
.
padding
[
2
]
+
nodeStyle
.
padding
[
0
]
);
Layout
.
underline
.
stroke
(
nodeStyle
.
stroke
);
...
...
@@ -208,7 +205,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
else
{
if
(
action
===
"append"
||
action
===
"contract"
)
{
Layout
.
branchheight
=
node
.
getRenderContainer
().
getHeight
()
+
nodeStyle
.
margin
[
0
]
+
nodeStyle
.
margin
[
2
];
}
else
if
(
action
===
"
expand"
||
action
===
"
change"
)
{
//展开
}
else
if
(
action
===
"change"
)
{
//展开
Layout
.
branchheight
=
countBranchHeight
(
node
);
}
var
parentLayout
=
parent
.
getData
(
"layout"
);
...
...
@@ -293,6 +290,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
nodeShape
.
setTransform
(
new
kity
.
Matrix
().
translate
(
Layout
.
x
,
Layout
.
y
-
_rectHeight
/
2
)
);
break
;
}
node
.
setPoint
(
Layout
.
x
,
Layout
.
y
);
};
var
updateConnectAndshIcon
=
function
(
node
)
{
var
nodeType
=
node
.
getType
();
...
...
@@ -430,11 +428,26 @@ KityMinder.registerModule( "LayoutDefault", function () {
updateLayoutHorizon
(
_root
);
updateLayoutVertical
(
_root
);
translateNode
(
_root
);
var
_buffer
=
[
_root
];
var
_cleanbuffer
=
[];
//打散结构
while
(
_buffer
.
length
!==
0
)
{
var
children
=
_buffer
[
0
].
getChildren
();
_buffer
=
_buffer
.
concat
(
children
);
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
children
[
i
].
getData
(
"layout"
).
parent
=
_buffer
[
0
];
}
_buffer
[
0
].
clearChildren
();
if
(
_buffer
[
0
]
!==
_root
)
_cleanbuffer
.
push
(
_buffer
[
0
]
);
_buffer
.
shift
();
}
//重组结构
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
this
.
appendChildNode
(
_cleanbuffer
[
j
].
getData
(
"layout"
).
parent
,
_cleanbuffer
[
j
]
);
}
},
appendChildNode
:
function
(
parent
,
node
,
sibling
)
{
minder
.
handelNodeInsert
(
node
);
//设置align和appendside属性并在合适的位置插入节点
var
insert
=
(
parent
.
getChildren
().
indexOf
(
node
)
===
-
1
);
var
Layout
=
node
.
getData
(
"layout"
);
var
parentLayout
=
parent
.
getData
(
"layout"
);
if
(
sibling
)
{
...
...
@@ -452,6 +465,17 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
prtLayout
=
parent
.
getData
(
"layout"
);
Layout
.
appendside
=
prtLayout
.
appendside
;
Layout
.
align
=
prtLayout
.
align
;
parent
.
appendChild
(
node
);
}
else
{
var
nodeP
=
node
.
getPoint
();
if
(
nodeP
&&
nodeP
.
x
&&
nodeP
.
y
)
{
if
(
nodeP
.
x
>
parentLayout
.
x
)
{
Layout
.
appendside
=
"right"
;
Layout
.
align
=
"left"
;
}
else
{
Layout
.
appendside
=
"left"
;
Layout
.
align
=
"right"
;
}
}
else
{
if
(
parentLayout
.
rightList
.
length
>
1
&&
parentLayout
.
rightList
.
length
>
parentLayout
.
leftList
.
length
)
{
Layout
.
appendside
=
"left"
;
...
...
@@ -461,15 +485,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout
.
align
=
"left"
;
}
}
if
(
insert
)
{
if
(
parent
.
getType
()
===
"root"
)
{
var
sideList1
=
parentLayout
[
Layout
.
appendside
+
"List"
];
var
idx1
=
sideList1
.
length
;
parent
.
insertChild
(
node
,
idx1
);
sideList1
.
push
(
node
);
var
idx1
;
if
(
Layout
.
appendside
===
"right"
)
{
idx1
=
sideList1
.
length
;
}
else
{
parent
.
insertChild
(
node
)
;
idx1
=
parent
.
getChildren
().
length
;
}
parent
.
insertChild
(
node
,
idx1
);
}
}
//设置分支类型
...
...
@@ -539,12 +563,15 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
isExpand
=
ico
.
icon
.
switchState
();
var
node
=
ico
.
icon
.
_node
;
var
_buffer
=
node
.
getChildren
();
var
_cleanbuffer
=
[];
while
(
_buffer
.
length
!==
0
)
{
var
Layout
=
_buffer
[
0
].
getData
(
"layout"
);
if
(
isExpand
)
{
var
parent
=
_buffer
[
0
].
getParent
();
minder
.
appendChildNode
(
parent
,
_buffer
[
0
]
);
Layout
.
parent
=
parent
;
_cleanbuffer
.
push
(
_buffer
[
0
]
);
//minder.appendChildNode( parent, _buffer[ 0 ] );
Layout
.
connect
=
null
;
Layout
.
shicon
=
null
;
}
else
{
...
...
@@ -555,53 +582,21 @@ KityMinder.registerModule( "LayoutDefault", function () {
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
.
shift
();
}
var
set
;
if
(
isExpand
)
set
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"expand"
);
else
set
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"contract"
);
if
(
isExpand
)
{
node
.
clearChildren
();
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
_cleanbuffer
[
j
].
clearChildren
();
minder
.
appendChildNode
(
_cleanbuffer
[
j
].
getData
(
"layout"
).
parent
,
_cleanbuffer
[
j
]
);
}
}
var
set
=
[];
if
(
!
isExpand
)
set
=
updateLayoutVertical
(
node
,
node
.
getParent
(),
"contract"
);
for
(
var
i
=
0
;
i
<
set
.
length
;
i
++
)
{
translateNode
(
set
[
i
]
);
updateConnectAndshIcon
(
set
[
i
]
);
}
}
};
this
.
addLayoutStyle
(
"default"
,
_style
);
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 ] );
// }
// }
// }
// }
// }
};
return
{};
}
);
\ No newline at end of file
src/module/layout.js
View file @
016b3222
...
...
@@ -25,7 +25,15 @@ KityMinder.registerModule( "LayoutModule", function () {
},
initStyle
:
function
()
{
var
curStyle
=
this
.
getCurrentStyle
();
this
.
getRenderContainer
().
clear
();
//this.getRenderContainer().clear();
this
.
_rc
.
remove
();
this
.
_rc
=
new
kity
.
Group
();
this
.
_paper
.
addShape
(
this
.
_rc
);
var
_root
=
this
.
getRoot
();
_root
.
preTraverse
(
function
(
n
)
{
n
.
clearLayout
();
}
);
this
.
getLayoutStyle
(
curStyle
).
initStyle
.
call
(
this
);
},
appendChildNode
:
function
(
parent
,
node
,
index
)
{
...
...
@@ -79,7 +87,7 @@ KityMinder.registerModule( "LayoutModule", function () {
var
switchLayout
=
function
(
km
,
style
)
{
var
_root
=
km
.
getRoot
();
_root
.
preTraverse
(
function
(
n
)
{
n
.
clearLayout
();
//
n.clearLayout();
n
.
setPoint
();
n
.
getBgRc
().
clear
();
}
);
...
...
src/protocal/json.js
0 → 100644
View file @
016b3222
KityMinder
.
registerProtocal
(
'json'
,
function
()
{
function
filter
(
key
,
value
)
{
if
(
key
==
'layout'
||
key
==
'shicon'
)
{
return
undefined
;
}
return
value
;
}
return
{
encode
:
function
(
json
)
{
return
JSON
.
stringify
(
json
,
filter
);
},
decode
:
function
(
local
)
{
return
JSON
.
parse
(
local
);
},
recognize
:
function
(
local
)
{
return
Utils
.
isString
(
local
)
&&
local
.
charAt
(
0
)
==
'{'
&&
local
.
charAt
(
local
.
length
-
1
)
==
'}'
;
}
};
}
);
\ No newline at end of file
src/protocal/plain.js
0 → 100644
View file @
016b3222
KityMinder
.
registerProtocal
(
"plain"
,
function
()
{
var
LINE_ENDING
=
'
\
n'
,
TAB_CHAR
=
'
\
t'
;
function
repeat
(
s
,
n
)
{
var
result
=
""
;
while
(
n
--
)
result
+=
s
;
return
result
;
}
function
encode
(
json
,
level
)
{
var
local
=
""
;
level
=
level
||
0
;
local
+=
repeat
(
TAB_CHAR
,
level
);
local
+=
json
.
data
.
text
+
LINE_ENDING
;
if
(
json
.
children
)
{
json
.
children
.
forEach
(
function
(
child
)
{
local
+=
encode
(
child
,
level
+
1
);
}
);
}
return
local
;
}
function
isEmpty
(
line
)
{
return
!
/
\S
/
.
test
(
line
);
}
function
getLevel
(
line
)
{
var
level
=
0
;
while
(
line
.
charAt
(
level
)
===
TAB_CHAR
)
level
++
;
return
level
;
}
function
getNode
(
line
)
{
return
{
data
:
{
text
:
line
.
replace
(
new
RegExp
(
'^'
+
TAB_CHAR
+
'*'
),
''
)
}
};
}
function
decode
(
local
)
{
var
json
,
parentMap
=
{},
lines
=
local
.
split
(
LINE_ENDING
),
line
,
level
,
node
;
function
addChild
(
parent
,
child
)
{
var
children
=
parent
.
children
||
(
parent
.
children
=
[]
);
children
.
push
(
child
);
}
for
(
var
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
line
=
lines
[
i
];
if
(
isEmpty
(
line
)
)
continue
;
level
=
getLevel
(
line
);
node
=
getNode
(
line
);
if
(
level
===
0
)
{
if
(
json
)
{
throw
new
Error
(
'Invalid local format'
);
}
json
=
node
;
}
else
{
if
(
!
parentMap
[
level
-
1
]
)
{
throw
new
Error
(
'Invalid local format'
);
}
addChild
(
parentMap
[
level
-
1
],
node
);
}
parentMap
[
level
]
=
node
;
}
return
json
;
}
var
lastTry
,
lastResult
;
function
recognize
(
local
)
{
if
(
!
Utils
.
isString
(
local
)
)
return
false
;
lastTry
=
local
;
try
{
lastResult
=
decode
(
local
);
}
catch
(
e
)
{
lastResult
=
null
;
}
return
!!
lastResult
;
}
return
{
encode
:
function
(
json
)
{
return
encode
(
json
,
0
);
},
decode
:
function
(
local
)
{
if
(
lastTry
==
local
&&
lastResult
)
{
return
lastResult
;
}
return
decode
(
local
);
},
recognize
:
recognize
};
}
);
\ 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