Commit Graph

34 Commits (master)

Author SHA1 Message Date
NiLuJe 90ae4acca6 Chore: Review FrameContainer constructors for shared dimen objects
Nothing else seems problematic, this is mostly just cosmetic sanitization
around Geom objects.
4 months ago
NiLuJe b0d8919399
ImageViewer: Followup to #9529 (#9544)
* ImageViewer: Minor code cleanups
* GestureDetector: Fix the `distance` field of `two_finger_pan` & `two_finger_swipe` gestures so that it's no longer the double of the actual distance traveled. Get rid of existing workarounds throughout the codebase that had to deal with this quirk.
2 years ago
zwim 6a01abb52c
[doc] add documentation to a few widgets (#8425) 2 years ago
Aleksa Sarai a29d24f86d geom: supplement :combine with more generic .boundingBox
It is a bit cleaner to do all of the necessary looping over lists of
Geoms within a straight-forward Geom.boundingBox function rather than
looping over :combine every time (or reimplementing :combine in some
cases). Geom:combine can be trivially reimplemented in terms of
Geom.boundingBox as well.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
NiLuJe acbf4b7a8c
Document: Round dimensions properly in getPageDimensions (#8170)
* Geom:transformByScale:
  * Apply the right scaling factor to the y axis
  * Round in a more sensible fashion (àla fz_round_rect, since we pretty much exclusively use it in a similar fashion).
* Bump base (https://github.com/koreader/koreader-base/pull/1407)
3 years ago
NiLuJe bb65a69193
Geom: nil guard a few rect methods (#7664)
We've managed to trip a few of those on dimen fields post-init but
pre-paintTo in a few weird coner-cases, a point at which dimen is often
nil.

ConfigDialog: Deal with that very thing in update()

Fix #7656
3 years ago
NiLuJe fe10d0bce5
Revamp flash_ui handling, once more, with feeling ;) (#7262)
* Simplify flash_ui handling (by handling the unhighlight pre-callback, c.f., #7262 for more details).
* UIManager: Handle translucent window-level widgets (and those wrapped in a translucent MovableContainer) properly in setDirty directly, making sure what's *underneath* them gets repainted to avoid alpha layering glitches. (This was previously handled via localized hacks).
* Update UIManager's documentation, and format it properly for ldoc parsing, making the HTML docs more useful.
* ReaderView: Reinitialize the various page areas when opening a new document, to prevent poisoning from the previous document.
* Event: Handle nils in an event's arguments.
* CheckButton/RadioButton: Switch to simple inversion to handle highlighting
* CheckButton: Make the highlight span the inner frame's width, instead of just the text's width, if possible.
* AlphaContainer: Fix & simplify, given the UIManager alpha handling.
* MovableContainer: When translucent, cache the canvas bb used for composition.
* Avoid spurious refreshes in a few widgets using various dummy *TextWidgets in order to first compute a text height.
* KeyValuePage: Avoid floats in size computations.
3 years ago
NiLuJe d8fc28df97
Page Overlap: Fix rectangle computation and arrow mode (#7269)
* In ReaderPaging, the panning step pre-PanningUpdate can be wildly overshot near page edges, so, use the corrected value instead by recomputing it after the panning has been effectively computed by ReaderView.
This fixes slight inaccuracies, as well as glaring mistakes when going backwards, or when near page edges.
This is in line with how ReaderRolling computes the value, which I only realized later because I'm an idiot. 
* Minor cleanups around the handling of the dim_area Geom object in general.

* Fix the "Arrow" page overlap mode to be painted in the right coordinates when going backward. Issue might not have been terribly clear because of the previous issue ;).
* Center the arrow's point, while we're here.
* Don't use AlphaContainer to make it translucent, because AlphaContainer is horribly broken, and has weird quirks and behavior that make no sense to me unless some very specific and unlikely constraints are met, and they definitely aren't here.
This fixes the arrow copying an arrow-sized square of the original page the book was opened on on the top-left corner of *every* page with an arrow. (lol).
* Do real proper alpha-blending via Icon/ImageWidget from the original icon, instead of faking it via addBlitFrom, in order to avoid the dimming *around* the triangle's shape.
3 years ago
Frans de Jonge a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.

Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:

```sh
ldoc --tags todo,fixme *.lua
```

However, whether that particular usage offers any advantage over other search tools is questionable at best.

* and some random beautification
5 years ago
Frans de Jonge 9eb073a524 [travis] Add protection against unscaled sizes
As pointed out by @poire-z

* [fix, UX] SkimToWidget scaling

* [fix] Button scaling

* [fix, UX] Scale ProgressWidget

* [fix, UX] Scale confirmbox

* [fix, UX] Scale just about everything
7 years ago
Frans de Jonge ba7377065e Doc: miscellaneous improvements. 7 years ago
Qingping Hou 0c49b915de refactor: add touch zone subsystem to inputcontainer
Touch zone decouples screen size from gesture event registration.

The win here is each individual widget does not need to update
gesture range on screen rotate/resize anymore.

Another advantage is we now have a centralized ordered array to handle
all registered touch event listeners, makes it much easier to resolve
gesture range conflicts between multiple widgets.

This patch also includes the following changes:

* migrate readerpaging to use readerui's touch zone
* migrate readerfooter to use readerui's touch zone
* move inverse read direction setting to touch menu's setting tab
* moved kobolight widget from readerview into readerui
* various dead code cleanups and comments
8 years ago
Qingping Hou 8799b4b6b1 doc: geometry module 8 years ago
Qingping Hou 3c647ff244 minor: various luacheck fixes 8 years ago
chrox 1f094657dc fix #1529 by rounding off the scaled dimension 9 years ago
chrox 07ae0cba81 fix #1011
The #1011 bug is caused by the `contains` check of link box with
visible area. When the link is at the very right (left?) of
the page, enlarged link box often exceeds the page bound rendering
the mentioned `contains` check failed. This patch uses an `intersectWith`
test to check if the link is in current page.
10 years ago
chrox 92219a1f1e cleanup: expand tab to 4 spaces 10 years ago
chrox 8e4516b824 add regional zoom mode in pdf/djvu page
In regional zoom mode double tap will zoom to the tapped
region(paragraph or column, etc., detected optically via libk2pdfopt).
As the first demo, this feature is only turned on in flipping mode by
tapping the top-left corner of the screen. Eventually we may incorporate
this feature in "free" zoom mode.
10 years ago
HW 09cd5c4104 Make DEBUG a require()d local 11 years ago
HW ef111b99c6 Refactored to use strictly locals 11 years ago
chrox 4660a3532b synchronize hightlights in non-/reflowing modes
and there is no need to OCR word if we can extract text from
original page in reflowing mode thanks to the rect maps between
normal page and reflowed page.
11 years ago
chrox 2b29c70250 fix Geom:combine when sizeof rect is zero 11 years ago
Qingping Hou b40be3d0f8 remove trailing white spaces 11 years ago
chrox 9ef581e69c add two_finger_pan_release gesture & some refactorings in tap state 11 years ago
chrox dc22370cf1 bugfix: intersected geom should be initiated with a fresh copy of self 11 years ago
Qingping Hou f3452234ea add math.lua, move all math related helpers in to it 11 years ago
chrox a1aa41136c add manual page crop for pdf/djvu documents 11 years ago
Qingping Hou c8d43cd33c add Input:eventAdjustHook(ev)
so we can adjust input event for KT on the fly.
the touch input event coordinates in KT ranges from 0-4095
instead of the screen size.
12 years ago
Qingping Hou ae1c489a0f implement full pageturn by viewport for all modes
* add notIntersectWith method for Geom
* add math.roundAwayFromZero in geometry.lua
* Readerview:recalculate now signals ViewRecalculate event.
  For now, this event is only usefull for ReaderPaging
12 years ago
Qingping Hou 7b707ab367 add usedbbox support 12 years ago
Qingping Hou 3486ae7e09 first demo of gesture parsing 12 years ago
HW ce5614ef6f cleanup, also removal of G_* constants
a bit of cleanup, switched width/height combo over to use
Geom() objects, moved framebuffer handling to Screen object,
callback syntax sanitizing, lots of small changes
12 years ago
HW 60ccd7441e fixed menu info displaying, replaced debug() by DEBUG()
the replacement of debug() was necessary to be able to access the lua library "debug" (for backtraces etc.)
12 years ago
HW 9e531fc2db file reorganisation
all lua frontend files are now in the frontend/ directory.
all old code is cleaned up.
12 years ago