I'm Morgan McGuire (@CasualEffects). I've been working on computer graphics and games for 20 years at great places including NVIDIA, University of Waterloo, Williams College, Brown University, Roblox, Unity, and Activision.

See my home page for a full index of my blog posts, books, research, and projects.

Thursday, February 9, 2012

Prevent overscroll on iOS Safari

iOS 5.x Safari supports single-finger scrolling of the contents of a DIV or IFRAME. However, scrolling that DIV too far makes your entire page scroll as well. This behavior is undesirable if the page was specifically designed to fill the mobile screen. I've seen some heavy-handed solutions to this, including disabling all scrolling and using iScroll 4 to simulate it.

Below is my solution.  This leverages the browser's own scrolling mechanisms and adds minimal runtime overhead, so scrolling stays lightweight, portable, and efficient.  The caller includes this script and then says something like:

<script>
  // This must be during the bubble phase (i.e., last argument =
  // false) so that inner objects have an opportunity to override it.
  document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false);
  var scroller = document.getElementById('scroller');
  preventOverScroll(scroller);
</script>

at the bottom of the HTML document.

Thursday, February 2, 2012

The Graphics Codex 1.2 Feature List

The Graphics Codex 1.2 update will be available on the App Store at the end of February. This post describes development work on this update.


I choose features based on community feedback. E-mail feature requests and corrections to me (Morgan) at morgan@casual-effects.com or tweet @CasualEffectsVote on major feature priority on the web page.


Confirmed changes in 1.2:
  • New features
    • Rewrote user interface from scratch for faster loading and scrolling
    • Buttons are easier to press
    • Scrollbar indicators
    • New look (see below)
  • New topics
    • Euler Characteristic
    • Euler Formula
    • The Sun, including spectrum and radiance
    • New diagrams for intersection topics
    • LaTeX includegraphics documentation, space, and font-size tables
    • n-dimensional Convolution
    • n-dimensional Cross-Correlation
    • Table of LaTeX, HTML, Unicode, and ASCII math symbols
    • Axis-angle to unit quaternion
    • Quaternion product
    • Manhattan distance
  • Corrections
    • Sideways scrolling for large tables and figures on iPhone
    • Consistent font sizes on iPhone
    • Rotation from Unit Quaternion topic [quat2mat] now works
    • Corrected definition of psi in [sphry], [sphrz]
    • Restored the missing 1's in [trns3]


New look: