-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add zoom command. #2978
Add zoom command. #2978
Conversation
Examples: map = zoom in factor=1.1 map - zoom in factor=1.1 map = zoom factor=1.1 map - zoom factor=0.90909
Please merge 😻 |
Please merge. |
It's a very useful feature. I use zooming on every site. Please add support:
Or just merge the commit. |
please merge |
+1 |
@smblott-github we used to have a zoom command in the early days of Vimium. Here's the initial commit (d367e58). We even saved the preference per domain, and had a configurable default zoom level (6042b7f) in Vimium. I removed (dc114c1) this command because setting document.body.style.zoom doesn't work the same as whatever Chrome is doing when you use Chrome's native zoom. In particular, text would start unexpectedly wrapping on some pages based on the zoom level, which never happens with Chrome's native zoom. See If we rework this to use Chrome's native zoom API rather than document.body.style.zoom, that should solve the zoom robustness piece. To make this feature more robust, we could then add:
I would argue that this command is not acceptable without adding #1, because our zoom is inferior to Chrome's native zoom in a really annoying way (i.e. it has a hidden sharp edge). I could see people navigating to reddit.com, zooming in, and the next time they navigate there, zooming in again because their settings weren't saved, and doing that every time they load the page. With Chrome's native zoom functionality, they would only have to zoom once. EDIT: fixed commit IDs. |
Saka key has this feature: const zoomStep = 10 // for 10%
/** Zoom in the active tab of the current window */
export async function zoomIn () {
const [tab] = await browser.tabs.query({ currentWindow: true, active: true })
const zoomFactor = await browser.tabs.getZoom()
await browser.tabs.setZoom(tab.id, Math.min(zoomFactor + zoomStep / 100, 3.0))
}
/** Zoom out the active tab of the current window */
export async function zoomOut () {
const [tab] = await browser.tabs.query({ currentWindow: true, active: true })
const zoomFactor = await browser.tabs.getZoom()
await browser.tabs.setZoom(tab.id, Math.max(zoomFactor - zoomStep / 100, 0.3))
}
/** Reset the zoom of the active tab of the current window */
export async function zoomReset () {
const [tab] = await browser.tabs.query({ currentWindow: true, active: true })
await browser.tabs.setZoom(tab.id, 0)
} Seems straightforward? (1) and (2) from the comment above already work as expected in saka key. EDIT: reopen #1866 since this PR is in coffeescript? |
Closing this PR because it's outdated, but I've reopened #1866 to track the feature request. |
Examples:
Fixes #1866.