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
5eda0bb6
Commit
5eda0bb6
authored
Jul 08, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix export issue
parent
b3fb7421
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
52 deletions
+48
-52
index.html
index.html
+1
-1
zoom.js
src/module/zoom.js
+28
-24
png.js
src/protocal/png.js
+12
-15
svg.js
src/protocal/svg.js
+5
-10
default.js
src/theme/default.js
+1
-1
snow.js
src/theme/snow.js
+1
-1
No files found.
index.html
View file @
5eda0bb6
...
...
@@ -5,7 +5,7 @@
<meta
name=
"title"
content=
"百度脑图(KityMinder)"
>
<meta
name=
"keyword"
content=
"kityminder,脑图,思维导图,kity,svg,minder,百度,fex,前端,在线"
>
<meta
name=
"description"
content=
"百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"
>
<meta
name=
"viewport"
content=
"width=device-width,
height=content-height,
initial-scale=1, user-scalable=no"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, user-scalable=no"
>
<script
src=
"lib/jquery-2.1.0.min.js"
charset=
"utf-8"
></script>
<script
src=
"lib/ZeroClipboard.min.js"
charset=
"utf-8"
></script>
...
...
src/module/zoom.js
View file @
5eda0bb6
...
...
@@ -5,39 +5,46 @@ KityMinder.registerModule('Zoom', function() {
me
.
setDefaultOptions
(
'zoom'
,
[
50
,
80
,
100
,
120
,
150
,
200
]);
function
fixPaperCTM
()
{
var
paper
=
me
.
getPaper
();
function
fixPaperCTM
(
paper
)
{
var
node
=
paper
.
shapeNode
;
var
ctm
=
node
.
getCTM
();
var
matrix
=
new
kity
.
Matrix
(
ctm
.
a
,
ctm
.
b
,
ctm
.
c
,
ctm
.
d
,
(
ctm
.
e
|
0
)
+
0.5
,
(
ctm
.
f
|
0
)
+
0.5
);
node
.
setAttribute
(
'transform'
,
'matrix('
+
matrix
.
toString
()
+
')'
);
}
function
zoomMinder
(
minder
,
zoom
)
{
kity
.
extendClass
(
Minder
,
{
zoom
:
function
(
value
)
{
var
paper
=
this
.
getPaper
();
var
viewport
=
paper
.
getViewPort
();
viewport
.
zoom
=
value
/
100
;
viewport
.
center
=
{
x
:
viewport
.
center
.
x
,
y
:
viewport
.
center
.
y
};
paper
.
setViewPort
(
viewport
);
fixPaperCTM
(
paper
);
}
});
function
zoomMinder
(
minder
,
value
)
{
var
paper
=
minder
.
getPaper
();
var
viewport
=
paper
.
getViewPort
();
if
(
!
zoom
)
return
;
if
(
!
value
)
return
;
var
animator
=
new
kity
.
Animator
({
beginValue
:
viewport
.
zoom
,
finishValue
:
zoom
/
100
,
beginValue
:
minder
.
_zoomValue
,
finishValue
:
value
,
setter
:
function
(
target
,
value
)
{
viewport
.
zoom
=
value
;
viewport
.
center
=
{
x
:
viewport
.
center
.
x
,
y
:
viewport
.
center
.
y
};
target
.
setViewPort
(
viewport
);
fixPaperCTM
();
target
.
zoom
(
value
);
}
});
minder
.
zoom
=
zoom
;
minder
.
_zoomValue
=
value
;
if
(
timeline
)
{
timeline
.
pause
();
}
timeline
=
animator
.
start
(
paper
,
5
00
,
'ease'
,
function
()
{
minder
.
refresh
(
5
00
);
timeline
=
animator
.
start
(
minder
,
1
00
,
'ease'
,
function
()
{
minder
.
refresh
(
1
00
);
});
}
...
...
@@ -45,7 +52,7 @@ KityMinder.registerModule('Zoom', function() {
base
:
Command
,
execute
:
zoomMinder
,
queryValue
:
function
(
minder
)
{
return
minder
.
zoom
;
return
minder
.
_zoomValue
;
}
});
...
...
@@ -61,7 +68,7 @@ KityMinder.registerModule('Zoom', function() {
var
stack
=
minder
.
getOptions
(
'zoom'
),
i
;
for
(
i
=
0
;
i
<
stack
.
length
;
i
++
)
{
if
(
stack
[
i
]
>
minder
.
zoom
)
return
stack
[
i
];
if
(
stack
[
i
]
>
minder
.
_zoomValue
)
return
stack
[
i
];
}
return
0
;
},
...
...
@@ -80,7 +87,7 @@ KityMinder.registerModule('Zoom', function() {
var
stack
=
minder
.
getOptions
(
'zoom'
),
i
;
for
(
i
=
stack
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
stack
[
i
]
<
minder
.
zoom
)
return
stack
[
i
];
if
(
stack
[
i
]
<
minder
.
_zoomValue
)
return
stack
[
i
];
}
return
0
;
},
...
...
@@ -89,7 +96,7 @@ KityMinder.registerModule('Zoom', function() {
return
{
init
:
function
()
{
this
.
zoom
=
100
;
this
.
_zoomValue
=
100
;
},
commands
:
{
'zoom-in'
:
ZoomInCommand
,
...
...
@@ -113,9 +120,6 @@ KityMinder.registerModule('Zoom', function() {
}
},
'ready'
:
function
()
{
this
.
_zoomValue
=
1
;
},
'normal.mousewheel readonly.mousewheel'
:
function
(
e
)
{
if
(
!
e
.
originEvent
.
ctrlKey
)
return
;
var
delta
=
e
.
originEvent
.
wheelDelta
;
...
...
src/protocal/png.js
View file @
5eda0bb6
...
...
@@ -10,14 +10,11 @@ if (!kity.Browser.ie) {
fileDescription
:
'PNG 图片'
,
fileExtension
:
'.png'
,
encode
:
function
(
json
,
km
)
{
var
paper
=
km
.
getPaper
();
var
viewport
=
paper
.
getViewPort
();
var
originZoom
=
viewport
.
zoom
;
var
originZoom
=
km
.
_zoomValue
;
viewport
.
zoom
=
1
;
paper
.
setViewPort
(
viewport
);
var
domContainer
=
km
.
getPaper
().
container
,
var
paper
=
km
.
getPaper
(),
paperTransform
=
paper
.
shapeNode
.
getAttribute
(
'transform'
),
domContainer
=
paper
.
container
,
svgXml
,
$svg
,
...
...
@@ -27,27 +24,27 @@ if (!kity.Browser.ie) {
renderContainer
=
km
.
getRenderContainer
(),
renderBox
=
renderContainer
.
getRenderBox
(),
transform
=
renderContainer
.
getTransform
(),
width
=
renderBox
.
width
,
height
=
renderBox
.
height
,
width
=
renderBox
.
width
+
1
,
height
=
renderBox
.
height
+
1
,
padding
=
20
,
canvas
=
document
.
createElement
(
'canvas'
),
ctx
=
canvas
.
getContext
(
'2d'
),
blob
,
DomURL
,
url
,
img
,
finishCallback
;
paper
.
shapeNode
.
setAttribute
(
'transform'
,
'translate(0.5, 0.5)'
);
renderContainer
.
translate
(
-
renderBox
.
x
,
-
renderBox
.
y
);
svgXml
=
km
.
getPaper
()
.
container
.
innerHTML
;
svgXml
=
paper
.
container
.
innerHTML
;
renderContainer
.
translate
(
renderBox
.
x
,
renderBox
.
y
);
viewport
.
zoom
=
originZoom
;
paper
.
s
etViewPort
(
viewport
);
paper
.
s
hapeNode
.
setAttribute
(
'transform'
,
paperTransform
);
$svg
=
$
(
svgXml
).
filter
(
'svg'
);
$svg
.
attr
({
width
:
renderBox
.
width
,
height
:
renderBox
.
height
,
width
:
renderBox
.
width
+
1
,
height
:
renderBox
.
height
+
1
,
style
:
'font-family: Arial, "Microsoft Yahei","Heiti SC";'
});
...
...
src/protocal/svg.js
View file @
5eda0bb6
...
...
@@ -6,14 +6,9 @@ if (!kity.Browser.ie) {
fileExtension
:
'.svg'
,
mineType
:
'image/svg+xml'
,
encode
:
function
(
json
,
km
)
{
var
paper
=
km
.
getPaper
();
var
viewport
=
paper
.
getViewPort
();
var
originZoom
=
viewport
.
zoom
;
viewport
.
zoom
=
1
;
paper
.
setViewPort
(
viewport
);
var
domContainer
=
km
.
getPaper
().
container
,
var
paper
=
km
.
getPaper
(),
paperTransform
=
paper
.
shapeNode
.
getAttribute
(
'transform'
),
svgXml
,
$svg
,
...
...
@@ -24,13 +19,15 @@ if (!kity.Browser.ie) {
height
=
renderBox
.
height
,
padding
=
20
;
paper
.
shapeNode
.
setAttribute
(
'transform'
,
'translate(0.5, 0.5)'
);
svgXml
=
km
.
getPaper
().
container
.
innerHTML
;
paper
.
shapeNode
.
setAttribute
(
'transform'
,
paperTransform
);
$svg
=
$
(
svgXml
).
filter
(
'svg'
);
$svg
.
attr
({
width
:
width
+
padding
*
2
|
0
,
height
:
height
+
padding
*
2
|
0
,
style
:
'font-family: Arial, "Microsoft Yahei", "Heiti SC";
'
style
:
'font-family: Arial, "Microsoft Yahei", "Heiti SC";
background: '
+
km
.
getStyle
(
'background'
)
});
$svg
[
0
].
setAttribute
(
'viewBox'
,
[
renderBox
.
x
-
padding
|
0
,
renderBox
.
y
-
padding
|
0
,
...
...
@@ -42,8 +39,6 @@ if (!kity.Browser.ie) {
svgXml
=
$
(
'<div></div>'
).
append
(
$svg
).
html
();
svgXml
=
$
(
'<div></div>'
).
append
(
$svg
).
html
();
viewport
.
zoom
=
originZoom
;
paper
.
setViewPort
(
viewport
);
// svg 含有 符号导出报错 Entity 'nbsp' not defined
svgXml
=
svgXml
.
replace
(
/ /g
,
' '
);
...
...
src/theme/default.js
View file @
5eda0bb6
KityMinder
.
registerTheme
(
'classic'
,
{
'background'
:
'url(themes/default/images/grid.png) repeat'
,
'background'
:
'
#3A4144
url(themes/default/images/grid.png) repeat'
,
'root-color'
:
'#430'
,
'root-background'
:
'#e9df98'
,
...
...
src/theme/snow.js
View file @
5eda0bb6
KityMinder
.
registerTheme
(
'snow'
,
{
'background'
:
'url(themes/default/images/grid.png) repeat'
,
'background'
:
'
#3A4144
url(themes/default/images/grid.png) repeat'
,
'root-color'
:
'#430'
,
'root-background'
:
'#e9df98'
,
...
...
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