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
e601b7b8
Commit
e601b7b8
authored
Feb 24, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export
parent
c392ce30
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
kity
kity
+1
-1
saveto.js
src/adapter/saveto.js
+9
-6
No files found.
kity
@
a9630e63
Subproject commit
df7b361ae5098710eca0fec1080dce4bc822bf24
Subproject commit
a9630e638b29633f62cdc2df239bc702118b231a
src/adapter/saveto.js
View file @
e601b7b8
...
@@ -35,15 +35,17 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -35,15 +35,17 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
var
svghtml
=
$
(
"#kityminder .kmui-editor-body"
).
html
();
var
svghtml
=
$
(
"#kityminder .kmui-editor-body"
).
html
();
var
bgImg
=
$
(
"#kityminder .kmui-editor-body"
).
css
(
"backgroundImage"
).
replace
(
/"/g
,
""
).
replace
(
/url
\(
|
\)
$/ig
,
""
);
var
bgImg
=
$
(
"#kityminder .kmui-editor-body"
).
css
(
"backgroundImage"
).
replace
(
/"/g
,
""
).
replace
(
/url
\(
|
\)
$/ig
,
""
);
var
renderBox
=
me
.
getRenderContainer
().
getRenderBox
(
"top"
);
var
renderBox
=
me
.
getRenderContainer
().
getRenderBox
(
"top"
);
//debugger;
var
renderContainer
=
me
.
getRenderContainer
();
var
transform
=
renderContainer
.
getTransform
();
renderContainer
.
resetTransform
();
var
svg
=
$
(
svghtml
).
attr
(
{
var
svg
=
$
(
svghtml
).
attr
(
{
width
:
renderBox
.
x
+
me
.
getRenderContainer
().
getWidth
()
,
width
:
renderBox
.
x
+
renderBox
.
width
,
height
:
renderBox
.
y
+
me
.
getRenderContainer
().
getHeight
()
,
height
:
renderBox
.
y
+
renderBox
.
height
,
viewBox
:
null
viewBox
:
null
}
);
}
);
var
div
=
$
(
"<div></div>"
).
append
(
svg
);
var
div
=
$
(
"<div></div>"
).
append
(
svg
);
svghtml
=
div
.
html
();
svghtml
=
div
.
html
();
var
canvas
=
$
(
'<canvas width="'
+
renderBox
.
width
+
'" height="'
+
renderBox
.
height
+
'"></canvas>'
);
var
canvas
=
$
(
'<canvas width="'
+
(
parseInt
(
renderBox
.
width
)
+
40
)
+
'" height="'
+
(
parseInt
(
renderBox
.
height
)
+
40
)
+
'"></canvas>'
);
var
ctx
=
canvas
[
0
].
getContext
(
"2d"
);
var
ctx
=
canvas
[
0
].
getContext
(
"2d"
);
var
DOMURL
=
self
.
URL
||
self
.
webkitURL
||
self
;
var
DOMURL
=
self
.
URL
||
self
.
webkitURL
||
self
;
var
img
=
new
Image
();
var
img
=
new
Image
();
...
@@ -57,8 +59,8 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -57,8 +59,8 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
bgTexture
.
onload
=
function
()
{
bgTexture
.
onload
=
function
()
{
var
bgfill
=
ctx
.
createPattern
(
bgTexture
,
"repeat"
);
var
bgfill
=
ctx
.
createPattern
(
bgTexture
,
"repeat"
);
ctx
.
fillStyle
=
bgfill
;
ctx
.
fillStyle
=
bgfill
;
ctx
.
fillRect
(
0
,
0
,
renderBox
.
width
,
renderBox
.
height
);
ctx
.
fillRect
(
0
,
0
,
renderBox
.
width
+
40
,
renderBox
.
height
+
40
);
ctx
.
drawImage
(
img
,
-
renderBox
.
x
,
-
renderBox
.
y
);
ctx
.
drawImage
(
img
,
-
renderBox
.
x
+
20
,
-
renderBox
.
y
+
20
);
DOMURL
.
revokeObjectURL
(
url
);
DOMURL
.
revokeObjectURL
(
url
);
var
type
=
'png'
;
var
type
=
'png'
;
var
imgData
=
canvas
[
0
].
toDataURL
(
type
);
var
imgData
=
canvas
[
0
].
toDataURL
(
type
);
...
@@ -82,6 +84,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -82,6 +84,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
var
filename
=
'kityminder_'
+
(
new
Date
()
).
getTime
()
+
'.'
+
type
;
var
filename
=
'kityminder_'
+
(
new
Date
()
).
getTime
()
+
'.'
+
type
;
// download
// download
saveFile
(
imgData
,
filename
);
saveFile
(
imgData
,
filename
);
renderContainer
.
setTransform
(
transform
);
};
};
};
};
img
.
src
=
url
;
img
.
src
=
url
;
...
...
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