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
4df655fe
Commit
4df655fe
authored
Feb 18, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zoom
parent
0a07428c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
113 additions
and
34 deletions
+113
-34
.jshintrc
.jshintrc
+3
-1
configure.js
configure.js
+1
-1
hand.js
src/adapter/hand.js
+97
-17
dragtree.js
src/module/dragtree.js
+2
-2
select.js
src/module/select.js
+1
-1
zoom.js
src/module/zoom.js
+3
-12
buttonicon.css
themes/default/_css/buttonicon.css
+6
-0
zoom_in.png
themes/default/images/zoom_in.png
+0
-0
zoom_out.png
themes/default/images/zoom_out.png
+0
-0
No files found.
.jshintrc
View file @
4df655fe
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
"KITYMINDER_CONFIG",
"KITYMINDER_CONFIG",
"keymap",
"keymap",
"Utils",
"Utils",
"utils"
"utils",
"$",
"KM"
]
]
}
}
\ No newline at end of file
configure.js
View file @
4df655fe
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL'
:
getKMBasePath
(),
'KITYMINDER_HOME_URL'
:
getKMBasePath
(),
//定义工具栏
//定义工具栏
toolbars
:
[
toolbars
:
[
'hand | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers'
'hand
zoom-in zoom-out
| undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers'
]
]
//设置主题
//设置主题
...
...
src/adapter/hand.js
View file @
4df655fe
KM
.
registerUI
(
'hand'
,
function
zoom
(
paper
,
rate
)
{
var
viewbox
=
paper
.
getViewBox
();
var
zoomValue
=
paper
.
_zoom
||
1
;
var
w
=
viewbox
.
width
,
h
=
viewbox
.
height
,
x
=
viewbox
.
x
,
y
=
viewbox
.
y
;
var
ww
=
w
*
rate
,
hh
=
h
*
rate
,
xx
=
x
+
(
w
-
ww
)
/
2
,
yy
=
y
+
(
h
-
hh
)
/
2
;
var
animator
=
new
kity
.
Animator
(
{
beginValue
:
viewbox
,
finishValue
:
{
width
:
ww
,
height
:
hh
,
x
:
xx
,
y
:
yy
},
setter
:
function
(
target
,
value
)
{
target
.
setViewBox
(
value
.
x
,
value
.
y
,
value
.
width
,
value
.
height
);
}
}
);
animator
.
start
(
paper
,
100
,
'ease'
);
paper
.
_zoom
=
zoomValue
*=
rate
;
return
zoomValue
;
}
KM
.
registerUI
(
'hand zoom-in zoom-out'
,
function
(
name
)
{
function
(
name
)
{
var
me
=
this
;
var
me
=
this
;
var
$btn
=
$
.
kmuibutton
(
{
var
$btn
=
$
.
kmuibutton
(
{
icon
:
name
,
icon
:
name
,
click
:
function
(
e
)
{
click
:
{
var
drag
=
me
.
_onDragMode
=
!
me
.
_onDragMode
;
'hand'
:
function
(
e
)
{
me
.
_paper
.
setStyle
(
'cursor'
,
drag
?
'pointer'
:
'default'
);
var
drag
=
me
.
_onDragMode
=
!
me
.
_onDragMode
;
me
.
_paper
.
setStyle
(
'cursor'
,
drag
?
'-webkit-grab'
:
'default'
);
me
.
_paper
.
setStyle
(
'cursor'
,
drag
?
'pointer'
:
'default'
);
$btn
.
kmui
().
active
(
drag
);
me
.
_paper
.
setStyle
(
'cursor'
,
drag
?
'-webkit-grab'
:
'default'
);
if
(
drag
)
{
$btn
.
kmui
().
active
(
drag
);
me
.
_paper
.
drag
();
if
(
drag
)
{
}
else
{
me
.
_paper
.
drag
();
me
.
_paper
.
undrag
();
}
else
{
me
.
_paper
.
undrag
();
}
},
'zoom-in'
:
function
(
e
)
{
var
value
=
zoom
(
me
.
getPaper
(),
0.707
);
me
.
fire
(
'zoom'
,
{
zoom
:
value
}
);
},
'zoom-out'
:
function
(
e
)
{
var
value
=
zoom
(
me
.
getPaper
(),
1
/
0.707
);
me
.
fire
(
'zoom'
,
{
zoom
:
value
}
);
}
}
},
}
[
name
]
,
title
:
this
.
getLang
(
'tooltips.'
)[
name
]
||
''
title
:
this
.
getLang
(
'tooltips.'
)[
name
]
||
''
}
);
}
);
me
.
on
(
'beforemousemove'
,
function
(
e
)
{
switch
(
name
)
{
if
(
this
.
_onDragMode
)
{
case
'hand'
:
e
.
stopPropagation
();
me
.
on
(
'beforemousemove'
,
function
(
e
)
{
}
if
(
this
.
_onDragMode
)
{
}
);
e
.
stopPropagation
();
kity
.
extendClass
(
kity
.
Paper
,
kity
.
Draggable
);
}
}
);
kity
.
extendClass
(
kity
.
Paper
,
kity
.
Draggable
);
break
;
case
'zoom-in'
:
me
.
on
(
'zoom'
,
function
(
e
)
{
$btn
.
kmui
().
disabled
(
e
.
zoom
<=
0.5
);
}
);
break
;
case
'zoom-out'
:
me
.
on
(
'zoom'
,
function
(
e
)
{
$btn
.
kmui
().
disabled
(
e
.
zoom
>=
2
);
}
);
me
.
on
(
'mousewheel'
,
function
(
e
)
{
var
delta
=
e
.
originEvent
.
wheelDelta
;
if
(
Math
.
abs
(
delta
)
>
100
)
{
clearTimeout
(
me
.
_wheelZoomTimeout
);
}
else
{
return
;
}
me
.
_wheelZoomTimeout
=
setTimeout
(
function
()
{
var
value
;
var
lastValue
=
me
.
getPaper
().
_zoom
||
1
;
if
(
delta
<
0
&&
lastValue
>
0.5
)
{
value
=
zoom
(
me
.
getPaper
(),
0.707
);
me
.
fire
(
'zoom'
,
{
zoom
:
value
}
);
}
else
if
(
delta
>
0
&&
lastValue
<
2
)
{
value
=
zoom
(
me
.
getPaper
(),
1
/
0.707
);
me
.
fire
(
'zoom'
,
{
zoom
:
value
}
);
}
},
100
);
e
.
originEvent
.
preventDefault
();
}
);
}
return
$btn
;
return
$btn
;
}
}
);
);
\ No newline at end of file
src/module/dragtree.js
View file @
4df655fe
...
@@ -206,8 +206,8 @@ var DragBox = kity.createClass( "DragBox", {
...
@@ -206,8 +206,8 @@ var DragBox = kity.createClass( "DragBox", {
}
}
if
(
target
)
{
if
(
target
)
{
this
.
_addDropStyle
(
target
);
this
.
_addDropStyle
(
target
);
this
.
_lastSucceedTarget
=
target
;
}
}
this
.
_lastSucceedTarget
=
target
;
},
},
_removeDropStyle
:
function
(
node
)
{
_removeDropStyle
:
function
(
node
)
{
...
@@ -215,7 +215,7 @@ var DragBox = kity.createClass( "DragBox", {
...
@@ -215,7 +215,7 @@ var DragBox = kity.createClass( "DragBox", {
},
},
_addDropStyle
:
function
(
node
)
{
_addDropStyle
:
function
(
node
)
{
node
.
_layout
.
bgRect
.
stroke
(
'rgb(254, 219, 0)'
,
2
);
node
.
_layout
.
bgRect
.
stroke
(
'rgb(254, 219, 0)'
,
3
);
},
},
dragStart
:
function
(
position
)
{
dragStart
:
function
(
position
)
{
...
...
src/module/select.js
View file @
4df655fe
...
@@ -80,7 +80,7 @@ KityMinder.registerModule( "Select", function () {
...
@@ -80,7 +80,7 @@ KityMinder.registerModule( "Select", function () {
}
}
if
(
marqueeMode
)
{
if
(
marqueeMode
)
{
marqueeShape
.
fadeOut
(
200
,
'ease'
,
0
,
function
()
{
marqueeShape
.
fadeOut
(
200
,
'ease'
,
0
,
function
()
{
marqueeShape
.
remove
();
if
(
marqueeShape
.
remove
)
marqueeShape
.
remove
();
}
);
}
);
marqueeMode
=
false
;
marqueeMode
=
false
;
}
}
...
...
src/module/zoom.js
View file @
4df655fe
KityMinder
.
registerModule
(
'Zoom'
,
function
()
{
KityMinder
.
registerModule
(
'Zoom'
,
function
()
{
/*
return
{
return
{
events
:
{
events
:
{
'mousewheel'
:
function
(
e
)
{
'mousewheel'
:
function
(
e
)
{
if ( e.originEvent.wheelDelta > 0 ) {
if ( this._zoom < 0.2 ) return;
this._zoom *= 0.95;
this.getRenderContainer().scale( 0.95 );
} else {
if ( this._zoom > 5 ) return;
this._zoom /= 0.95;
this.getRenderContainer().scale( 1 / 0.95 );
}
e
.
originEvent
.
preventDefault
();
e
.
originEvent
.
preventDefault
();
},
},
'ready'
:
function
()
{
'ready'
:
function
()
{
this
.
_zoom
=
1
;
this
.
_zoom
=
1
;
}
}
}
}
};*/
};
return
{};
}
);
}
);
\ No newline at end of file
themes/default/_css/buttonicon.css
View file @
4df655fe
...
@@ -22,4 +22,10 @@
...
@@ -22,4 +22,10 @@
}
}
.kmui-btn-toolbar
.kmui-btn
.kmui-icon-clock
{
.kmui-btn-toolbar
.kmui-btn
.kmui-icon-clock
{
background
:
url(../images/clock.png)
no-repeat
2px
2px
;
background
:
url(../images/clock.png)
no-repeat
2px
2px
;
}
.kmui-btn-toolbar
.kmui-btn
.kmui-icon-zoom-in
{
background
:
url(../images/zoom_in.png)
no-repeat
2px
2px
;
}
.kmui-btn-toolbar
.kmui-btn
.kmui-icon-zoom-out
{
background
:
url(../images/zoom_out.png)
no-repeat
2px
2px
;
}
}
\ No newline at end of file
themes/default/images/zoom_in.png
0 → 100755
View file @
4df655fe
726 Bytes
themes/default/images/zoom_out.png
0 → 100755
View file @
4df655fe
717 Bytes
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