[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] How to unambiguously set canvas pixel size to be pixel-perfect?



I think .getBoundingClientRect(), .getClientRects() and .getBoxQuads() all share the same problem: I must first build the geometry to the correct size before I can measure it. But that requires me to mutate the DOM, so it's not so easy to use those apis to query the different sizes of the screen/viewport.


2014-06-12 20:26 GMT+03:00 Nat Duca <nduca@chromium.org>:
Does this help? https://hacks.mozilla.org/2014/03/introducing-the-getboxquads-api/



On Thu, Jun 12, 2014 at 9:03 AM, Jukka Jylänki <jujjyl@gmail.com> wrote:
Playing around with this more, I realize that in the "single fullscreen canvas" use case both limitations a) and b) can be overcome if the existing browser APIs changed slightly. I raised this bug https://bugzilla.mozilla.org/show_bug.cgi?id=1024493 to discuss about that.


2014-06-12 4:59 GMT+03:00 Mark Callow <callow.mark@artspark.co.jp>:

On 11/06/2014 23:01, Boris Zbarsky wrote:
Browsers have two distinct zoom modes in the wild:

1)  The mobile browser zoom-and-pan mode (called "pinch zoom" in the cssom-view spec): zooming doesn't change layout, and simply performs a draw-time upscale or something close to it (font rasterization here is complicated).  The size of the viewport (e.g. as measured by window.innerWidth) does not actually change in this mode.  Instead, the page spills out of the viewport if you zoom in and you can pan around it.

2)  The desktop browser page zoom mode (called "page zoom" in the spec): zooming changes the size of a CSS pixel as measured in device pixels (and hence the size of the viewport) then redoes the page layout using the new viewport size.  Effectively, this corresponds more or less (again, with some font rasterization complications) to resizing the window and then doing a paint-time upscale back to the original size. This can change where linebreaks happen and whatnot.  Typically the resulting layout will not spill out of the viewport horizontally.

In Firefox Mobile text is usually re-flowed on pinch zoom. Sometimes the text layout does spill out of the screen but adjusting the pinch zoom a bit remedies that. This is an observation as an end-user. I have read neither the spec's around this nor source code.

Regards

    -Mark

--
注意:この電子メールには、株式会社エイチアイの機密情報が含まれている場合が有ります。正式なメール受信者では無い場合はメール複製、 再配信または情報の使用を固く禁じております。エラー、手違いでこのメールを受け取られましたら削除を行い配信者にご連絡をお願いいたし ます.

NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.