Skip to content

Commit

Permalink
fix zoom in mac (fex-team#46)
Browse files Browse the repository at this point in the history
* fix zoom in mac
* reverse delta
  • Loading branch information
Means88 authored and Dafrok committed Sep 20, 2018
1 parent e63eefc commit 7aabc8d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
9 changes: 3 additions & 6 deletions dist/kityminder.core.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* ====================================================
* Kity Minder Core - v1.4.49 - 2018-04-02
* Kity Minder Core - v1.4.50 - 2018-09-17
* https://github.com/fex-team/kityminder-core
* GitHub: https://github.com/fex-team/kityminder-core.git
* Copyright (c) 2018 Baidu FEX; Licensed BSD-3-Clause
Expand Down Expand Up @@ -7949,9 +7949,6 @@ _p[63] = {
if (!e.originEvent.ctrlKey && !e.originEvent.metaKey) return;
var delta = e.originEvent.wheelDelta;
var me = this;
if (!kity.Browser.mac) {
delta = -delta;
}
// 稀释
if (Math.abs(delta) > 100) {
clearTimeout(this._wheelZoomTimeout);
Expand All @@ -7961,9 +7958,9 @@ _p[63] = {
this._wheelZoomTimeout = setTimeout(function() {
var value;
var lastValue = me.getPaper()._zoom || 1;
if (delta < 0) {
if (delta > 0) {
me.execCommand("zoomin");
} else if (delta > 0) {
} else if (delta < 0) {
me.execCommand("zoomout");
}
}, 100);
Expand Down
4 changes: 2 additions & 2 deletions dist/kityminder.core.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>KityMinder Example</title>

<meta name="viewport" content="initial-scale=1.0, user-scalable=no" >
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
<link rel="stylesheet" href="src/kityminder.css" rel="stylesheet">

Expand Down Expand Up @@ -62,4 +62,4 @@
km.execCommand('hand');
</script>

</html>
</html>
9 changes: 2 additions & 7 deletions src/module/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ define(function(require, exports, module) {

var delta = e.originEvent.wheelDelta;
var me = this;

if (!kity.Browser.mac) {
delta = -delta;
}

// 稀释
if (Math.abs(delta) > 100) {
clearTimeout(this._wheelZoomTimeout);
Expand All @@ -180,9 +175,9 @@ define(function(require, exports, module) {
this._wheelZoomTimeout = setTimeout(function() {
var value;
var lastValue = me.getPaper()._zoom || 1;
if (delta < 0) {
if (delta > 0) {
me.execCommand('zoomin');
} else if (delta > 0) {
} else if (delta < 0) {
me.execCommand('zoomout');
}
}, 100);
Expand Down

0 comments on commit 7aabc8d

Please sign in to comment.