aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2010-03-28 14:20:22 +0000
committeranekos2010-03-28 14:20:22 +0000
commit948d5316d136288202b68dc636f2695489a91e90 (patch)
tree0a00f37629ccbe43c9c9617777d3e9a0506165b4
parentf9a51e76bf22c78eaeae9e90dc2aa8c2f65c540e (diff)
downloadvimperator-plugins-948d5316d136288202b68dc636f2695489a91e90.tar.bz2
switch に切り替え
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37112 d0d07461-0603-4401-acd4-de1884942a52
-rwxr-xr-xspatial-navigation.js25
1 files changed, 10 insertions, 15 deletions
diff --git a/spatial-navigation.js b/spatial-navigation.js
index b37ab34..fcd6991 100755
--- a/spatial-navigation.js
+++ b/spatial-navigation.js
@@ -109,22 +109,17 @@ let g:spatial_navigation_mappings="<A-h> <A-j> <A-k> <A-l>"
window.document.commandDispatcher.focusedElement;
function isRectInDirection (dir, focusedRect, anotherRect) {
- if (dir === DIR.L) {
- return (anotherRect.left < focusedRect.left);
- }
-
- if (dir === DIR.R) {
- return (anotherRect.right > focusedRect.right);
- }
-
- if (dir === DIR.U) {
- return (anotherRect.top < focusedRect.top);
- }
-
- if (dir === DIR.D) {
- return (anotherRect.bottom > focusedRect.bottom);
+ switch (dir) {
+ case DIR.L:
+ return anotherRect.left < focusedRect.left;
+ case DIR.R:
+ return anotherRect.right > focusedRect.right;
+ case DIR.U:
+ return anotherRect.top < focusedRect.top;
+ case DIR.D:
+ return anotherRect.bottom > focusedRect.bottom
}
- return false;
+ return false;
}
function inflateRect (rect, value) {