simplify touch detection logic
no swipes on desktop needed with the previous commit!
This commit is contained in:
parent
6b7b639618
commit
1c71ede145
2 changed files with 7 additions and 9 deletions
|
@ -280,7 +280,7 @@ npm run build-electron-{windows, darwin, linux}</pre>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="sidebar" data-state="visible" ng-swipe-left="swipeLeft($event)" class="vertical-line">
|
<div id="sidebar" data-state="visible" ng-swipe-left="swipeLeft()" ng-swipe-disable-mouse class="vertical-line">
|
||||||
<ul class="nav nav-pills nav-stacked" ng-class="{'indented': (predicate === 'serverSortKey'), 'showquickkeys': showQuickKeys, 'showjumpkeys': showJumpKeys}">
|
<ul class="nav nav-pills nav-stacked" ng-class="{'indented': (predicate === 'serverSortKey'), 'showquickkeys': showQuickKeys, 'showjumpkeys': showJumpKeys}">
|
||||||
<li class="bufferfilter">
|
<li class="bufferfilter">
|
||||||
<form role="form">
|
<form role="form">
|
||||||
|
@ -310,8 +310,8 @@ npm run build-electron-{windows, darwin, linux}</pre>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="bufferlines" class="favorite-font" ng-swipe-right="swipeRight($event)" ng-swipe-left="swipeLeft($event)" ng-class="{'withnicklist': showNicklist}" when-scrolled="infiniteScroll()" imgur-drop>
|
<div id="bufferlines" class="favorite-font" ng-swipe-right="swipeRight()" ng-swipe-left="swipeLeft()" ng-swipe-disable-mouse ng-class="{'withnicklist': showNicklist}" when-scrolled="infiniteScroll()" imgur-drop>
|
||||||
<div id="nicklist" ng-if="showNicklist" ng-swipe-right="closeNick()" class="vertical-line-left">
|
<div id="nicklist" ng-if="showNicklist" ng-swipe-right="swipeRight()" ng-swipe-disable-mouse class="vertical-line-left">
|
||||||
<ul class="nicklistgroup list-unstyled" ng-repeat="group in nicklist">
|
<ul class="nicklistgroup list-unstyled" ng-repeat="group in nicklist">
|
||||||
<li ng-repeat="nick in group.nicks|orderBy:'name'">
|
<li ng-repeat="nick in group.nicks|orderBy:'name'">
|
||||||
<a ng-click="openBuffer(nick.name)"><span ng-class="::nick.prefixClasses" ng-bind="::nick.prefix"></span><span ng-class="::nick.nameClasses" ng-bind="::nick.name"></span></a>
|
<a ng-click="openBuffer(nick.name)"><span ng-class="::nick.prefixClasses" ng-bind="::nick.prefix"></span><span ng-class="::nick.nameClasses" ng-bind="::nick.name"></span></a>
|
||||||
|
|
|
@ -332,13 +332,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
return document.getElementById('content').getAttribute('sidebar-state') === 'visible';
|
return document.getElementById('content').getAttribute('sidebar-state') === 'visible';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.swipeRight = function($event) {
|
$scope.swipeRight = function() {
|
||||||
var touch = $event instanceof TouchEvent;
|
|
||||||
// Depending on swipe state
|
// Depending on swipe state
|
||||||
if ($scope.swipeStatus === 1) {
|
if ($scope.swipeStatus === 1) {
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
} else if ($scope.swipeStatus === 0) {
|
} else if ($scope.swipeStatus === 0) {
|
||||||
if (touch) $scope.showSidebar();
|
$scope.showSidebar();
|
||||||
} else if ($scope.swipeStatus === -1) {
|
} else if ($scope.swipeStatus === -1) {
|
||||||
if (!settings.alwaysnicklist) $scope.closeNick();
|
if (!settings.alwaysnicklist) $scope.closeNick();
|
||||||
} else {
|
} else {
|
||||||
|
@ -349,11 +348,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.swipeLeft = function($event) {
|
$rootScope.swipeLeft = function() {
|
||||||
var touch = $event instanceof TouchEvent;
|
|
||||||
// Depending on swipe state, ...
|
// Depending on swipe state, ...
|
||||||
if ($scope.swipeStatus === 1) {
|
if ($scope.swipeStatus === 1) {
|
||||||
if (touch) $scope.hideSidebar();
|
$scope.hideSidebar();
|
||||||
} else if ($scope.swipeStatus === 0) {
|
} else if ($scope.swipeStatus === 0) {
|
||||||
$scope.openNick();
|
$scope.openNick();
|
||||||
} else if ($scope.swipeStatus === -1) {
|
} else if ($scope.swipeStatus === -1) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue