Skip to content

Commit 43bc73d

Browse files
committed
Fix: Show magnifying glass instantaneous when enabled from shortcuts
1 parent c3578a2 commit 43bc73d

4 files changed

Lines changed: 36 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1717
- Some tap zones events not working [`225de43`](https://github.com/ollm/OpenComic/commit/225de437284d4db2b10b5a42bd90ddfe8711c001)
1818
- Thumbnails and progress missing when filtering current page [`beb5f90`](https://github.com/ollm/OpenComic/commit/beb5f908deb81606269aff9a6b041e7511006a2e)
1919
- Rare cases of blank images during reading [`e1f27b3`](https://github.com/ollm/OpenComic/commit/e1f27b315bc9023e35c7ea52122d3c918564f5e3)
20+
- Show magnifying glass instantaneous when enabled from shortcuts
2021

2122
## [v1.6.0](https://github.com/ollm/OpenComic/releases/tag/v1.6.0) (27-07-2025)
2223

scripts/reading.js

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,7 +2763,7 @@ function rotateImage(rotated = false, x = 0, y = 0)
27632763
}
27642764

27652765
//Turn the magnifying glass on and off
2766-
function activeMagnifyingGlass(active = null, gamepad = false)
2766+
function activeMagnifyingGlass(active = null, gamepad = false, fromSwitch = false)
27672767
{
27682768
// Toggle magnifying glass
27692769
if(active === null) active = !config.readingMagnifyingGlass;
@@ -2772,7 +2772,7 @@ function activeMagnifyingGlass(active = null, gamepad = false)
27722772
{
27732773
storage.updateVar('config', 'readingMagnifyingGlass', true);
27742774
render.setMagnifyingGlassStatus(config.readingMagnifyingGlassZoom, doublePage.active());
2775-
2775+
27762776
if(gamepad)
27772777
{
27782778
let contentRight = template._contentRight();
@@ -2783,6 +2783,10 @@ function activeMagnifyingGlass(active = null, gamepad = false)
27832783

27842784
magnifyingGlassControl(1, {pageX: pageX, pageY: pageY, originalEvent: {touches: false}});
27852785
}
2786+
else if(pointermoveEvent && !fromSwitch)
2787+
{
2788+
magnifyingGlassControl(1, pointermoveEvent);
2789+
}
27862790
}
27872791
else
27882792
{
@@ -2840,14 +2844,16 @@ function magnifyingGlassControlPrev()
28402844
//Magnifying glass control
28412845
var magnifyingGlassControlST = false;
28422846

2843-
function magnifyingGlassControl(mode, e = false, lensData = false)
2847+
function magnifyingGlassControl(mode, event = false, lensData = false)
28442848
{
28452849
let x = 0, y = 0;
28462850

2847-
if(e)
2851+
if(event)
28482852
{
2849-
x = e.originalEvent.touches ? e.originalEvent.touches[0].pageX : (e.pageX || !e.clientX ? e.pageX : e.clientX);
2850-
y = e.originalEvent.touches ? e.originalEvent.touches[0].pageY : (e.pageY || !e.clientY ? e.pageY : e.clientY);
2853+
const originalEvent = event.originalEvent || event;
2854+
2855+
x = originalEvent.touches ? originalEvent.touches[0].pageX : (event.pageX || !event.clientX ? event.pageX : event.clientX);
2856+
y = originalEvent.touches ? originalEvent.touches[0].pageY : (event.pageY || !event.clientY ? event.pageY : event.clientY);
28512857
}
28522858

28532859
let contentRight = template._contentRight();
@@ -2893,6 +2899,8 @@ function magnifyingGlassControl(mode, e = false, lensData = false)
28932899
y: y,
28942900
mode: mode,
28952901
};
2902+
2903+
contentRight.style.cursor = 'none';
28962904
}
28972905
else
28982906
{
@@ -2908,6 +2916,8 @@ function magnifyingGlassControl(mode, e = false, lensData = false)
29082916
dom.this(contentRight).find('.reading-lens').removeClass('a').addClass('d');
29092917
magnifyingGlassView = false;
29102918
magnifyingGlassPosition.mode = mode;
2919+
2920+
contentRight.style.cursor = '';
29112921
}
29122922

29132923
//calculateView();
@@ -4627,10 +4637,12 @@ function applyMoveZoomWithMouse(pageX = false, pageY = false)
46274637
}
46284638

46294639
// Events functions
4630-
var contentLeftRect = false, contentRightRect = false, barHeaderRect = false, touchevents = {active: false, start: false, distance: 0, scale: 0, maxTouches: 0, numTouches: 0, touches: [], touchesXY: [], type: 'move'};
4640+
var contentLeftRect = false, contentRightRect = false, barHeaderRect = false, touchevents = {active: false, start: false, distance: 0, scale: 0, maxTouches: 0, numTouches: 0, touches: [], touchesXY: [], type: 'move'}, pointermoveEvent = false;
46314641

46324642
function pointermove(event)
46334643
{
4644+
pointermoveEvent = event;
4645+
46344646
let pageX = app.pageX(event);
46354647
let pageY = app.pageY(event);
46364648

@@ -5010,7 +5022,7 @@ function mouseleave()
50105022
isMouseenter.document = false;
50115023
}
50125024

5013-
var touchTimeout, mouseout = {lens: false, body: false, window: false}, isMouseenter = {document: true}, touchStart = false, magnifyingGlassOffset = false, readingCurrentPath = false, readingCurrentBookmarks = undefined, zoomMoveData = {}, magnifyingGlassScroll = {scrollTop: false, time: 0}, readingDragScroll = false, gamepadScroll = false, readingIsCanvas = false, readingIsEbook = false, readingFile = false, readingFileC = false, gamepadAxesNow = 0, scrollInStart = false, scrollInEnd = false, trackingCurrent = false;
5025+
var touchTimeout, mouseleave = {lens: false, body: false, window: false}, isMouseenter = {document: true}, touchStart = false, magnifyingGlassOffset = false, readingCurrentPath = false, readingCurrentBookmarks = undefined, zoomMoveData = {}, magnifyingGlassScroll = {scrollTop: false, time: 0}, readingDragScroll = false, gamepadScroll = false, readingIsCanvas = false, readingIsEbook = false, readingFile = false, readingFileC = false, gamepadAxesNow = 0, scrollInStart = false, scrollInEnd = false, trackingCurrent = false;
50145026

50155027
//It starts with the reading of a comic, events, argar images, counting images ...
50165028
async function read(path, index = 1, end = false, isCanvas = false, isEbook = false, imagePath = false)
@@ -5036,11 +5048,11 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
50365048

50375049
filters.setImagesPath(false);
50385050

5039-
$(window).off('keydown touchstart touchend mouseup mousemove touchmove mouseout click');
5051+
$(window).off('keydown touchstart touchend mouseup mousemove touchmove mouseleave click');
50405052
template.contentRight().off('mousewheel');
50415053
$('.reading-body, .reading-lens').off('mousemove');
50425054
$('.reading-lens').off('mousemove');
5043-
$('.reading-body').off('mouseout mouseenter mousedown touchstart touchmove');
5055+
$('.reading-body').off('mouseleave mouseenter mousedown touchstart touchmove');
50445056
$('.content-right > div > div').off('scroll');
50455057

50465058
events.eventHover();
@@ -5347,34 +5359,34 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
53475359

53485360
});
53495361

5350-
template.contentRight('.reading-body').on('mouseout', function(e) {
5362+
template.contentRight('.reading-body').on('mouseleave', function(event) {
53515363

53525364
if(onReading && isLoaded && config.readingMagnifyingGlass && !readingTouchEvent)
53535365
{
5354-
mouseout.body = true;
5366+
mouseleave.body = true;
53555367

5356-
if(mouseout.lens) magnifyingGlassControl(0, e);
5368+
if(mouseleave.lens) magnifyingGlassControl(0, event);
53575369
}
53585370

53595371
});
53605372

5361-
template.contentRight('.reading-body').on('mouseenter', function(e) {
5373+
template.contentRight('.reading-body').on('mouseenter', function(event) {
53625374

53635375
if(onReading && isLoaded && config.readingMagnifyingGlass && !readingTouchEvent)
53645376
{
5365-
mouseout.body = false;
5377+
mouseleave.body = false;
53665378
}
53675379

53685380
});
53695381

5370-
$(window).on('mouseout', function(e) {
5382+
$(window).on('mouseleave', function(event) {
53715383

53725384
if(onReading && isLoaded && config.readingMagnifyingGlass && !readingTouchEvent)
53735385
{
5374-
mouseout.lens = true;
5386+
mouseleave.lens = true;
53755387

5376-
var x = e.originalEvent.touches ? e.originalEvent.touches[0].pageX : (e.pageX ? e.pageX : e.clientX);
5377-
var y = e.originalEvent.touches ? e.originalEvent.touches[0].pageY : (e.pageY ? e.pageY : e.clientY);
5388+
var x = event.originalEvent.touches ? event.originalEvent.touches[0].pageX : (event.pageX ? event.pageX : event.clientX);
5389+
var y = event.originalEvent.touches ? event.originalEvent.touches[0].pageY : (event.pageY ? event.pageY : event.clientY);
53785390

53795391
var rbHeight = template.contentRight('.reading-body').height();
53805392
var rbWidth = template.contentRight('.reading-body').width();
@@ -5383,7 +5395,7 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
53835395

53845396
if(!(x > rbOffsetLeft && y > rbOffsetTop && x < (rbWidth + rbOffsetLeft) && y < (rbHeight + rbOffsetTop)))
53855397
{
5386-
magnifyingGlassControl(0, e);
5398+
magnifyingGlassControl(0, event);
53875399
}
53885400
}
53895401

@@ -5393,7 +5405,7 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
53935405

53945406
if(onReading && isLoaded && config.readingMagnifyingGlass && !readingTouchEvent)
53955407
{
5396-
mouseout.lens = false;
5408+
mouseleave.lens = false;
53975409
}
53985410

53995411
})

templates/reading.elements.menus.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div>
55
<div class="menu-simple-text gamepad-item">
66
{{language.reading.magnifyingGlass.activate}}
7-
<div class="switch{{#if config.readingMagnifyingGlass}} a{{/if}}" on="reading.activeMagnifyingGlass(true)" off="reading.activeMagnifyingGlass(false)">
7+
<div class="switch{{#if config.readingMagnifyingGlass}} a{{/if}}" on="reading.activeMagnifyingGlass(true, false, true)" off="reading.activeMagnifyingGlass(false, false, true)">
88
<div></div>
99
<svg viewBox="0 0 52 32"><path d="M 8,0 C 3.58,0 0,3.58 0,8 0,12.42 3.58,16 8,16 8,16 8,16 8,16 12.42,16 16,12.42 16,8 16,3.58 12.42,0 8,0 8,0 8,0 8,0 Z"></path></svg>
1010
</div>

themes/material-design/reading.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
z-index: 3;
322322
transition: background-color 0.2s;
323323
contain: strict;
324+
pointer-events: none;
324325
}
325326

326327
.reading-lens > div

0 commit comments

Comments
 (0)