Merge pull request #5019 from enriktigasna/bugfix-zoom
Some checks failed
e2e / test (firefox, ubuntu) (push) Has been cancelled
e2e / test (firefox, windows) (push) Has been cancelled
e2e / test (firefoxesr, ubuntu) (push) Has been cancelled
lint / lint (lint) (push) Has been cancelled
lint / lint (mozilla) (push) Has been cancelled
lint / lint (unit) (push) Has been cancelled
Website / build (push) Has been cancelled
Website / deploy (push) Has been cancelled

Fix: #5018: Change limits on zoom from 300% to 500%
This commit is contained in:
Oliver Blanthorn 2024-07-12 11:15:02 +00:00 committed by GitHub
commit eb1141b8c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2281,11 +2281,11 @@ export async function geturlsforlinks(reltype = "rel", rel: string) {
return []
}
/** Sets the current page's zoom level anywhere between 30% and 300%.
/** Sets the current page's zoom level anywhere between 30% and 500%.
*
* If you overshoot the level while using relative adjustments i.e. level > 300% or level < 30% the zoom level will be set to it's maximum or minimum position. Relative adjustments are made * in percentage points, i.e. `:zoom +10 true` increases the zoom level from 50% to 60% or from * 200% to 210%.
* If you overshoot the level while using relative adjustments i.e. level > 500% or level < 30% the zoom level will be set to it's maximum or minimum position. Relative adjustments are made * in percentage points, i.e. `:zoom +10 true` increases the zoom level from 50% to 60% or from * 200% to 210%.
*
* @param level - The zoom level to set. Treated as percentage value if larger than 3 or smaller than -3.
* @param level - The zoom level to set. Treated as percentage value if larger than 5 or smaller than -3.
* @param rel - Set the zoom adjustment to be relative to current zoom level.
* @param tabId - The tabId to apply zoom level too.
* If set to 'auto' it will default to the current active tab.
@ -2293,15 +2293,15 @@ export async function geturlsforlinks(reltype = "rel", rel: string) {
*/
//#background
export async function zoom(level = 0, rel = "false", tabId = "auto") {
level = Math.abs(level) > 3 ? level / 100 : level
if (rel === "false" && (level > 3 || level < 0.3)) {
level = Math.abs(level) > 5 ? level / 100 : level
if (rel === "false" && (level > 5 || level < 0.3)) {
throw new Error(`[zoom] level out of range: ${level}`)
}
if (rel === "true") {
level += await browser.tabs.getZoom()
// Handle overshooting of zoom level.
if (level > 3) level = 3
if (level > 5) level = 5
if (level < 0.3) level = 0.3
}