web-view icon indicating copy to clipboard operation
web-view copied to clipboard

How can I allow the user to zoom with the mousewheel and/or ctrl +/-?

Open codic12 opened this issue 5 years ago • 9 comments

codic12 avatar Aug 10 '20 00:08 codic12

I am confused, ctrl +/- by default should zoom in... this should tell you how to use scroll wheel as well

Blakeinstein avatar Aug 13 '20 07:08 Blakeinstein

Ctrl +/- does not work, at least not while embedding Youtube it seems. Will try that, thanks.

codic12 avatar Aug 13 '20 15:08 codic12

Wait no, I'm talking about Ctrl+Scroll wheel haha, standard on most browers

codic12 avatar Aug 13 '20 15:08 codic12

Same here, how we can do this, maybe programmatically?

I think that a function like webview.zoom(percentage); would be awesome, how I can do that? there are bindings?

Emulator000 avatar Sep 30 '20 10:09 Emulator000

I will look into the docs for winrt webview, gtk webview and cocoa to see if we have a method to implement scale, but until then. You could use javascript.

function zoom(percent) {
       document.body.style.zoom = percent+"%";
}

Edit: Do note that this doesnt affect the actual browser scale.

Blakeinstein avatar Sep 30 '20 15:09 Blakeinstein

@Blakeinstein this is a different thing, what I need is to zoom the Webkit renderer, is something different, this is surely possible but not exposed by this lib.

Emulator000 avatar Sep 30 '20 15:09 Emulator000

I know, thats why I said I would look into said parent libs to see if its possible to implement said feature, i.e. scaling via the renderer programatically.

Blakeinstein avatar Sep 30 '20 15:09 Blakeinstein

See https://github.com/webview/webview/pull/482

The original webview project has the zoom functions added in.

raphtlw avatar Oct 10 '20 15:10 raphtlw

@raphtlw done here too :-)

Emulator000 avatar Oct 11 '20 11:10 Emulator000