W3C home > Mailing lists > Public > public-canvas-api@w3.org > October to December 2010

getZoomPercent - Zoom level needed for Canvas bitmaps

From: Charles Pritchard <chuck@jumis.com>
Date: Mon, 08 Nov 2010 11:12:18 -0800
Message-ID: <4CD84B92.7010505@jumis.com>
To: "public-canvas-api@w3.org" <public-canvas-api@w3.org>
Is there a standard in place to get the current zoom level?

When a user agent zooms the web page, changing the logical pixel ratio, 
Canvas elements may be repainted at a higher resolution,
to maintain crispness.

For example, at a 2x zoom, the pixel width/height are effectively doubled.

So the following would show up at 300x150 pixels, matching the bitmap:
<canvas style="width: 150px; height: 75px;" width="300" height="150">

I've brought this up in a few groups, but I don't know that it's gone 
anywhere.

Some Chrome-related discussion of zoom APIs can be found at the 
following link:
http://code.google.com/p/chromium/issues/detail?id=30583

document.body.style.zoom
chrome.tabs.getZoomPercent

There is a whole lot of quirk between the major browsers, in identifying 
the current
zoom level and available screen pixels. By standardizing an onZoom event 
and zoomRatio getter,
we could both repaint our canvas elements to match the zoom level. Our 
current method for
detecting zoom is fragile and low precision.


-Charles
Received on Monday, 8 November 2010 19:12:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 8 November 2010 19:12:51 GMT