mirror of
https://github.com/danbulant/Mangades
synced 2026-07-06 03:20:42 +00:00
improved mouse navigation
This commit is contained in:
parent
28c51d8f05
commit
b7ad5caa85
1 changed files with 11 additions and 6 deletions
|
|
@ -5,16 +5,12 @@
|
||||||
export var page;
|
export var page;
|
||||||
export var scoped;
|
export var scoped;
|
||||||
|
|
||||||
console.log("scoped", scoped);
|
|
||||||
|
|
||||||
var chapter = scoped.chapter;
|
var chapter = scoped.chapter;
|
||||||
$: chapter = scoped.chapter;
|
$: chapter = scoped.chapter;
|
||||||
console.log("chapter", chapter);
|
|
||||||
var manga = scoped.manga;
|
var manga = scoped.manga;
|
||||||
$: manga = scoped.manga;
|
$: manga = scoped.manga;
|
||||||
var atHome = scoped.atHome;
|
var atHome = scoped.atHome;
|
||||||
$: atHome = scoped.atHome;
|
$: atHome = scoped.atHome;
|
||||||
console.log("athome", atHome);
|
|
||||||
var title = manga.title.en || manga.title.jp || Object.values(manga.title)[0];
|
var title = manga.title.en || manga.title.jp || Object.values(manga.title)[0];
|
||||||
$: title = manga.title.en || manga.title.jp || Object.values(manga.title)[0];
|
$: title = manga.title.en || manga.title.jp || Object.values(manga.title)[0];
|
||||||
|
|
||||||
|
|
@ -86,17 +82,25 @@
|
||||||
*/
|
*/
|
||||||
function mouseclick(e) {
|
function mouseclick(e) {
|
||||||
if(xDown !== null) return;
|
if(xDown !== null) return;
|
||||||
|
console.log(e.buttons);
|
||||||
if(e.buttons & 8) {
|
if(e.buttons & 8) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
prev();
|
prev();
|
||||||
}
|
}
|
||||||
if(e.buttons & 16) {
|
if(e.buttons & 16) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
if(e.buttons & 1) {
|
if(e.buttons & 1) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
next();
|
// if clicked in the left quarter of the screen go to previous page
|
||||||
|
if(e.clientX < window.innerWidth / 4) {
|
||||||
|
prev();
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,9 +108,10 @@
|
||||||
* @param {MouseEvent} e
|
* @param {MouseEvent} e
|
||||||
*/
|
*/
|
||||||
function preventDefault(e) {
|
function preventDefault(e) {
|
||||||
if([1, 3, 4].includes(e.button)) {
|
if([1, 3, 4, 8, 16].includes(e.button)) {
|
||||||
console.log("Preventing default");
|
console.log("Preventing default");
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue