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
bac03aa0
Commit
bac03aa0
authored
Feb 24, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
merge save to png
parents
b72d7ac9
e601b7b8
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
200 deletions
+118
-200
dev.js
dist/dev.js
+106
-191
index.html
dist/index.html
+2
-2
kity
kity
+1
-1
saveto.js
src/adapter/saveto.js
+9
-6
No files found.
dist/dev.js
View file @
bac03aa0
This diff is collapsed.
Click to expand it.
dist/index.html
View file @
bac03aa0
...
@@ -7,9 +7,9 @@
...
@@ -7,9 +7,9 @@
<script
src=
"social.js"
charset=
"utf-8"
></script>
<script
src=
"social.js"
charset=
"utf-8"
></script>
<script
src=
"../kity/dist/kitygraph.all.js"
></script>
<script
src=
"../kity/dist/kitygraph.all.js"
></script>
<script
src=
"../configure.js"
></script>
<script
src=
"../configure.js"
></script>
<script
src=
"../dist/dev.
php
"
></script>
<script
src=
"../dist/dev.
js
"
></script>
<script
src=
"../lang/zh-cn/zh-cn.js"
charset=
"utf-8"
></script>
<script
src=
"../lang/zh-cn/zh-cn.js"
charset=
"utf-8"
></script>
<link
href=
"../themes/default/
_
css/import.css"
type=
"text/css"
rel=
"stylesheet"
>
<link
href=
"../themes/default/css/import.css"
type=
"text/css"
rel=
"stylesheet"
>
<style>
<style>
.km_receiver
{
.km_receiver
{
width
:
0
;
width
:
0
;
...
...
kity
@
a9630e63
Subproject commit
7c0498012df602619a38e6b88785a486cd92396d
Subproject commit
a9630e638b29633f62cdc2df239bc702118b231a
src/adapter/saveto.js
View file @
bac03aa0
...
@@ -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