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