Re: [cssom-view] Correction and clarification for the coordinate systems of getClientRect/getBoundingClientRect

On Thu, Dec 1, 2011 at 1:57 PM, Yehuda Katz <wycats@gmail.com> wrote:
> On Thu, Dec 1, 2011 at 1:53 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Thu, Dec 1, 2011 at 1:44 PM, Simon Fraser <smfr@me.com> wrote:
>> > On Dec 1, 2011, at 9:17 AM, Rik Cabanier wrote:
>> >> That was just an example.
>> >> My point was that information is lost if you append all the transforms.
>> >> Better to give back the untransformed bounds and tell the user to do
>> >> the
>> >> math himself.
>> >
>> > That math is way too hard for the average web developer, if you need to
>> > take
>> > 3D transforms and perspective on ancestor elements into account.
>> >
>> > The better solution would be to have getBoundingClientQuads(), and a
>> > pointInQuad() helper method.
>>
>> We've had this discussion before.  There's a bunch of information and
>> variants of rects and quads that *might* be useful to expose.  Someone
>> needs to sit down and spend the time to figure out *what* to expose
>> and how to do it all sanely.  I don't think adding things piecemeal
>> will give us a good result in the end.
>
> Unfortunately, this means that for the forseeable future, doing hit
> detection and direct manipulation on transformed elements (very, very common
> on mobile devices) will continue to be complicated, error-prone, and
> somewhat outside the reach of the average developer :(

Yes.  But the alternative is accumulating a bunch of crufty legacy
methods that hinder development of a proper API.  We don't need
perfection, but we need something better than throwing use-cases at
the wall and solving them each individually.

This isn't something that'll take long to do, if someone is willing to
spend the time on it.  The past thread on www-style between me and roc
already got a good start on it.

~TJ

Received on Thursday, 1 December 2011 22:01:30 UTC