- From: Wenson Hsieh via GitHub <sysbot+gh@w3.org>
- Date: Wed, 30 Nov 2016 21:42:56 +0000
- To: public-css-archive@w3.org
whsieh has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-scroll-snap] Choosing a snap position when children have mixed scroll-snap-align values == (Concerning the Scroll Snap Module Level 1 spec here: https://www.w3.org/TR/2016/CR-css-scroll-snap-1-20161020) Suppose we have a scroll snap container with 4 children arranged in a 2 by 2 grid, and suppose the children have various mixed values for `scroll-snap-align`, such as `center none`, `none center`, and `center`. For simplicity, let's say that `scroll-snap-margin` and `scroll-padding` are all 0 on the children and container, respectively, and that the `scroll-snap-type` is `both mandatory`. Please see the attached diagram for an example. Given an initial scroll position and a target scroll position where one would normally land in the absence of scroll snapping, what are some guidelines we should follow when selecting the best snap position to land on? One naive approach is this: model the snap positions emitted by each snap area as line segments, with a start and end position (if neither block or inline axes are `none`, these positions are the same). For each snap area, compute the point on its line segment closest to the target scroll position. The snap position to choose is then the closest of these closest positions, provided this position is in the same direction as the scroll. Does this seem reasonable? ![scroll-snap-example](https://cloud.githubusercontent.com/assets/1448295/20772579/def81576-b702-11e6-84d8-7831a052e459.png) Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/780 using your GitHub account
Received on Wednesday, 30 November 2016 21:43:03 UTC