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
e259696e
Commit
e259696e
authored
Mar 10, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
滚轮缩放功能修正
parent
e57b5a03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
20 deletions
+25
-20
hand.js
src/module/hand.js
+1
-0
zoom.js
src/module/zoom.js
+24
-20
No files found.
src/module/hand.js
View file @
e259696e
...
...
@@ -113,6 +113,7 @@ KityMinder.registerModule( 'Hand', function () {
mousewheel
:
function
(
e
)
{
var
dx
,
dy
;
e
=
e
.
originEvent
;
if
(
e
.
ctrlKey
||
e
.
shiftKey
)
return
;
if
(
'wheelDeltaX'
in
e
)
{
...
...
src/module/zoom.js
View file @
e259696e
...
...
@@ -28,31 +28,31 @@ KityMinder.registerModule( 'Zoom', function () {
}
}
);
animator
.
start
(
paper
,
1
00
,
'ease'
);
animator
.
start
(
paper
,
5
00
,
'ease'
);
minder
.
_zoomValue
=
zoomValue
*=
rate
;
}
var
ZoomInCommand
=
kity
.
createClass
(
'ZoomInCommand'
,
{
base
:
Command
,
execute
:
function
(
minder
)
{
if
(
!
this
.
queryState
(
minder
)
)
{
if
(
!
this
.
queryState
(
minder
)
)
{
zoom
(
minder
,
1
/
ZOOM_STEP
);
}
},
queryState
:
function
(
minder
)
{
return
(
minder
.
_zoomValue
>
1
/
MAX_ZOOM
)
?
0
:
-
1
;
return
(
minder
.
_zoomValue
>
1
/
MAX_ZOOM
)
?
0
:
-
1
;
}
}
);
var
ZoomOutCommand
=
kity
.
createClass
(
'ZoomOutCommand'
,
{
base
:
Command
,
execute
:
function
(
minder
)
{
if
(
!
this
.
queryState
(
minder
)
)
{
if
(
!
this
.
queryState
(
minder
)
)
{
zoom
(
minder
,
ZOOM_STEP
);
}
},
queryState
:
function
(
minder
)
{
return
(
minder
.
_zoomValue
<
1
/
MIN_ZOOM
)
?
0
:
-
1
;
return
(
minder
.
_zoomValue
<
1
/
MIN_ZOOM
)
?
0
:
-
1
;
}
}
);
...
...
@@ -64,26 +64,30 @@ KityMinder.registerModule( 'Zoom', function () {
events
:
{
'normal.keydown'
:
function
(
e
)
{
var
me
=
this
;
var
originEvent
=
e
.
originEvent
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
if
(
keymap
[
'='
]
==
keyCode
)
{
me
.
execCommand
(
'zoom-in'
);
}
if
(
keymap
[
'-'
]
==
keyCode
)
{
me
.
execCommand
(
'zoom-out'
);
'normal.keydown'
:
function
(
e
)
{
var
me
=
this
;
var
originEvent
=
e
.
originEvent
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
if
(
keymap
[
'='
]
==
keyCode
)
{
me
.
execCommand
(
'zoom-in'
);
}
if
(
keymap
[
'-'
]
==
keyCode
)
{
me
.
execCommand
(
'zoom-out'
);
}
},
}
},
'ready'
:
function
()
{
this
.
_zoomValue
=
1
;
},
// disable mouse wheel
'mousewheel_'
:
function
(
e
)
{
'normal.mousewheel'
:
function
(
e
)
{
if
(
!
e
.
originEvent
.
ctrlKey
)
return
;
var
delta
=
e
.
originEvent
.
wheelDelta
;
var
me
=
this
;
if
(
!
kity
.
Browser
.
mac
)
{
delta
=
-
delta
;
}
// 稀释
if
(
Math
.
abs
(
delta
)
>
100
)
{
clearTimeout
(
this
.
_wheelZoomTimeout
);
...
...
@@ -95,9 +99,9 @@ KityMinder.registerModule( 'Zoom', function () {
var
value
;
var
lastValue
=
me
.
getPaper
().
_zoom
||
1
;
if
(
delta
<
0
)
{
me
.
execCommand
(
'zoom-in'
);
me
.
execCommand
(
'zoom-in'
);
}
else
if
(
delta
>
0
)
{
me
.
execCommand
(
'zoom-out'
);
me
.
execCommand
(
'zoom-out'
);
}
},
100
);
...
...
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