Skip to content

Commit

Permalink
fix drag outside issue
Browse files Browse the repository at this point in the history
  • Loading branch information
techird committed Jul 23, 2014
1 parent 8600744 commit 3cb3490
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
13 changes: 6 additions & 7 deletions publish
@@ -1,18 +1,17 @@
echo -e "\033[0;33;1mPublish start."
echo -e "\033[0;33;1m> Checking out gh-pages\033[0m"
branch -D gh-pages
echo -e "\033[0;33;1m> Checking out gh-pages...\033[0m"
git branch -D gh-pages -q
git checkout -q -b gh-pages

echo -e "\033[0;33;1m> Delete server branch\033[0m"
git push origin :gh-pages
echo -e "\033[0;33;1m> Delete server branch...\033[0m"
git push origin :gh-pages -q

echo -e "\033[0;33;1m> Building dist js files\033[0m"
echo -e "\033[0;33;1m> Building dist js files...\033[0m"
grunt -q > GRUNT_OUTPUT
rm -f GRUNT_OUTPUT

echo -e "\033[0;33;1m> Commit dist js files...\033[0m"
git add dist

echo -e "\033[0;33;1m> Commit dist js files\033[0m"
git commit -qm "publish"

echo -e "\033[0;33;1m> Pusing to git...\033[0m"
Expand Down
4 changes: 2 additions & 2 deletions src/core/render.js
Expand Up @@ -123,8 +123,8 @@ kity.extendClass(Minder, (function() {
}

for (j = 0; j < nodes.length; j++) {
this.fire('afterrender', {
node: node
this.fire('noderender', {
node: nodes[j]
});
}
},
Expand Down
25 changes: 16 additions & 9 deletions src/module/view.js
Expand Up @@ -28,6 +28,20 @@ var ViewDragger = kity.createClass("ViewDragger", {
lastPosition = null,
currentPosition = null;

function dragEnd(e) {
lastPosition = null;

e.stopPropagation();

// 临时拖动需要还原状态
if (isTempDrag) {
dragger.setEnabled(false);
isTempDrag = false;
if (dragger._minder.getStatus() == 'hand')
dragger._minder.rollbackStatus();
}
}

this._minder.on('normal.mousedown normal.touchstart readonly.mousedown readonly.touchstart', function(e) {

if (e.originEvent.button == 2) {
Expand Down Expand Up @@ -68,16 +82,9 @@ var ViewDragger = kity.createClass("ViewDragger", {
}
})

.on('mouseup touchend', function(e) {
lastPosition = null;
.on('mouseup touchend', dragEnd);

// 临时拖动需要还原状态
if (isTempDrag) {
dragger.setEnabled(false);
isTempDrag = false;
this.rollbackStatus();
}
});
window.addEventListener('mouseup', dragEnd);
}
});

Expand Down

0 comments on commit 3cb3490

Please sign in to comment.