-
Notifications
You must be signed in to change notification settings - Fork 29
Description
(Previously #83)
Currently the XRRay vector constructor is specified as
[Constructor(optional DOMPointInit origin, optional DOMPointInit direction)]
however, this is no longer allowed by the current WebIDL spec, it needs to be
constructor(optional DOMPointInit origin = {}, optional DOMPointInit direction = {});
(whatwg/webidl#750 forces us to default to {})
Given that whatwg/webidl#750 forces optional dictionary arguments to specify a default, we can no longer distinguish between "direction was not specified" and "direction was specified as {0, 0, 0, 1}".
Unfortunately, {0, 0, 0, 1} is not a valid direction value! The w coordinate should be zero; and ideally we should throw for nonzero w (which is what Chrome does, despite being unspecced). But we can't tell the difference between "direction unspecified" and "direction is {0, 0, 0, 1}", so this would end up throwing for new XRRay({...}) with an unspecified direction.
We'd like to default it to the -Z axis instead. We should use a new dictionary here. We should also potentially handle the w coordinate in origin instead of ignoring it.